On 05/29/2018 02:50 PM, Gu Jinxiang wrote:
From: Gu JinXiang <g...@cn.fujitsu.com>

patch for commit 921518924084
("btrfs: handle dynamically reappearing missing device").
---
v4:
::
. No need to set in_fs_metadata flag as its already set on missing device
---

> Since BTRFS_DEV_STATE_IN_FS_METADATA will be clear in
> btrfs_open_one_device,

 Though v4 change log comment is right. But missed the point that
 btrfs_open_one_device() clears it. My bad. Thanks for the catch.

-Anand

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 <g...@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) &&

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to