From patchwork Fri Dec 4 00:55:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 7764371 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 325659F1C2 for ; Fri, 4 Dec 2015 00:56:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 734BC2056C for ; Fri, 4 Dec 2015 00:56:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3CCA8204D5 for ; Fri, 4 Dec 2015 00:56:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753020AbbLDA4T (ORCPT ); Thu, 3 Dec 2015 19:56:19 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:17559 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751170AbbLDA4T (ORCPT ); Thu, 3 Dec 2015 19:56:19 -0500 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id tB40uG2h024122 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 4 Dec 2015 00:56:17 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id tB40uGm4032734 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 4 Dec 2015 00:56:16 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.13.8/8.13.8) with ESMTP id tB40uGTC005586; Fri, 4 Dec 2015 00:56:16 GMT Received: from localhost.us.oracle.com (/10.211.47.52) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 03 Dec 2015 16:56:16 -0800 From: Liu Bo To: linux-btrfs@vger.kernel.org Cc: codebird@birds-are-nice.me Subject: [PATCH] Btrfs: disable online scrub repair on ro cases Date: Thu, 3 Dec 2015 16:55:58 -0800 Message-Id: <1449190558-11205-1-git-send-email-bo.li.liu@oracle.com> X-Mailer: git-send-email 2.5.0 X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Liu Bo --- fs/btrfs/scrub.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 2907a77..d6dd2f5 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -682,6 +682,9 @@ static int scrub_fixup_readpage(u64 inum, u64 offset, u64 root, void *fixup_ctx) struct btrfs_root *local_root; int srcu_index; + if (root->fs_info->sb->s_flags & MS_RDONLY) + return -EROFS; + key.objectid = root; key.type = BTRFS_ROOT_ITEM_KEY; key.offset = (u64)-1;