Skip to content

Commit d1340f8

Browse files
committed
gfs2: Don't call dlm after protocol is unmounted
In the gfs2 withdraw sequence, the dlm protocol is unmounted with a call to lm_unmount. After a withdraw, users are allowed to unmount the withdrawn file system. But at that point we may still have glocks left over that we need to free via unmount's call to gfs2_gl_hash_clear. These glocks may have never been completed because of whatever problem caused the withdraw (IO errors or whatever). Before this patch, function gdlm_put_lock would still try to call into dlm to unlock these leftover glocks, which resulted in dlm returning -EINVAL because the lock space was abandoned. These glocks were never freed because there was no mechanism after that to free them. This patch adds a check to gdlm_put_lock to see if the locking protocol was inactive (DFL_UNMOUNT flag) and if so, free the glock and not make the invalid call into dlm. I could have combined this "if" with the one that follows, related to leftover glock LVBs, but I felt the code was more readable with its own if clause. Signed-off-by: Bob Peterson <rpeterso@redhat.com>
1 parent 8cc67f7 commit d1340f8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎fs/gfs2/lock_dlm.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,11 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
299299
gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT);
300300
gfs2_update_request_times(gl);
301301

302+
/* don't want to call dlm if we've unmounted the lock protocol */
303+
if (test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) {
304+
gfs2_glock_free(gl);
305+
return;
306+
}
302307
/* don't want to skip dlm_unlock writing the lvb when lock has one */
303308

304309
if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) &&

0 commit comments

Comments
 (0)