diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2024-04-10 05:23:19 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2024-04-24 19:48:20 +0200 |
commit | a3730c5ec57b033ba6e437f7881a894d57b28a4a (patch) | |
tree | 02450a3bfb66455ac32cae456c5ede4741de2fcd /fs/gfs2 | |
parent | d98779e687726d8f8860f1c54b5687eec5f63a73 (diff) | |
download | lwn-a3730c5ec57b033ba6e437f7881a894d57b28a4a.tar.gz lwn-a3730c5ec57b033ba6e437f7881a894d57b28a4a.zip |
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 <agruenba@redhat.com>
Cc: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/lock_dlm.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index e028e55e67d9..49059274a528 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c @@ -316,10 +316,16 @@ static void gdlm_put_lock(struct gfs2_glock *gl) gfs2_glock_free(gl); return; } - /* don't want to skip dlm_unlock writing the lvb when lock has one */ + + /* + * When the lockspace is released, all remaining glocks will be + * unlocked automatically. This is more efficient than unlocking them + * individually, but when the lock is held in DLM_LOCK_EX or + * DLM_LOCK_PW mode, the lock value block (LVB) will be lost. + */ if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) && - !gl->gl_lksb.sb_lvbptr) { + (!gl->gl_lksb.sb_lvbptr || gl->gl_state != LM_ST_EXCLUSIVE)) { gfs2_glock_free_later(gl); return; } |