Skip to content

Commit a3730c5

Browse files
author
Andreas Gruenbacher
committed
gfs2: Unlock fewer glocks on unmount
At unmount time, we would generally like to explicitly unlock as few glocks as possible for efficiency. We are already skipping glocks that don't have a lock value block (LVB), but we can also skip glocks which are not held in DLM_LOCK_EX or DLM_LOCK_PW mode (of which gfs2 only uses DLM_LOCK_EX under the name LM_ST_EXCLUSIVE). Signed-off-by: Andreas Gruenbacher <[email protected]> Cc: David Teigland <[email protected]>
1 parent d98779e commit a3730c5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

fs/gfs2/lock_dlm.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,16 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
316316
gfs2_glock_free(gl);
317317
return;
318318
}
319-
/* don't want to skip dlm_unlock writing the lvb when lock has one */
319+
320+
/*
321+
* When the lockspace is released, all remaining glocks will be
322+
* unlocked automatically. This is more efficient than unlocking them
323+
* individually, but when the lock is held in DLM_LOCK_EX or
324+
* DLM_LOCK_PW mode, the lock value block (LVB) will be lost.
325+
*/
320326

321327
if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) &&
322-
!gl->gl_lksb.sb_lvbptr) {
328+
(!gl->gl_lksb.sb_lvbptr || gl->gl_state != LM_ST_EXCLUSIVE)) {
323329
gfs2_glock_free_later(gl);
324330
return;
325331
}

0 commit comments

Comments
 (0)