]> www.infradead.org Git - users/hch/misc.git/commitdiff
gfs2: do_xmote cleanup
authorAndreas Gruenbacher <agruenba@redhat.com>
Tue, 8 Jul 2025 17:13:32 +0000 (19:13 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Fri, 12 Sep 2025 10:02:02 +0000 (12:02 +0200)
Check for asynchronous completion and clear the GLF_PENDING_REPLY flag
earlier in do_xmote().  This will make future changes more readable.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Andrew Price <anprice@redhat.com>
fs/gfs2/glock.c

index 09af1fe12503849c4661ca0b88b873ec70b1955e..f1383e9445bec8d398b9cd7332b3fd8d6b0f5757 100644 (file)
@@ -816,6 +816,12 @@ skip_inval:
                ret = ls->ls_ops->lm_lock(gl, target, lck_flags);
                spin_lock(&gl->gl_lockref.lock);
 
+               if (!ret) {
+                       /* The operation will be completed asynchronously. */
+                       return;
+               }
+               clear_bit(GLF_PENDING_REPLY, &gl->gl_flags);
+
                if (ret == -EINVAL && gl->gl_target == LM_ST_UNLOCKED &&
                    target == LM_ST_UNLOCKED &&
                    test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) {
@@ -823,14 +829,10 @@ skip_inval:
                         * The lockspace has been released and the lock has
                         * been unlocked implicitly.
                         */
-               } else if (ret) {
+               } else {
                        fs_err(sdp, "lm_lock ret %d\n", ret);
                        target = gl->gl_state | LM_OUT_ERROR;
-               } else {
-                       /* The operation will be completed asynchronously. */
-                       return;
                }
-               clear_bit(GLF_PENDING_REPLY, &gl->gl_flags);
        }
 
        /* Complete the operation now. */