]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: abort in rename_exchange if we fail to insert the second ref
authorJosef Bacik <josef@toxicpanda.com>
Wed, 19 May 2021 18:04:21 +0000 (14:04 -0400)
committerDavid Sterba <dsterba@suse.com>
Thu, 27 May 2021 21:31:16 +0000 (23:31 +0200)
commit3bd636c261ab8092d651ce261eff69499dbcb359
treefc978138bceaf5b64800dc03c796e82cc3fa16a8
parent74d6b59d168d8ab4d1629a26bb22f8c630d65667
btrfs: abort in rename_exchange if we fail to insert the second ref

Error injection stress uncovered a problem where we'd leave a dangling
inode ref if we failed during a rename_exchange.  This happens because
we insert the inode ref for one side of the rename, and then for the
other side.  If this second inode ref insert fails we'll leave the first
one dangling and leave a corrupt file system behind.  Fix this by
aborting if we did the insert for the first inode ref.

CC: stable@vger.kernel.org # 4.9+
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c