gfs2: Lift withdraw check out of gfs2_ail1_empty
authorAndreas Gruenbacher <agruenba@redhat.com>
Wed, 20 Dec 2023 17:09:22 +0000 (18:09 +0100)
committerAndreas Gruenbacher <agruenba@redhat.com>
Wed, 20 Dec 2023 20:29:41 +0000 (21:29 +0100)
Lift the check for the SDF_WITHDRAWING flag out of gfs2_ail1_empty() and
into its callers.  This is needed so that gfs2_flush_revokes() can drop
the sd_log_lock spinlock before triggering a withdraw if necessary.

Instead of checking for the SDF_WITHDRAWING flag, use
gfs2_withdrawing().  Also, the low-level code triggering the delayed
withdraw reports when there is a problem, so there is no need to report
that again.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/log.c

index 8691839104b7682adf8e98ddc3f30ee3a45fe5c8..fdef6bc77c54198a1534e56fe81e9ee6ae59579b 100644 (file)
@@ -373,11 +373,6 @@ static bool gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes)
        empty = list_empty(&sdp->sd_ail1_list);
        spin_unlock(&sdp->sd_ail_lock);
 
-       if (test_bit(SDF_WITHDRAWING, &sdp->sd_flags)) {
-               gfs2_lm(sdp, "fatal: I/O error(s)\n");
-               gfs2_withdraw(sdp);
-       }
-
        return empty;
 }
 
@@ -815,6 +810,9 @@ void gfs2_flush_revokes(struct gfs2_sbd *sdp)
        gfs2_log_lock(sdp);
        gfs2_ail1_empty(sdp, max_revokes);
        gfs2_log_unlock(sdp);
+
+       if (gfs2_withdrawing(sdp))
+               gfs2_withdraw(sdp);
 }
 
 /**
@@ -987,7 +985,13 @@ static void empty_ail1_list(struct gfs2_sbd *sdp)
                gfs2_ail1_start(sdp);
                gfs2_ail1_wait(sdp);
                empty = gfs2_ail1_empty(sdp, 0);
+
+               if (gfs2_withdrawing_or_withdrawn(sdp))
+                       break;
        }
+
+       if (gfs2_withdrawing(sdp))
+               gfs2_withdraw(sdp);
 }
 
 /**
@@ -1344,6 +1348,9 @@ int gfs2_logd(void *data)
                                t);
        }
 
+       if (gfs2_withdrawing(sdp))
+               gfs2_withdraw(sdp);
+
        return 0;
 }