]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: fix a double completion for buffers on in-memory targets
authorChristoph Hellwig <hch@lst.de>
Mon, 13 Jan 2025 14:12:05 +0000 (15:12 +0100)
committerCarlos Maiolino <cem@kernel.org>
Tue, 14 Jan 2025 10:38:14 +0000 (11:38 +0100)
__xfs_buf_submit calls xfs_buf_ioend when b_io_remaining hits zero.  For
in-memory buftargs b_io_remaining is never incremented from it's initial
value of 1, so this always happens.  Thus the extra call to xfs_buf_ioend
in _xfs_buf_ioapply causes a double completion.  Fortunately
__xfs_buf_submit is only used for synchronous reads on in-memory buftargs
due to the peculiarities of how they work, so this is mostly harmless and
just causes a little extra work to be done.

Fixes: 5076a6040ca1 ("xfs: support in-memory buffer cache targets")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Acked-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_buf.c

index 6f313fbf766910999707e13c4f0ba98fa07ecdf7..da38c18acbbaf346da13902ad1ff784de3f8e57d 100644 (file)
@@ -1657,10 +1657,8 @@ _xfs_buf_ioapply(
        op |= REQ_META;
 
        /* in-memory targets are directly mapped, no IO required. */
-       if (xfs_buftarg_is_mem(bp->b_target)) {
-               xfs_buf_ioend(bp);
+       if (xfs_buftarg_is_mem(bp->b_target))
                return;
-       }
 
        /*
         * Walk all the vectors issuing IO on them. Set up the initial offset