]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: record all roots for rename exchange on a subvol
authorJosef Bacik <josef@toxicpanda.com>
Fri, 15 Nov 2019 20:43:06 +0000 (15:43 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 18 Nov 2019 19:08:31 +0000 (20:08 +0100)
commit0e10ed1210a57b78b45a6971a0186be40889c83c
treef14290e9dd2aef70f973b355c5d104213e517f2b
parent57929c4efbfef66ce65d43ba87cbc1f2a3fe1266
btrfs: record all roots for rename exchange on a subvol

Testing with the new fsstress support for subvolumes uncovered a pretty
bad problem with rename exchange on subvolumes.  We're modifying two
different subvolumes, but we only start the transaction on one of them,
so the other one is not added to the dirty root list.  This is caught by
btrfs_cow_block() with a warning because the root has not been updated,
however if we do not modify this root again we'll end up pointing at an
invalid root because the root item is never updated.

Fix this by making sure we add the destination root to the trans list,
the same as we do with normal renames.  This fixes the corruption.

Fixes: ef5f03fe1064 ("btrfs: add support for RENAME_EXCHANGE and RENAME_WHITEOUT")
CC: stable@vger.kernel.org # 4.9+
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c