From patchwork Thu Feb 25 01:40:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Mason X-Patchwork-Id: 81864 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1P1gAVv024746 for ; Thu, 25 Feb 2010 01:42:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758747Ab0BYBmI (ORCPT ); Wed, 24 Feb 2010 20:42:08 -0500 Received: from acsinet11.oracle.com ([141.146.126.233]:32630 "EHLO acsinet11.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758711Ab0BYBmG (ORCPT ); Wed, 24 Feb 2010 20:42:06 -0500 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by acsinet11.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o1P1g0K1032120 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 25 Feb 2010 01:42:02 GMT Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o1P1fvc9000546; Thu, 25 Feb 2010 01:41:59 GMT Received: from abhmt016.oracle.com by acsmt354.oracle.com with ESMTP id 48815581267062009; Wed, 24 Feb 2010 17:40:09 -0800 Received: from localhost (/66.66.148.185) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 24 Feb 2010 17:40:08 -0800 Date: Wed, 24 Feb 2010 20:40:06 -0500 From: Chris Mason To: Alex Elsayed Cc: linux-btrfs@vger.kernel.org Subject: Re: Kernel BUG on mounting BtrFS / after reboot Message-ID: <20100225014006.GO25641@think> Mail-Followup-To: Chris Mason , Alex Elsayed , linux-btrfs@vger.kernel.org References: <20100217141813.GH29430@think> <20100218150238.GL10559@think> <20100218204843.GW10559@think> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Source-IP: acsmt354.oracle.com [141.146.40.154] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090201.4B85D568.0013:SCFMA4539814,ss=1,fgs=0 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.3 (demeter.kernel.org [140.211.167.41]); Thu, 25 Feb 2010 01:42:10 +0000 (UTC) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 2aa8ec6..1a532a5 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1162,6 +1162,7 @@ struct btrfs_root { #define BTRFS_MOUNT_NOSSD (1 << 9) #define BTRFS_MOUNT_DISCARD (1 << 10) #define BTRFS_MOUNT_FORCE_COMPRESS (1 << 11) +#define BTRFS_MOUNT_DELLOGTREE (1 << 12) #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 2b59201..aa2aa59 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1955,6 +1955,13 @@ struct btrfs_root *open_ctree(struct super_block *sb, err = -EIO; goto fail_trans_kthread; } + + if (btrfs_test_opt(tree_root, DELLOGTREE)) { + printk(KERN_WARNING "Btrfs deleting log tree"); + btrfs_set_super_log_root(disk_super, 0); + goto postrecover; + } + blocksize = btrfs_level_size(tree_root, btrfs_super_log_root_level(disk_super)); @@ -1968,15 +1975,16 @@ struct btrfs_root *open_ctree(struct super_block *sb, log_tree_root->node = read_tree_block(tree_root, bytenr, blocksize, generation + 1); + ret = btrfs_recover_log_trees(log_tree_root); BUG_ON(ret); +postrecover: if (sb->s_flags & MS_RDONLY) { ret = btrfs_commit_super(tree_root); BUG_ON(ret); } } - ret = btrfs_find_orphan_roots(tree_root); BUG_ON(ret); diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 8a1ea6e..6132721 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -67,7 +67,7 @@ enum { Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress, Opt_compress_force, Opt_notreelog, Opt_ratio, - Opt_flushoncommit, + Opt_flushoncommit, Opt_danger_del_log_tree, Opt_discard, Opt_err, }; @@ -92,6 +92,7 @@ static match_table_t tokens = { {Opt_flushoncommit, "flushoncommit"}, {Opt_ratio, "metadata_ratio=%d"}, {Opt_discard, "discard"}, + {Opt_danger_del_log_tree, "danger_del_log_tree"}, {Opt_err, NULL}, }; @@ -270,6 +271,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) case Opt_discard: btrfs_set_opt(info->mount_opt, DISCARD); break; + case Opt_danger_del_log_tree: + btrfs_set_opt(info->mount_opt, DELLOGTREE); + break; case Opt_err: printk(KERN_INFO "btrfs: unrecognized mount option " "'%s'\n", p);