]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: fix handling of synchronous errors in xfs_buf_submit
authorChristoph Hellwig <hch@lst.de>
Thu, 25 Jun 2026 13:58:35 +0000 (15:58 +0200)
committerCarlos Maiolino <cem@kernel.org>
Wed, 1 Jul 2026 10:29:50 +0000 (12:29 +0200)
Synchronous readers and writers already run __xfs_buf_ioend from
xfs_buf_iowait after being woken through bp->b_iowait, so we
should not call it here, which can lead to double completions.

Fixes: 4b90de5bc0f5 ("xfs: reduce context switches for synchronous buffered I/O")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_buf.c

index f5e23c8b07b6d89b03871e8b71ac67db7f48c946..f18e53b60f547b9c6a94c17423b85fe24a7fec99 100644 (file)
@@ -1404,12 +1404,12 @@ ioerror:
        bp->b_flags &= ~XBF_DONE;
        xfs_buf_stale(bp);
 end_io:
-       if (!__xfs_buf_ioend(bp))
-               return;
-       if (bp->b_flags & XBF_ASYNC)
-               xfs_buf_relse(bp);
-       else
+       if (bp->b_flags & XBF_ASYNC) {
+               if (__xfs_buf_ioend(bp))
+                       xfs_buf_relse(bp);
+       } else {
                complete(&bp->b_iowait);
+       }
 }
 
 /*