diff options
author | Josef Bacik <josef@toxicpanda.com> | 2021-03-12 15:25:06 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2021-04-19 17:25:20 +0200 |
commit | 221581e485751811db3b43148177be2a0bdb2f3c (patch) | |
tree | 5a04c9bbc5baf9d1442973a61835c188eeeb5cf9 /fs/btrfs/ioctl.c | |
parent | 2002ae112a7415403896c66971532c2bb8d09ab7 (diff) | |
download | lwn-221581e485751811db3b43148177be2a0bdb2f3c.tar.gz lwn-221581e485751811db3b43148177be2a0bdb2f3c.zip |
btrfs: handle btrfs_record_root_in_trans failure in create_subvol
btrfs_record_root_in_trans will return errors in the future, so handle
the error properly in create_subvol.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 3415a9f06c81..37c92a9fa2e3 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -721,7 +721,12 @@ static noinline int create_subvol(struct inode *dir, /* Freeing will be done in btrfs_put_root() of new_root */ anon_dev = 0; - btrfs_record_root_in_trans(trans, new_root); + ret = btrfs_record_root_in_trans(trans, new_root); + if (ret) { + btrfs_put_root(new_root); + btrfs_abort_transaction(trans, ret); + goto fail; + } ret = btrfs_create_subvol_root(trans, new_root, root); btrfs_put_root(new_root); |