xfs: remove _XBF_LOGRECOVERY

Adding _XBF_LOGRECOVERY to every buffer write from log recovery is error
prone.  Instead key off the behavior on log recovery being active with
indirecting that through a flag.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
Christoph Hellwig 2026-07-15 16:50:58 +02:00 committed by Carlos Maiolino
parent 7a4eae80b5
commit d80fe85bb2
7 changed files with 10 additions and 19 deletions

View File

@ -1017,7 +1017,7 @@ xfs_buf_ioend_handle_error(
* We're not going to bother about retrying this during recovery.
* One strike!
*/
if (bp->b_flags & _XBF_LOGRECOVERY) {
if (mp->m_log && xlog_in_recovery(mp->m_log)) {
xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
return false;
}
@ -1124,8 +1124,7 @@ xfs_buf_ioend(
bp->b_iodone(bp);
}
bp->b_flags &= ~(XBF_READ | XBF_WRITE | XBF_READ_AHEAD |
_XBF_LOGRECOVERY);
bp->b_flags &= ~(XBF_READ | XBF_WRITE | XBF_READ_AHEAD);
if (async)
xfs_buf_relse(bp);
}

View File

@ -34,9 +34,6 @@ struct xfs_buf;
#define XBF_STALE (1u << 6) /* buffer has been staled, do not find it */
#define XBF_WRITE_FAIL (1u << 7) /* async writes have failed on this buffer */
/* buffer type flags for write callbacks */
#define _XBF_LOGRECOVERY (1u << 18)/* log recovery buffer */
/* flags used only internally */
#define _XBF_KMEM (1u << 21)/* backed by heap memory */
#define _XBF_DELWRI_Q (1u << 22)/* buffer on a delwri queue */
@ -61,7 +58,6 @@ typedef unsigned int xfs_buf_flags_t;
{ XBF_DONE, "DONE" }, \
{ XBF_STALE, "STALE" }, \
{ XBF_WRITE_FAIL, "WRITE_FAIL" }, \
{ _XBF_LOGRECOVERY, "LOG_RECOVERY" }, \
{ _XBF_KMEM, "KMEM" }, \
{ _XBF_DELWRI_Q, "DELWRI_Q" }, \
/* The following interface flags should never be set */ \

View File

@ -1066,6 +1066,8 @@ void
xfs_buf_item_done(
struct xfs_buf *bp)
{
struct xfs_buf_log_item *bip = bp->b_log_item;
/*
* If we are forcibly shutting down, this may well be off the AIL
* already. That's because we simulate the log-committed callbacks to
@ -1078,8 +1080,8 @@ xfs_buf_item_done(
* Note that log recovery writes might have buffer items that are not on
* the AIL even when the file system is not shut down.
*/
xfs_trans_ail_delete(&bp->b_log_item->bli_item,
(bp->b_flags & _XBF_LOGRECOVERY) ? 0 :
SHUTDOWN_CORRUPT_INCORE);
xfs_buf_item_relse(bp->b_log_item);
xfs_trans_ail_delete(&bip->bli_item,
xlog_in_recovery(bip->bli_item.li_log) ?
0 : SHUTDOWN_CORRUPT_INCORE);
xfs_buf_item_relse(bip);
}

View File

@ -448,7 +448,6 @@ xlog_recover_validate_buf_type(
if (bp->b_ops) {
struct xfs_buf_log_item *bip;
bp->b_flags |= _XBF_LOGRECOVERY;
xfs_buf_item_init(bp, mp);
bip = bp->b_log_item;
bip->bli_item.li_lsn = current_lsn;
@ -1122,7 +1121,6 @@ xlog_recover_buf_commit_pass2(
xfs_buf_lock(rtsb_bp);
xfs_buf_hold(rtsb_bp);
xfs_update_rtsb(rtsb_bp, bp);
rtsb_bp->b_flags |= _XBF_LOGRECOVERY;
xfs_buf_delwri_queue(rtsb_bp, buffer_list);
xfs_buf_relse(rtsb_bp);
}
@ -1164,7 +1162,6 @@ xlog_recover_buf_commit_pass2(
error = xfs_bwrite(bp);
} else {
ASSERT(bp->b_mount == mp);
bp->b_flags |= _XBF_LOGRECOVERY;
xfs_buf_delwri_queue(bp, buffer_list);
}

View File

@ -168,7 +168,6 @@ xlog_recover_dquot_commit_pass2(
ASSERT(dq_f->qlf_size == 2);
ASSERT(bp->b_mount == mp);
bp->b_flags |= _XBF_LOGRECOVERY;
xfs_buf_delwri_queue(bp, buffer_list);
out_release:

View File

@ -586,7 +586,6 @@ xlog_recover_inode_commit_pass2(
}
ASSERT(bp->b_mount == mp);
bp->b_flags |= _XBF_LOGRECOVERY;
xfs_buf_delwri_queue(bp, buffer_list);
out_release:

View File

@ -3279,9 +3279,8 @@ xlog_do_recovery_pass(
* checkpoints at this start LSN.
*
* Note: Shutting down the filesystem will result in the
* delwri submission marking all the buffers stale,
* completing them and cleaning up _XBF_LOGRECOVERY
* state without doing any IO.
* delwri submission marking all the buffers stale and
* completing them without doing any IO.
*/
xlog_force_shutdown(log, SHUTDOWN_LOG_IO_ERROR);
}