* [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
* Re: [PATCH] btrfs: set device state reappearing missing device
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
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2018-05-29 15:48 UTC (permalink / raw)
To: Gu Jinxiang; +Cc: linux-btrfs, anand.jain
On Tue, May 29, 2018 at 02:50:09PM +0800, Gu Jinxiang wrote:
> From: Gu JinXiang <gujx@cn.fujitsu.com>
>
> patch for commit 921518924084
> ("btrfs: handle dynamically reappearing missing device").
The commit is not in any of the development branches and I only found
the patch in the mailinglist, so this is for something still in
development and I'll leave it to Anand.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: set device state reappearing missing device
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
1 sibling, 0 replies; 3+ messages in thread
From: Anand Jain @ 2018-05-30 6:16 UTC (permalink / raw)
To: Gu Jinxiang, linux-btrfs
On 05/29/2018 02:50 PM, Gu Jinxiang wrote:
> From: Gu JinXiang <gujx@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 <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) &&
>
^ permalink raw reply [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.