From patchwork Mon Jan 21 07:35:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10772687 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0B0A6C2 for ; Mon, 21 Jan 2019 07:35:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5C8220415 for ; Mon, 21 Jan 2019 07:35:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A38BD29B8F; Mon, 21 Jan 2019 07:35:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4099C20415 for ; Mon, 21 Jan 2019 07:35:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728069AbfAUHfU (ORCPT ); Mon, 21 Jan 2019 02:35:20 -0500 Received: from mx2.suse.de ([195.135.220.15]:58258 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728470AbfAUHfT (ORCPT ); Mon, 21 Jan 2019 02:35:19 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 404CFACD2 for ; Mon, 21 Jan 2019 07:35:18 +0000 (UTC) From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 0/3] btrfs: Introduce new rescue= mount options Date: Mon, 21 Jan 2019 15:35:09 +0800 Message-Id: <20190121073512.17675-1-wqu@suse.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patchset can be fetched from github: https://github.com/adam900710/linux/tree/rescue_options There are quite some btrfs extent tree corruption report in the mail list. Since btrfs will do mount time block group item search, one corrupted leaf containing block group item will prevent the whole fs to be mounted. This patchset will try to address the problem by introducing a new mount option, "rescue=skip_bg", as a last-resort rescue. Of course this option will have a lot of restriction to prevent further screwing up the fs, including: - Permanent RO No remount rw is allowed - No dirty log Either clean the log or use rescue=no_log_replay mount option This "rescue=skip_bg" has some advantage compared to user space tool like "btrfs-restore": - Unified recovery tool User can use any tool they're familiar with, as long as the kernel doesn't panic. - More info for subvolume. "btrfs subv list" can word now! Although, move the following mount options to "rescue=" mount option: - nologreplay to rescue=no_log_replay - usebackuproot to rescue=use_backup_root Old options are still available for compatibility purpose, but they are deprecated in favor of new 'rescue=' super option. Also different rescue sub options can be separated by ':', like: "rescue=no_log_replay:skip_bg:use_backup_root". The separation character is chosen by: - No conflicts with existing character Especially no conflict with ','. - No extra escaping/quota Original plan is ';', but since it'll be interpreted by bash, it's changed to current ':'. Changelog: v2: - Introduce 'rescue=' super option. - Rename original 'usebackuproot' and 'nologreplay'. It at least makes my vim spell check happier. - Remove 'recovery' mount option. As its successor is now deprecated, not need to keep the predecessor. Qu Wenruo (3): btrfs: Remove "recovery" mount option btrfs: Introduce "rescue=" mount option btrfs: Introduce new mount option to skip block group items scan fs/btrfs/ctree.h | 1 + fs/btrfs/disk-io.c | 29 +++++++++++-- fs/btrfs/extent-tree.c | 59 ++++++++++++++++++++++++++ fs/btrfs/super.c | 96 ++++++++++++++++++++++++++++++++++++------ fs/btrfs/volumes.c | 7 +++ 5 files changed, 176 insertions(+), 16 deletions(-)