All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: set device state reappearing missing device
@ 2018-05-29  6:50 Gu Jinxiang
  2018-05-29 15:48 ` David Sterba
  2018-05-30  6:16 ` Anand Jain
  0 siblings, 2 replies; 3+ messages in thread
From: Gu Jinxiang @ 2018-05-29  6:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: anand.jain, Gu JinXiang

From: Gu JinXiang <gujx@cn.fujitsu.com>

patch for commit 921518924084
("btrfs: handle dynamically reappearing missing device").

Since BTRFS_DEV_STATE_IN_FS_METADATA will be clear in
btrfs_open_one_device, and when alloc a new chunk in
__btrfs_alloc_chunk, device with BTRFS_DEV_STATE_IN_FS_METADATA
not be set will be skipped, so it can not alloc chunk correctly.

And from the source logic, BTRFS_DEV_STATE_IN_FS_METADATA should
be also set when reapearing a missing device.

And with this patch, xfstests-dev/tests/btrfs/154 should run
successfully.

Signed-off-by: Gu JinXiang <gujx@cn.fujitsu.com>
---
 fs/btrfs/volumes.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 8699080ef505..bf8a41b2847e 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -849,6 +849,8 @@ static noinline struct btrfs_device *device_list_add(const char *path,
 
 			fs_devices->missing_devices--;
 			clear_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state);
+			set_bit(BTRFS_DEV_STATE_IN_FS_METADATA,
+					&device->dev_state);
 
 			if (test_bit(BTRFS_DEV_STATE_WRITEABLE,
 				     &device->dev_state) &&
-- 
2.17.0




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

end of thread, other threads:[~2018-05-30  6:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-29  6:50 [PATCH] btrfs: set device state reappearing missing device Gu Jinxiang
2018-05-29 15:48 ` David Sterba
2018-05-30  6:16 ` Anand Jain

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.