Skip to contentSkip to conversation

GFS2: Allow minimum hold time for all glocks

PATCH New Bob Peterson 1 participant 1 message Oct 17, 2012 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GFS2: Allow minimum hold time for all glocks

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

---

fs/gfs2/glock.c +3 -3
index beaa834..3f1df8b 100644
@@ -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))