From patchwork Fri Aug 14 10:33:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 7014141 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 E57E49F39D for ; Fri, 14 Aug 2015 10:34:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F54020778 for ; Fri, 14 Aug 2015 10:34:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF66A2065E for ; Fri, 14 Aug 2015 10:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932286AbbHNKeF (ORCPT ); Fri, 14 Aug 2015 06:34:05 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:34290 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932309AbbHNKd6 (ORCPT ); Fri, 14 Aug 2015 06:33:58 -0400 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 t7EAXsDX027072 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 14 Aug 2015 10:33:55 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t7EAXsSB020738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 14 Aug 2015 10:33:54 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t7EAXs4U021959; Fri, 14 Aug 2015 10:33:54 GMT Received: from arch2.sg.oracle.com (/10.186.101.122) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 14 Aug 2015 03:33:53 -0700 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: clm@fb.com, dsterba@suse.cz Subject: [PATCH 23/23] Btrfs: allow -o rw,degraded for single group profile Date: Fri, 14 Aug 2015 18:33:08 +0800 Message-Id: <1439548388-29686-24-git-send-email-anand.jain@oracle.com> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1439548388-29686-1-git-send-email-anand.jain@oracle.com> References: <1439548388-29686-1-git-send-email-anand.jain@oracle.com> 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=-7.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 As of now only the exception to allow mount when number of missing device is more than group profile tolerance count is RDONLY this patch adds another lateral exception DEGRADED This will enable user to recover from the following and similar volume unavailability issue raid1 volume: mkfs.btrfs -draid1 -mraid1 /dev/sdc /dev/sdd unscan the device scan: modprobe -r btrfs && modprobe btrfs <= dev scanned is cleared since kernel does not know about /dev/sdd use degraded option to mount: mount -o degraded /dev/sdc /btrfs <= sdd is not used umount /btrfs problem: following umount the mount fails even with degraded option: mount -o degraded /dev/sdc /btrfs <== fails. because: unmount triggered commit used single profile which needs all the disks Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 3 ++- fs/btrfs/super.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 2f2379d..3377f1a 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2949,7 +2949,8 @@ retry_root_backup: btrfs_calc_num_tolerated_disk_barrier_failures(fs_info); if (fs_info->fs_devices->missing_devices > fs_info->num_tolerated_disk_barrier_failures && - !(sb->s_flags & MS_RDONLY)) { + !(sb->s_flags & MS_RDONLY || + btrfs_test_opt(fs_info->dev_root, DEGRADED))) { pr_warn("BTRFS: missing devices(%llu) exceeds the limit(%d), writeable mount is not allowed\n", fs_info->fs_devices->missing_devices, fs_info->num_tolerated_disk_barrier_failures); diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index a8a0109..315035a2 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1666,7 +1666,8 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) if (fs_info->fs_devices->missing_devices > fs_info->num_tolerated_disk_barrier_failures && - !(*flags & MS_RDONLY)) { + !(*flags & MS_RDONLY || + btrfs_test_opt(root, DEGRADED))) { btrfs_warn(fs_info, "too many missing devices, writeable remount is not allowed"); ret = -EACCES;