All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: Alex Elsayed <eternaleye@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Kernel BUG on mounting BtrFS / after reboot
Date: Wed, 24 Feb 2010 20:40:06 -0500	[thread overview]
Message-ID: <20100225014006.GO25641@think> (raw)
In-Reply-To: <loom.20100223T092903-542@post.gmane.org>

On Tue, Feb 23, 2010 at 08:30:56AM +0000, Alex Elsayed wrote:
> Alex Elsayed <eternaleye <at> gmail.com> writes:
> 
> > 
> > Chris Mason <chris.mason <at> oracle.com> writes:
> > > I think the btrfsck output is missing.  It sounds like we'll survive if
> > > we just skip this part of the log replay.  I'll cook a patch based on
> > > the btrfsck output.
> > 
> > It was inline in my first message, immediately after the BUG trace.
> 
> Any update? Including btrfsck output here, in case it got lost:

Sorry for the delay.  With this patch, you'll have a consistent
filesystem but any fsyncs that were done before your last crash are not
going to be there after the mount.

The tree logging code should be made more tolerant of this problem, but
that is a larger change that will take longer to get right.  And you
want to mount this FS and get to your data.

With this patch, mount -o danger_del_log_tree /dev/xxx

Just let me know how things are working afterwards:

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);

      reply	other threads:[~2010-02-25  1:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-12 21:04 Kernel BUG on mounting BtrFS / after reboot Alex Elsayed
2010-02-12 22:50 ` Mike Fedyk
2010-02-12 22:59   ` Alex Elsayed
2010-02-17  6:47     ` Alex Elsayed
2010-02-17 14:18 ` Chris Mason
2010-02-18  0:35   ` Alex Elsayed
2010-02-18 15:02     ` Chris Mason
2010-02-18 17:38       ` Alex Elsayed
2010-02-18 20:48         ` Chris Mason
2010-02-18 20:54           ` Alex Elsayed
2010-02-23  8:30             ` Alex Elsayed
2010-02-25  1:40               ` Chris Mason [this message]

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=20100225014006.GO25641@think \
    --to=chris.mason@oracle.com \
    --cc=eternaleye@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.