From patchwork Fri Sep 25 08:24:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 7262951 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D6A6DBEEC1 for ; Fri, 25 Sep 2015 08:32:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 17C0A20B6A for ; Fri, 25 Sep 2015 08:32:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 32FAE20B66 for ; Fri, 25 Sep 2015 08:32:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755391AbbIYIc1 (ORCPT ); Fri, 25 Sep 2015 04:32:27 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:45618 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754894AbbIYIcZ (ORCPT ); Fri, 25 Sep 2015 04:32:25 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t8P8QRcK022993 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 25 Sep 2015 08:26:27 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t8P8QRel029018 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 25 Sep 2015 08:26:27 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t8P8QQ70017234; Fri, 25 Sep 2015 08:26:26 GMT Received: from arch2.sg.oracle.com (/10.186.101.93) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 25 Sep 2015 01:26:26 -0700 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: quwenruo@cn.fujitsu.com Subject: [PATCH 1/1] btrfs: Do per-chunk degraded check for remount Date: Fri, 25 Sep 2015 16:24:48 +0800 Message-Id: <1443169488-18217-1-git-send-email-anand.jain@oracle.com> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1442801443-5132-4-git-send-email-quwenruo@cn.fujitsu.com> References: <1442801443-5132-4-git-send-email-quwenruo@cn.fujitsu.com> X-Source-IP: aserv0021.oracle.com [141.146.126.233] 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, 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 From: Qu Wenruo Just the same for mount time check, use new btrfs_check_degraded() to do per chunk check. Signed-off-by: Qu Wenruo Btrfs: use btrfs_error instead of btrfs_err during remount apply on top of the patch [PATCH 1/1] Btrfs: consolidate btrfs_error() to btrfs_std_error() Signed-off-by: Anand Jain --- fs/btrfs/super.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 181db38..16f1412 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1664,11 +1664,14 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) goto restore; } - if (fs_info->fs_devices->missing_devices > - fs_info->num_tolerated_disk_barrier_failures && - !(*flags & MS_RDONLY)) { + ret = btrfs_check_degradable(fs_info, *flags); + if (ret < 0) { + btrfs_err(fs_info, + "degraded writable remount failed %d", ret); + goto restore; + } else if (ret > 0 && !btrfs_test_opt(root, DEGRADED)) { btrfs_warn(fs_info, - "too many missing devices, writeable remount is not allowed"); + "some device missing, but still degraded mountable, please remount with -o degraded option"); ret = -EACCES; goto restore; }