[Cluster-devel] [GFS2 PATCH] GFS2: Don't delay TRY locks

Bob Peterson rpeterso at redhat.com
Wed Oct 17 17:37:49 UTC 2012


Hi,

This patch changes the glock minimum hold time down to zero if
the glock is a "try" lock.

Regards,

Bob Peterson
Red Hat File Systems

Signed-off-by: Bob Peterson <rpeterso at redhat.com> 
---
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 3f1df8b..98ae8a2 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1289,6 +1289,7 @@ void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state)
 	unsigned long delay = 0;
 	unsigned long holdtime;
 	unsigned long now = jiffies;
+	const struct gfs2_holder *gh_head;
 
 	gfs2_glock_hold(gl);
 	holdtime = gl->gl_tchange + gl->gl_hold_time;
@@ -1301,6 +1302,12 @@ void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state)
 	}
 
 	spin_lock(&gl->gl_spin);
+	if (!list_empty(&gl->gl_holders)) {
+		gh_head = list_entry(gl->gl_holders.next,
+				     const struct gfs2_holder, gh_list);
+		if (gh_head->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB))
+			delay = 0;
+	}
 	handle_callback(gl, state, delay);
 	spin_unlock(&gl->gl_spin);
 	if (queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0)




More information about the Cluster-devel mailing list