linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] btrfs: ignore return from btrfs_open_one_device()
@ 2017-11-30 23:02 Anand Jain
  2017-12-04 13:33 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Anand Jain @ 2017-11-30 23:02 UTC (permalink / raw)
  To: linux-btrfs, dsterba; +Cc: lakshmipathi.g

Test case like 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, and in the mount context, it really
ends up reading the device to find its zeroed SB. And thus return the fail
to mount.

The long term fix for this should be to create a new kernel device list,
for the mount context.

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.
Thus returning the error 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 b408a3f7229e..7da65625677f 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1035,8 +1035,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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-04 13:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-30 23:02 [PATCH RESEND] btrfs: ignore return from btrfs_open_one_device() Anand Jain
2017-12-04 13:33 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).