GFS2: ignore unlock failures after withdraw
authorBenjamin Marzinski <bmarzins@redhat.com>
Wed, 23 Mar 2016 18:29:59 +0000 (14:29 -0400)
committerBob Peterson <rpeterso@redhat.com>
Thu, 24 Mar 2016 12:28:48 +0000 (08:28 -0400)
After gfs2 has withdrawn the filesystem, it may still have many locks not
in the unlocked state.  If it is using lock_dlm, it will failed trying
the unlocks since it has already unmounted the lock manager. Instead, it
should set the SDF_SKIP_DLM_UNLOCK flag on withdraw, to signal that
it can skip the lock_manager on unlocks, and failback to lock_nolock
style unlocking.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
fs/gfs2/glock.c
fs/gfs2/util.c

index 6539131c52a24fd7f694866fc041dbbe1e09b8f5..2897ced5fca007feff74db8400aa1acd455be557 100644 (file)
@@ -475,7 +475,14 @@ __acquires(&gl->gl_lockref.lock)
        if (sdp->sd_lockstruct.ls_ops->lm_lock) {
                /* lock_dlm */
                ret = sdp->sd_lockstruct.ls_ops->lm_lock(gl, target, lck_flags);
-               if (ret) {
+               if (ret == -EINVAL && gl->gl_target == LM_ST_UNLOCKED &&
+                   target == LM_ST_UNLOCKED &&
+                   test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags)) {
+                       finish_xmote(gl, target);
+                       if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
+                               gfs2_glock_put(gl);
+               }
+               else if (ret) {
                        pr_err("lm_lock ret %d\n", ret);
                        GLOCK_BUG_ON(gl, 1);
                }
index cf645835710f8e2e9ea916939418f66adc9655cc..aee4485ad8a9b4f75de1bb9fa356f582ff4a5e4c 100644 (file)
@@ -68,6 +68,7 @@ int gfs2_lm_withdraw(struct gfs2_sbd *sdp, const char *fmt, ...)
                        fs_err(sdp, "telling LM to unmount\n");
                        lm->lm_unmount(sdp);
                }
+               set_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags);
                fs_err(sdp, "withdrawn\n");
                dump_stack();
        }