]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: hold xfs_buf locked between shortform->leaf conversion and the addition of an...
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 3 Jan 2018 19:42:08 +0000 (13:42 -0600)
committerEric Sandeen <sandeen@redhat.com>
Wed, 3 Jan 2018 19:42:08 +0000 (13:42 -0600)
commit3fbc4d7df3d9f9951589394873bd250b1d573347
treeb108c4ed578ecef40e8b1d90fa980dd580f83ef9
parent6f67c32d94e26f8478cbf4e8f61755bacdaba5a7
xfs: hold xfs_buf locked between shortform->leaf conversion and the addition of an attribute

Source kernel commit: 6e643cd094de3bd0f97edcc1db0089afa24d909f

The new attribute leaf buffer is not held locked across the transaction
roll between the shortform->leaf modification and the addition of the
new entry.  As a result, the attribute buffer modification being made is
not atomic from an operational perspective.  Hence the AIL push can grab
it in the transient state of "just created" after the initial
transaction is rolled, because the buffer has been released.  This leads
to xfs_attr3_leaf_verify() asserting that hdr.count is zero, treating
this as in-memory corruption, and shutting down the filesystem.

Darrick ported the original patch to 4.15 and reworked it use the
xfs_defer_bjoin helper and hold/join the buffer correctly across the
second transaction roll.

Signed-off-by: Alex Lyakas <alex@zadarastorage.com>
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/xfs_attr.c
libxfs/xfs_attr_leaf.c
libxfs/xfs_attr_leaf.h