From patchwork Thu Aug 18 21:56:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Fasheh X-Patchwork-Id: 1078112 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7ILvC11019434 for ; Thu, 18 Aug 2011 21:58:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754432Ab1HRV5Q (ORCPT ); Thu, 18 Aug 2011 17:57:16 -0400 Received: from cantor2.suse.de ([195.135.220.15]:51139 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754122Ab1HRV5P (ORCPT ); Thu, 18 Aug 2011 17:57:15 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 1758289471; Thu, 18 Aug 2011 23:57:15 +0200 (CEST) From: Mark Fasheh To: linux-btrfs@vger.kernel.org Cc: chris.mason@oracle.com, Mark Fasheh Subject: [PATCH 1/8] btrfs: Don't BUG_ON errors from btrfs_create_subvol_root() Date: Thu, 18 Aug 2011 14:56:54 -0700 Message-Id: <1313704621-15219-2-git-send-email-mfasheh@suse.de> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1313704621-15219-1-git-send-email-mfasheh@suse.de> References: <1313704621-15219-1-git-send-email-mfasheh@suse.de> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 18 Aug 2011 21:58:08 +0000 (UTC) From: Mark Fasheh 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 --- 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 */