linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Fasheh <mfasheh@suse.de>
To: linux-btrfs@vger.kernel.org
Cc: chris.mason@oracle.com, Mark Fasheh <mfasheh@suse.com>
Subject: [PATCH 1/8] btrfs: Don't BUG_ON errors from btrfs_create_subvol_root()
Date: Thu, 18 Aug 2011 14:56:54 -0700	[thread overview]
Message-ID: <1313704621-15219-2-git-send-email-mfasheh@suse.de> (raw)
In-Reply-To: <1313704621-15219-1-git-send-email-mfasheh@suse.de>

From: Mark Fasheh <mfasheh@suse.com>

This is called from only one place - create_subvol() which passes errors
safely back out to it's caller, btrfs_mksubvol where they are handled.

Additionally, btrfs_create_subvol_root() itself bug's needlessly from error
return of btrfs_update_inode(). Since create_subvol() was fixed to catch
errors we can bubble this one up too.

Signed-off-by: Mark Fasheh <mfasheh@suse.com>
---
 fs/btrfs/inode.c |    3 +--
 fs/btrfs/ioctl.c |    2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 15fceef..7028c0c 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6722,10 +6722,9 @@ int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
 	btrfs_i_size_write(inode, 0);
 
 	err = btrfs_update_inode(trans, new_root, inode);
-	BUG_ON(err);
 
 	iput(inode);
-	return 0;
+	return err;
 }
 
 struct inode *btrfs_alloc_inode(struct super_block *sb)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 7cf0133..b3440f5 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -411,6 +411,8 @@ static noinline int create_subvol(struct btrfs_root *root,
 	btrfs_record_root_in_trans(trans, new_root);
 
 	ret = btrfs_create_subvol_root(trans, new_root, new_dirid);
+	if (ret)
+		goto fail;
 	/*
 	 * insert the directory item
 	 */
-- 
1.7.6


  reply	other threads:[~2011-08-18 21:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-18 21:56 [PATCH 0/8] btrfs: Error handling fixes Mark Fasheh
2011-08-18 21:56 ` Mark Fasheh [this message]
2011-08-18 21:56 ` [PATCH 2/8] btrfs: Don't BUG_ON() errors in update_ref_for_cow() Mark Fasheh
2011-08-18 21:56 ` [PATCH 3/8] btrfs: Don't BUG_ON kzalloc error in btrfs_lookup_csums_range() Mark Fasheh
2011-08-18 21:56 ` [PATCH 4/8] btrfs: make insert_ptr() void Mark Fasheh
2011-08-18 21:56 ` [PATCH 5/8] btrfs: Don't BUG_ON errors in __finish_chunk_alloc() Mark Fasheh
2011-08-18 21:56 ` [PATCH 6/8] btrfs: fix error check of btrfs_lookup_dentry() Mark Fasheh
2011-08-18 21:57 ` [PATCH 7/8] btrfs: make fixup_low_keys() void Mark Fasheh
2011-08-18 21:57 ` [PATCH 8/8] btrfs: make del_ptr() and btrfs_del_leaf() void Mark Fasheh

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=1313704621-15219-2-git-send-email-mfasheh@suse.de \
    --to=mfasheh@suse.de \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=mfasheh@suse.com \
    /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).