* [PATCH] btrfs: fix inconsistency during missing device rejoin
@ 2017-12-04 7:19 Anand Jain
2017-12-05 2:18 ` Misono, Tomohiro
0 siblings, 1 reply; 5+ messages in thread
From: Anand Jain @ 2017-12-04 7:19 UTC (permalink / raw)
To: linux-btrfs
When device is missing its not necessary that btrfs_device::name is null
or the path is different when it reappears. Its possible that device can
go missing after its been scanned where neither of
btrfs_device::name == NULL OR btrfs_device::name != reappear_dev_path,
is true. So just check for btrfs_device::dev_state.missing. Thanks.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
fs/btrfs/volumes.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 59a8785a2e9e..ac0c4eb5107f 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -715,7 +715,8 @@ static noinline int device_list_add(const char *path,
ret = 1;
device->fs_devices = fs_devices;
- } else if (!device->name || strcmp(device->name->str, path)) {
+ } else if (!device->name || strcmp(device->name->str, path) ||
+ test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) {
/*
* When FS is already mounted.
* 1. If you are here and if the device->name is NULL that
--
2.15.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: fix inconsistency during missing device rejoin
2017-12-04 7:19 [PATCH] btrfs: fix inconsistency during missing device rejoin Anand Jain
@ 2017-12-05 2:18 ` Misono, Tomohiro
2017-12-05 2:53 ` Anand Jain
0 siblings, 1 reply; 5+ messages in thread
From: Misono, Tomohiro @ 2017-12-05 2:18 UTC (permalink / raw)
To: Anand Jain, linux-btrfs
On 2017/12/04 16:19, Anand Jain wrote:
> When device is missing its not necessary that btrfs_device::name is null
> or the path is different when it reappears. Its possible that device can
> go missing after its been scanned where neither of
> btrfs_device::name == NULL OR btrfs_device::name != reappear_dev_path,
> is true. So just check for btrfs_device::dev_state.missing. Thanks.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> fs/btrfs/volumes.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 59a8785a2e9e..ac0c4eb5107f 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -715,7 +715,8 @@ static noinline int device_list_add(const char *path,
>
> ret = 1;
> device->fs_devices = fs_devices;
> - } else if (!device->name || strcmp(device->name->str, path)) {
> + } else if (!device->name || strcmp(device->name->str, path) ||
> + test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) {
> /*
> * When FS is already mounted.
> * 1. If you are here and if the device->name is NULL that
>
I read the comments below this and wonder if BTRFS_DEV_STATE_MISSING is set
when device->name is null and therefore the first condition can be removed.
Thanks,
Tomohiro
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: fix inconsistency during missing device rejoin
2017-12-05 2:18 ` Misono, Tomohiro
@ 2017-12-05 2:53 ` Anand Jain
2017-12-15 8:03 ` Anand Jain
0 siblings, 1 reply; 5+ messages in thread
From: Anand Jain @ 2017-12-05 2:53 UTC (permalink / raw)
To: Misono, Tomohiro, linux-btrfs
On 12/05/2017 10:18 AM, Misono, Tomohiro wrote:
>
>
> On 2017/12/04 16:19, Anand Jain wrote:
>> When device is missing its not necessary that btrfs_device::name is null
>> or the path is different when it reappears. Its possible that device can
>> go missing after its been scanned where neither of
>> btrfs_device::name == NULL OR btrfs_device::name != reappear_dev_path,
>> is true. So just check for btrfs_device::dev_state.missing. Thanks.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>> fs/btrfs/volumes.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index 59a8785a2e9e..ac0c4eb5107f 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -715,7 +715,8 @@ static noinline int device_list_add(const char *path,
>>
>> ret = 1;
>> device->fs_devices = fs_devices;
>> - } else if (!device->name || strcmp(device->name->str, path)) {
>> + } else if (!device->name || strcmp(device->name->str, path) ||
>> + test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) {
>> /*
>> * When FS is already mounted.
>> * 1. If you are here and if the device->name is NULL that
>>
>
> I read the comments below this and wonder if BTRFS_DEV_STATE_MISSING is set
> when device->name is null and therefore the first condition can be removed.
device->name is null only when missing is set.
Will do this optimize in a new patch, as its about clean up and
is not about fixing inconsistency as in here.
Thanks, Anand
> Thanks,
> Tomohiro
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: fix inconsistency during missing device rejoin
2017-12-05 2:53 ` Anand Jain
@ 2017-12-15 8:03 ` Anand Jain
0 siblings, 0 replies; 5+ messages in thread
From: Anand Jain @ 2017-12-15 8:03 UTC (permalink / raw)
To: Misono, Tomohiro, linux-btrfs
>>> @@ -715,7 +715,8 @@ static noinline int device_list_add(const char
>>> *path,
>>> ret = 1;
>>> device->fs_devices = fs_devices;
>>> - } else if (!device->name || strcmp(device->name->str, path)) {
>>> + } else if (!device->name || strcmp(device->name->str, path) ||
>>> + test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) {
>>> /*
>>> * When FS is already mounted.
>>> * 1. If you are here and if the device->name is NULL that
>>>
>>
>> I read the comments below this and wonder if BTRFS_DEV_STATE_MISSING
>> is set
>> when device->name is null and therefore the first condition can be
>> removed.
On the 2nd thought, actually can not remove device->name, there can
be a case where degraded FS is unmounted, then device->name is NULL.
Thanks, Anand
> device->name is null only when missing is set.
>
> Will do this optimize in a new patch, as its about clean up and
> is not about fixing inconsistency as in here.
>
> Thanks, Anand
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] btrfs: fix inconsistency during missing device rejoin
@ 2017-12-04 4:43 Anand Jain
0 siblings, 0 replies; 5+ messages in thread
From: Anand Jain @ 2017-12-04 4:43 UTC (permalink / raw)
To: linux-btrfs
When device is missing its not necessary that btrfs_device::name is null
or the path is different when it reappears. Its possible that device can
go missing after its been scanned where neither of
btrfs_device::name == NULL OR btrfs_device::name != reappear_dev_path,
is true. So just check for btrfs_device::dev_state.missing. Thanks.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
fs/btrfs/volumes.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index aa0c1d9ce1f5..2f76a125d181 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -715,7 +715,8 @@ static noinline int device_list_add(const char *path,
ret = 1;
device->fs_devices = fs_devices;
- } else if (!device->name || strcmp(device->name->str, path)) {
+ } else if (!device->name || strcmp(device->name->str, path) ||
+ test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) {
/*
* When FS is already mounted.
* 1. If you are here and if the device->name is NULL that
--
2.15.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-12-15 8:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-04 7:19 [PATCH] btrfs: fix inconsistency during missing device rejoin Anand Jain
2017-12-05 2:18 ` Misono, Tomohiro
2017-12-05 2:53 ` Anand Jain
2017-12-15 8:03 ` Anand Jain
-- strict thread matches above, loose matches on Subject: below --
2017-12-04 4:43 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.