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>
This commit is contained in:
@@ -735,10 +735,13 @@ xfs_attr_shortform_getvalue(xfs_da_args_t *args)
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert from using the shortform to the leaf.
|
||||
* Convert from using the shortform to the leaf. On success, return the
|
||||
* buffer so that we can keep it locked until we're totally done with it.
|
||||
*/
|
||||
int
|
||||
xfs_attr_shortform_to_leaf(xfs_da_args_t *args)
|
||||
xfs_attr_shortform_to_leaf(
|
||||
struct xfs_da_args *args,
|
||||
struct xfs_buf **leaf_bp)
|
||||
{
|
||||
xfs_inode_t *dp;
|
||||
xfs_attr_shortform_t *sf;
|
||||
@@ -818,7 +821,7 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args)
|
||||
sfe = XFS_ATTR_SF_NEXTENTRY(sfe);
|
||||
}
|
||||
error = 0;
|
||||
|
||||
*leaf_bp = bp;
|
||||
out:
|
||||
kmem_free(tmpbuffer);
|
||||
return error;
|
||||
|
Reference in New Issue
Block a user