From patchwork Fri Aug 5 16:59:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Fasheh X-Patchwork-Id: 1038992 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p75GxP1J009478 for ; Fri, 5 Aug 2011 16:59:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754377Ab1HEQ7S (ORCPT ); Fri, 5 Aug 2011 12:59:18 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45138 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754320Ab1HEQ7Q (ORCPT ); Fri, 5 Aug 2011 12:59:16 -0400 Received: from relay2.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 166D28F0A5 for ; Fri, 5 Aug 2011 18:59:16 +0200 (CEST) Date: Fri, 5 Aug 2011 09:59:15 -0700 From: Mark Fasheh To: linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs: Don't BUG_ON errors from btrfs_create_subvol_root() Message-ID: <20110805165915.GC8482@wotan.suse.de> Reply-To: Mark Fasheh Mime-Version: 1.0 Content-Disposition: inline Organization: SUSE Labs User-Agent: Mutt/1.5.9i 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 (demeter2.kernel.org [140.211.167.43]); Fri, 05 Aug 2011 16:59:25 +0000 (UTC) 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 */