From: Filipe Manana <fdmanana@gmail.com>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>, kernel-team@fb.com
Subject: Re: [PATCH 2/5] btrfs: don't BUG_ON in create_subvol
Date: Fri, 6 Dec 2019 15:03:49 +0000 [thread overview]
Message-ID: <CAL3q7H7inXKi1=Epq2iH_TYVFzVX3=kWg526beXzb_0-S0hAMw@mail.gmail.com> (raw)
In-Reply-To: <20191206143718.167998-3-josef@toxicpanda.com>
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
>
--
Filipe David Manana,
“Whether you think you can, or you think you can't — you're right.”
next prev parent reply other threads:[~2019-12-06 15:04 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-06 14:37 [PATCH 0/5] Various fixes Josef Bacik
2019-12-06 14:37 ` [PATCH 1/5] btrfs: drop log root for dropped roots Josef Bacik
2019-12-06 15:02 ` Filipe Manana
2019-12-06 15:03 ` Nikolay Borisov
2019-12-09 17:39 ` David Sterba
2019-12-10 20:05 ` Josef Bacik
2019-12-10 21:19 ` Nikolay Borisov
2019-12-10 21:28 ` Josef Bacik
2019-12-13 15:17 ` David Sterba
2019-12-06 14:37 ` [PATCH 2/5] btrfs: don't BUG_ON in create_subvol Josef Bacik
2019-12-06 15:03 ` Filipe Manana [this message]
2019-12-09 10:49 ` Johannes Thumshirn
2019-12-06 14:37 ` [PATCH 3/5] btrfs: handle ENOENT in btrfs_uuid_tree_iterate Josef Bacik
2019-12-06 15:13 ` Filipe Manana
2019-12-06 15:17 ` Josef Bacik
2019-12-06 16:39 ` [PATCH 3/5][v2] " Josef Bacik
2019-12-06 16:46 ` Filipe Manana
2019-12-09 10:52 ` Johannes Thumshirn
2019-12-06 14:37 ` [PATCH 4/5] btrfs: skip log replay on orphaned roots Josef Bacik
2019-12-06 15:23 ` Filipe Manana
2019-12-06 14:37 ` [PATCH 5/5] btrfs: do not leak reloc root if we fail to read the fs root Josef Bacik
2019-12-06 15:24 ` Filipe Manana
2019-12-09 10:58 ` Johannes Thumshirn
2019-12-09 18:16 ` [PATCH 0/5] Various fixes David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAL3q7H7inXKi1=Epq2iH_TYVFzVX3=kWg526beXzb_0-S0hAMw@mail.gmail.com' \
--to=fdmanana@gmail.com \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).