]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
xfs: hold xfs_buf locked between shortform->leaf conversion and the addition of an...
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 8 Dec 2017 03:07:02 +0000 (19:07 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 14 Dec 2017 17:18:12 +0000 (09:18 -0800)
commit6e643cd094de3bd0f97edcc1db0089afa24d909f
tree71fe894353be837b7c756d1d3348a966da71f5e3
parentb7b2846fe26f2c0d7f317c874a13d3ecf22670ff
xfs: hold xfs_buf locked between shortform->leaf conversion and the addition of an attribute

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>
fs/xfs/libxfs/xfs_attr.c
fs/xfs/libxfs/xfs_attr_leaf.c
fs/xfs/libxfs/xfs_attr_leaf.h