gfs2: Withdraw immediately on log write errors

Now that gfs2_withdraw() is asynchronous, immediately withdraw when
a log write error is detected.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
This commit is contained in:
Andreas Gruenbacher 2025-08-05 23:52:51 +02:00
parent 1b7d498dca
commit 0e2038a90c
2 changed files with 2 additions and 14 deletions

View 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 @@ __acquires(&gl->gl_lockref.lock)
* 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))) {

View 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);