]> www.infradead.org Git - users/hch/xfsprogs.git/commit
libxfs: fix buffer refcounting in delwri_queue
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 26 Sep 2019 17:46:21 +0000 (13:46 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 26 Sep 2019 17:46:21 +0000 (13:46 -0400)
commit3d943e22b8fdd8045e2e89ed1fc14b7ab76b3054
treec3cf1b2c6211df44739b2580978618d8d06b102b
parentcad1569678d85b8876597de2d4a2d61fccaea5bb
libxfs: fix buffer refcounting in delwri_queue

In the kernel, xfs_buf_delwri_queue increments the buffer reference
count before putting the buffer on the buffer list, and the refcount is
decremented after the io completes for a net refcount change of zero.

In userspace, delwri_queue calls libxfs_writebuf, which puts the buffer.
delwri_queue is a no-op, for a net refcount change of -1.  This creates
problems for any callers that expect a net change of zero, so increment
the buffer refcount before calling writebuf.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/libxfs_io.h
libxfs/libxfs_priv.h