gfs2: Fix "ignore unlock failures after withdraw"
authorAndreas Gruenbacher <agruenba@redhat.com>
Fri, 5 Apr 2024 11:47:51 +0000 (13:47 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Tue, 9 Apr 2024 16:35:58 +0000 (18:35 +0200)
Commit 3e11e53041502 tries to suppress dlm_lock() lock conversion errors
that occur when the lockspace has already been released.

It does that by setting and checking the SDF_SKIP_DLM_UNLOCK flag.  This
conflicts with the intended meaning of the SDF_SKIP_DLM_UNLOCK flag, so
check whether the lockspace is still allocated instead.

(Given the current DLM API, checking for this kind of error after the
fact seems easier that than to make sure that the lockspace is still
allocated before calling dlm_lock().  Changing the DLM API so that users
maintain the lockspace references themselves would be an option.)

Fixes: 3e11e53041502 ("GFS2: ignore unlock failures after withdraw")
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/glock.c
fs/gfs2/util.c

index fa047331ea3c52c7ba4518d32c0aa9bf249cfc60..ec1f8eb28950937988bc006569ba7937d4f02e6b 100644 (file)
@@ -810,11 +810,13 @@ skip_inval:
        }
 
        if (sdp->sd_lockstruct.ls_ops->lm_lock) {
+               struct lm_lockstruct *ls = &sdp->sd_lockstruct;
+
                /* lock_dlm */
                ret = sdp->sd_lockstruct.ls_ops->lm_lock(gl, target, lck_flags);
                if (ret == -EINVAL && gl->gl_target == LM_ST_UNLOCKED &&
                    target == LM_ST_UNLOCKED &&
-                   test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags)) {
+                   test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) {
                        finish_xmote(gl, target);
                        gfs2_glock_queue_work(gl, 0);
                } else if (ret) {
index 0535a0206512ff4255f9d9be12395ac916821ea1..09238604d741902c7635b29c61fa41a836284178 100644 (file)
@@ -350,7 +350,6 @@ int gfs2_withdraw(struct gfs2_sbd *sdp)
                        fs_err(sdp, "telling LM to unmount\n");
                        lm->lm_unmount(sdp);
                }
-               set_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags);
                fs_err(sdp, "File system withdrawn\n");
                dump_stack();
                clear_bit(SDF_WITHDRAW_IN_PROG, &sdp->sd_flags);