]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gfs2: Withdraw immediately on log write errors
authorAndreas Gruenbacher <agruenba@redhat.com>
Tue, 5 Aug 2025 21:52:51 +0000 (23:52 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Wed, 26 Nov 2025 23:52:26 +0000 (23:52 +0000)
Now that gfs2_withdraw() is asynchronous, immediately withdraw when
a log write error is detected.

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

index 8ecd9c477f02e00a0a12b4379b12b2cd155df9f1..7dd96086eeaa4a31a10f9ace2ade57e4aaf8f5b4 100644 (file)
@@ -710,6 +710,7 @@ __acquires(&gl->gl_lockref.lock)
                if (cmpxchg(&sdp->sd_log_error, 0, ret)) {
                        fs_err(sdp, "Error %d syncing glock\n", ret);
                        gfs2_dump_glock(NULL, gl, true);
+                       gfs2_withdraw(sdp);
                }
                spin_lock(&gl->gl_lockref.lock);
                goto skip_inval;
@@ -728,6 +729,7 @@ __acquires(&gl->gl_lockref.lock)
                        gfs2_glock_assert_warn(gl,
                                               !atomic_read(&gl->gl_ail_count));
                        gfs2_dump_glock(NULL, gl, true);
+                       gfs2_withdraw(sdp);
                }
                glops->go_inval(gl, target == LM_ST_DEFERRED ? 0 : DIO_METADATA);
        }
@@ -755,8 +757,6 @@ skip_inval:
         * gfs2_gl_hash_clear calls clear_glock) and recovery is complete
         * then it's okay to tell dlm to unlock it.
         */
-       if (unlikely(sdp->sd_log_error) && !gfs2_withdrawn(sdp))
-               gfs2_withdraw(sdp);
        if (glock_blocked_by_withdraw(gl) &&
            (target != LM_ST_UNLOCKED ||
             test_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags))) {
index b97da7f4d3f873829a5e0b77573234c576be1700..69734e18b23d97c548bd7637babd5ff5feb39650 100644 (file)
@@ -1299,17 +1299,6 @@ int gfs2_logd(void *data)
                if (gfs2_withdrawn(sdp))
                        break;
 
-               /* Check for errors writing to the journal */
-               if (sdp->sd_log_error) {
-                       gfs2_lm(sdp,
-                               "GFS2: fsid=%s: error %d: "
-                               "withdrawing the file system to "
-                               "prevent further damage.\n",
-                               sdp->sd_fsname, sdp->sd_log_error);
-                       gfs2_withdraw(sdp);
-                       break;
-               }
-
                if (gfs2_jrnl_flush_reqd(sdp) || t == 0) {
                        gfs2_ail1_empty(sdp, 0);
                        gfs2_log_flush(sdp, NULL, GFS2_LOG_HEAD_FLUSH_NORMAL |
@@ -1332,7 +1321,6 @@ int gfs2_logd(void *data)
                                test_bit(SDF_FORCE_AIL_FLUSH, &sdp->sd_flags) ||
                                gfs2_ail_flush_reqd(sdp) ||
                                gfs2_jrnl_flush_reqd(sdp) ||
-                               sdp->sd_log_error ||
                                gfs2_withdrawn(sdp) ||
                                kthread_should_stop(),
                                t);