Message ID | 20191206143718.167998-3-josef@toxicpanda.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Various fixes | expand |
On Fri, Dec 6, 2019 at 2:38 PM Josef Bacik <josef@toxicpanda.com> wrote: > > We can just abort the transaction here, and in fact do that for every > other failure in this function except these two cases. > > Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Looks good, thanks. > --- > fs/btrfs/ioctl.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c > index a1ee0b775e65..375befdecc19 100644 > --- a/fs/btrfs/ioctl.c > +++ b/fs/btrfs/ioctl.c > @@ -704,11 +704,17 @@ static noinline int create_subvol(struct inode *dir, > > btrfs_i_size_write(BTRFS_I(dir), dir->i_size + namelen * 2); > ret = btrfs_update_inode(trans, root, dir); > - BUG_ON(ret); > + if (ret) { > + btrfs_abort_transaction(trans, ret); > + goto fail; > + } > > ret = btrfs_add_root_ref(trans, objectid, root->root_key.objectid, > btrfs_ino(BTRFS_I(dir)), index, name, namelen); > - BUG_ON(ret); > + if (ret) { > + btrfs_abort_transaction(trans, ret); > + goto fail; > + } > > ret = btrfs_uuid_tree_add(trans, root_item->uuid, > BTRFS_UUID_KEY_SUBVOL, objectid); > -- > 2.23.0 >
Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index a1ee0b775e65..375befdecc19 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -704,11 +704,17 @@ static noinline int create_subvol(struct inode *dir, btrfs_i_size_write(BTRFS_I(dir), dir->i_size + namelen * 2); ret = btrfs_update_inode(trans, root, dir); - BUG_ON(ret); + if (ret) { + btrfs_abort_transaction(trans, ret); + goto fail; + } ret = btrfs_add_root_ref(trans, objectid, root->root_key.objectid, btrfs_ino(BTRFS_I(dir)), index, name, namelen); - BUG_ON(ret); + if (ret) { + btrfs_abort_transaction(trans, ret); + goto fail; + } ret = btrfs_uuid_tree_add(trans, root_item->uuid, BTRFS_UUID_KEY_SUBVOL, objectid);
We can just abort the transaction here, and in fact do that for every other failure in this function except these two cases. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/ioctl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)