]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: restore inode creation before xattr setting
authorSweet Tea Dorminy <sweettea-kernel@dorminy.me>
Fri, 8 Apr 2022 17:15:07 +0000 (13:15 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 16 May 2022 15:03:09 +0000 (17:03 +0200)
commit0a40a23373fd8c60521bb5b036fad383bd27141a
tree5f8eab1bd2efcd9669d3928824dd5f88284d3bce
parentd63ffc9af0aebdaf5ad5e651b2b30c0f9a0ddd5f
btrfs: restore inode creation before xattr setting

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@osandov.com>
Reported-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c