Message ID | 20250106095613.847700-12-hch@lst.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [01/15] xfs: fix a double completion for buffers on in-memory targets | expand |
On Mon, Jan 06, 2025 at 10:54:48AM +0100, Christoph Hellwig wrote: > Nothing touches the buffer after it has been submitted now, so the need for > the extra transient reference went away as well. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Ooops, forgot this one. Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> --D > --- > fs/xfs/xfs_buf.c | 17 +---------------- > 1 file changed, 1 insertion(+), 16 deletions(-) > > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c > index 49df4adf0e98..352cc50aeea5 100644 > --- a/fs/xfs/xfs_buf.c > +++ b/fs/xfs/xfs_buf.c > @@ -1646,13 +1646,6 @@ xfs_buf_submit( > return -EIO; > } > > - /* > - * Grab a reference so the buffer does not go away underneath us. For > - * async buffers, I/O completion drops the callers reference, which > - * could occur before submission returns. > - */ > - xfs_buf_hold(bp); > - > if (bp->b_flags & XBF_WRITE) > xfs_buf_wait_unpin(bp); > > @@ -1675,20 +1668,12 @@ xfs_buf_submit( > goto done; > > xfs_buf_submit_bio(bp); > - goto rele; > - > + return 0; > done: > if (bp->b_error || !(bp->b_flags & XBF_ASYNC)) > xfs_buf_ioend(bp); > else > xfs_buf_ioend_async(bp); > -rele: > - /* > - * Release the hold that keeps the buffer referenced for the entire > - * I/O. Note that if the buffer is async, it is not safe to reference > - * after this release. > - */ > - xfs_buf_rele(bp); > return 0; > } > > -- > 2.45.2 > >
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 49df4adf0e98..352cc50aeea5 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1646,13 +1646,6 @@ xfs_buf_submit( return -EIO; } - /* - * Grab a reference so the buffer does not go away underneath us. For - * async buffers, I/O completion drops the callers reference, which - * could occur before submission returns. - */ - xfs_buf_hold(bp); - if (bp->b_flags & XBF_WRITE) xfs_buf_wait_unpin(bp); @@ -1675,20 +1668,12 @@ xfs_buf_submit( goto done; xfs_buf_submit_bio(bp); - goto rele; - + return 0; done: if (bp->b_error || !(bp->b_flags & XBF_ASYNC)) xfs_buf_ioend(bp); else xfs_buf_ioend_async(bp); -rele: - /* - * Release the hold that keeps the buffer referenced for the entire - * I/O. Note that if the buffer is async, it is not safe to reference - * after this release. - */ - xfs_buf_rele(bp); return 0; }
Nothing touches the buffer after it has been submitted now, so the need for the extra transient reference went away as well. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/xfs/xfs_buf.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)