[Cluster-devel] [GFS2 PATCH] GFS2: Allow minimum hold time for all glocks

Bob Peterson rpeterso at redhat.com
Wed Oct 17 17:36:08 UTC 2012


Hi,

Before this patch, only inode glocks were held for a minimum length
of time. This patch extends that to all glocks, unless the locking
protocol is lock_nolock.

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 beaa834..3f1df8b 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -683,7 +683,7 @@ static void glock_work_func(struct work_struct *work)
 	if (!delay)
 		gfs2_glock_put(gl);
 	else {
-		if (gl->gl_name.ln_type != LM_TYPE_INODE)
+		if (gl->gl_sbd->sd_lockstruct.ls_ops->lm_lock == NULL)
 			delay = 0;
 		if (queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0)
 			gfs2_glock_put(gl);
@@ -1110,7 +1110,7 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
 	gfs2_glock_hold(gl);
 	if (test_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) &&
 	    !test_bit(GLF_DEMOTE, &gl->gl_flags) &&
-	    gl->gl_name.ln_type == LM_TYPE_INODE)
+	    gl->gl_sbd->sd_lockstruct.ls_ops->lm_lock != NULL)
 		delay = gl->gl_hold_time;
 	if (queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0)
 		gfs2_glock_put(gl);
@@ -1293,7 +1293,7 @@ void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state)
 	gfs2_glock_hold(gl);
 	holdtime = gl->gl_tchange + gl->gl_hold_time;
 	if (test_bit(GLF_QUEUED, &gl->gl_flags) &&
-	    gl->gl_name.ln_type == LM_TYPE_INODE) {
+	    gl->gl_sbd->sd_lockstruct.ls_ops->lm_lock != NULL) {
 		if (time_before(now, holdtime))
 			delay = holdtime - now;
 		if (test_bit(GLF_REPLY_PENDING, &gl->gl_flags))




More information about the Cluster-devel mailing list