From: Liu Bo <bo.li.liu@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: codebird@birds-are-nice.me
Subject: [PATCH V2] Btrfs: disable online scrub repair on ro cases
Date: Fri, 4 Dec 2015 09:58:04 -0800 [thread overview]
Message-ID: <1449251884-24135-1-git-send-email-bo.li.liu@oracle.com> (raw)
In-Reply-To: <1449190558-11205-1-git-send-email-bo.li.liu@oracle.com>
This disables repair process on ro cases as it can cause system
to be unresponsive on the ASSERT() in repair_io_failure().
This can happen when scrub is running and a hardware error pops up,
we should fallback to ro mounts gracefully instead of being unresponsive.
Reported-by: Codebird <codebird@birds-are-nice.me>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
v2: Get @fs_info from a real pointer instead of a confusing-name u64 root.
fs/btrfs/scrub.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 2907a77..cb8a4e0 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -682,11 +682,14 @@ static int scrub_fixup_readpage(u64 inum, u64 offset, u64 root, void *fixup_ctx)
struct btrfs_root *local_root;
int srcu_index;
+ fs_info = fixup->root->fs_info;
+ if (fs_info->sb->s_flags & MS_RDONLY)
+ return -EROFS;
+
key.objectid = root;
key.type = BTRFS_ROOT_ITEM_KEY;
key.offset = (u64)-1;
- fs_info = fixup->root->fs_info;
srcu_index = srcu_read_lock(&fs_info->subvol_srcu);
local_root = btrfs_read_fs_root_no_name(fs_info, &key);
--
2.5.0
next prev parent reply other threads:[~2015-12-04 17:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 0:55 [PATCH] Btrfs: disable online scrub repair on ro cases Liu Bo
2015-12-04 13:22 ` kbuild test robot
2015-12-04 13:35 ` kbuild test robot
2015-12-04 17:58 ` Liu Bo [this message]
2015-12-07 14:37 ` [PATCH V2] " David Sterba
2015-12-07 18:26 ` Liu Bo
2016-01-05 13:54 ` David Sterba
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=1449251884-24135-1-git-send-email-bo.li.liu@oracle.com \
--to=bo.li.liu@oracle.com \
--cc=codebird@birds-are-nice.me \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).