All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
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	[thread overview]
Message-ID: <20171127140014.25873-1-anand.jain@oracle.com> (raw)
In-Reply-To: <CAKuJGC_CrmmT8=U3KNcw4i_6sSDtwhCCs8iui4Ov+ECzsfAB6A@mail.gmail.com>

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 <anand.jain@oracle.com>
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 ||
-- 
2.15.0


  parent reply	other threads:[~2017-11-27 14:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 15:45 [PATCH 0/4] factor __btrfs_open_devices() Anand Jain
2017-11-09 15:45 ` [PATCH 1/4] btrfs: set fs_devices->seed directly Anand Jain
2017-11-09 15:45 ` [PATCH 2/4] btrfs: let variable required be declared inside the loop Anand Jain
2017-11-09 15:53   ` Nikolay Borisov
2017-11-15 17:01     ` David Sterba
2017-11-09 15:45 ` [PATCH 3/4] btrfs: move check for device generation to the last Anand Jain
2017-11-09 15:45 ` [PATCH 4/4] btrfs: factor __btrfs_open_devices() to create btrfs_open_one_device() Anand Jain
2017-11-27  6:47   ` Lakshmipathi.G
2017-11-27 11:47     ` Anand Jain
2017-11-29 16:02       ` Lakshmipathi.G
2017-11-27 14:00     ` Anand Jain [this message]
2017-11-15 17:03 ` [PATCH 0/4] factor __btrfs_open_devices() David Sterba
2017-11-16  4:08   ` Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171127140014.25873-1-anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=lakshmipathi.g@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.