From: liubo <liubo2009@cn.fujitsu.com>
To: Linux Btrfs <linux-btrfs@vger.kernel.org>
Cc: Josef Bacik <josef@redhat.com>,
Tsutomu Itoh <t-itoh@jp.fujitsu.com>,
"Yan, Zheng" <zheng.yan@oracle.com>,
Wenyi Liu <qingshenlwy@gmail.com>,
Mike Fedyk <mfedyk@mikefedyk.com>
Subject: [RFC PATCH 5/5 v3] Btrfs: avoid log replay when btrfs is insane
Date: Fri, 03 Dec 2010 16:17:40 +0800 [thread overview]
Message-ID: <4CF8A7A4.9020405@cn.fujitsu.com> (raw)
btrfs may do log replay even as mounted readonly, since we have added
readonly check at start transaction time, in order to keep the original
attribute, it needs to set and to restore readonly flags around log
replay.
However, we do not permit log replay when btrfs is insane, and log replay
can start once btrfs is mounted in good state.
Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
---
fs/btrfs/disk-io.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 15d795a..727e156 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1937,9 +1937,14 @@ struct btrfs_root *open_ctree(struct super_block *sb,
btrfs_set_opt(fs_info->mount_opt, SSD);
}
- if (btrfs_super_log_root(disk_super) != 0) {
+ if (btrfs_super_log_root(disk_super) != 0 &&
+ !(fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR)) {
u64 bytenr = btrfs_super_log_root(disk_super);
+ unsigned int s_flags = sb->s_flags;
+ if (s_flags & MS_RDONLY)
+ sb->s_flags &= ~MS_RDONLY;
+
if (fs_devices->rw_devices == 0) {
printk(KERN_WARNING "Btrfs log replay required "
"on RO media\n");
@@ -1969,6 +1974,8 @@ struct btrfs_root *open_ctree(struct super_block *sb,
ret = btrfs_commit_super(tree_root);
BUG_ON(ret);
}
+
+ sb->s_flags = s_flags;
}
ret = btrfs_find_orphan_roots(tree_root);
--
1.7.1
reply other threads:[~2010-12-03 8:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4CF8A7A4.9020405@cn.fujitsu.com \
--to=liubo2009@cn.fujitsu.com \
--cc=josef@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=mfedyk@mikefedyk.com \
--cc=qingshenlwy@gmail.com \
--cc=t-itoh@jp.fujitsu.com \
--cc=zheng.yan@oracle.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 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.