]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: open code xfs_buf_ioend_fail in xfs_buf_submit
authorChristoph Hellwig <hch@lst.de>
Thu, 25 Jun 2026 13:58:31 +0000 (15:58 +0200)
committerCarlos Maiolino <cem@kernel.org>
Wed, 1 Jul 2026 09:21:35 +0000 (11:21 +0200)
This better integrates with the other failure handling in xfs_buf_submit,
and prepares for a better API in xfs_buf_ioend_fail.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_buf.c

index 2a7d696d394a01c7b486a8472b9f8727284d4127..a108d31996f2715606514e436189ef180ea56c0c 100644 (file)
@@ -1383,10 +1383,8 @@ xfs_buf_submit(
         * state here rather than mount state to avoid corrupting the log tail
         * on shutdown.
         */
-       if (bp->b_mount->m_log && xlog_is_shutdown(bp->b_mount->m_log)) {
-               xfs_buf_ioend_fail(bp);
-               return;
-       }
+       if (bp->b_mount->m_log && xlog_is_shutdown(bp->b_mount->m_log))
+               goto ioerror;
 
        if (bp->b_flags & XBF_WRITE)
                xfs_buf_wait_unpin(bp);
@@ -1399,17 +1397,22 @@ xfs_buf_submit(
 
        if ((bp->b_flags & XBF_WRITE) && !xfs_buf_verify_write(bp)) {
                xfs_force_shutdown(bp->b_mount, SHUTDOWN_CORRUPT_INCORE);
-               xfs_buf_ioend(bp);
-               return;
+               goto end_io;
        }
 
        /* In-memory targets are directly mapped, no I/O required. */
-       if (xfs_buftarg_is_mem(bp->b_target)) {
-               xfs_buf_ioend(bp);
-               return;
-       }
+       if (xfs_buftarg_is_mem(bp->b_target))
+               goto end_io;
 
        xfs_buf_submit_bio(bp);
+       return;
+
+ioerror:
+       bp->b_flags &= ~XBF_DONE;
+       xfs_buf_stale(bp);
+       xfs_buf_ioerror(bp, -EIO);
+end_io:
+       xfs_buf_ioend(bp);
 }
 
 /*