From patchwork Mon Nov 27 14:00:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 10076951 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6DFEF60353 for ; Mon, 27 Nov 2017 14:00:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6104828C7C for ; Mon, 27 Nov 2017 14:00:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54B9F28E44; Mon, 27 Nov 2017 14:00:07 +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=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 BC97428C7C for ; Mon, 27 Nov 2017 14:00:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752223AbdK0OAD (ORCPT ); Mon, 27 Nov 2017 09:00:03 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:40827 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751754AbdK0OAD (ORCPT ); Mon, 27 Nov 2017 09:00:03 -0500 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vARDxwlk009502 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Nov 2017 13:59:59 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id vARDxw82030153 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Nov 2017 13:59:58 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id vARDxv6c012024; Mon, 27 Nov 2017 13:59:58 GMT Received: from localhost.localdomain (/42.60.24.64) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Nov 2017 05:59:57 -0800 From: Anand Jain To: linux-btrfs@vger.kernel.org, dsterba@suse.cz Cc: lakshmipathi.g@gmail.com Subject: [PATCH] btrfs: ignore return from btrfs_open_one_device() Date: Mon, 27 Nov 2017 22:00:14 +0800 Message-Id: <20171127140014.25873-1-anand.jain@oracle.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: References: 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-Virus-Scanned: ClamAV using ClamSMTP Test case btrfs-progs test-misc/012 can recreate the same fsid with different number of struct btrfs_fs_devices::total_devices. And the previous device which is in the kernel device list is stale now. But as we don't clean the kernel device list (unless same device is scanned with different fsid), so in the mount context it really ended up reading the device to find zeroed SB. And thus return the fail to mount. The long term fix for this should be to refresh the kernel device list. Though the patch btrfs: factor __btrfs_open_devices() to create btrfs_open_one_device() did tried to skip the failed open, but it forgot to reset the ret value or not to assign, thus error went up the stack in the mount context. Signed-off-by: Anand Jain Fixes: btrfs: factor __btrfs_open_devices() to create btrfs_open_one_device() --- Hi David, My bad. The above patch introduced a regression. Can you kindly squash this patch to it. Thanks, Anand fs/btrfs/volumes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 5bd73edc2602..a3fa2dc39881 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1047,8 +1047,7 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices, list_for_each_entry(device, head, dev_list) { /* Just open everything we can; ignore failures here */ - ret = btrfs_open_one_device(fs_devices, device, flags, holder); - if (ret) + if (btrfs_open_one_device(fs_devices, device, flags, holder)) continue; if (!latest_dev ||