Re: [PATCH] btrfs: restore inode creation before xattr setting

From: David Sterba
Date: Fri Apr 08 2022 - 14:41:50 EST


On Fri, Apr 08, 2022 at 01:15:07PM -0400, Sweet Tea Dorminy wrote:
> According to the tree checker, "all xattrs with a given objectid follow
> the inode with that objectid in the tree" is an invariant. This was
> broken by the recent change "btrfs: move common inode creation code into
> btrfs_create_new_inode()", which moved acl creation and property
> inheritance (stored in xattrs) to before inode insertion into the tree.
> As a result, under certain timings, the xattrs could be written to the
> tree before the inode, causing the tree checker to report violation of
> the invariant.
>
> Move property inheritance and acl creation back to their old ordering
> after the inode insertion.
>
> Suggested-by: Omar Sandoval <osandov@xxxxxxxxxxx>
> Reported-by: Naohiro Aota <naohiro.aota@xxxxxxx>
> Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@xxxxxxxxxx>
> ---
> This should apply on top of osandov's patch at
> https://lore.kernel.org/linux-btrfs/da6cfa1b8e42db5c8954680cac1ca322d463b880.1647306546.git.osandov@xxxxxx/
>
> It's survived a good dose of fstests, and several iterations of specific
> tests that were failing, e.g. generic/650.

Thanks.

> David: I don't know if you'd rather roll this into osandov's original
> patch, or whether you'd like me or osandov to resend the patch linked
> above with this addition rolled into it, or whether you'd like to apply
> it separately.

For simple fixups sent as replies I can apply it manually but sometimes
it's better for me to do the review instead of trying to figure out what
was the real intention.

So patch applied cleanly and now pushed to misc-next, thanks.