linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Btrfs: fix wrong missing device counter decrease
@ 2014-07-16 10:38 Miao Xie
  2014-07-17  2:37 ` Liu Bo
  0 siblings, 1 reply; 3+ messages in thread
From: Miao Xie @ 2014-07-16 10:38 UTC (permalink / raw)
  To: linux-btrfs

The missing devices are accounted by its own fs device, for example
the missing devices in seed filesystem will be accounted by the fs device
of the seed filesystem, not by the new filesystem which is based on
the seed filesystem, so when we remove the missing device in the
seed filesystem, we should decrease the counter of its own fs device.
Fix it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
This patch is against:
[PATCH 8/9] Btrfs: fix unzeroed members in fs_devices when creating a fs from seed fs
---
 fs/btrfs/volumes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index daecfa5..4cfbe76 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1723,7 +1723,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
 	device->fs_devices->total_devices--;
 
 	if (device->missing)
-		root->fs_info->fs_devices->missing_devices--;
+		device->fs_devices->missing_devices--;
 
 	next_device = list_entry(root->fs_info->fs_devices->devices.next,
 				 struct btrfs_device, dev_list);
-- 
1.9.3


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

* Re: [PATCH 1/2] Btrfs: fix wrong missing device counter decrease
  2014-07-16 10:38 [PATCH 1/2] Btrfs: fix wrong missing device counter decrease Miao Xie
@ 2014-07-17  2:37 ` Liu Bo
  2014-07-17  3:21   ` Miao Xie
  0 siblings, 1 reply; 3+ messages in thread
From: Liu Bo @ 2014-07-17  2:37 UTC (permalink / raw)
  To: Miao Xie; +Cc: linux-btrfs

On Wed, Jul 16, 2014 at 06:38:01PM +0800, Miao Xie wrote:
> The missing devices are accounted by its own fs device, for example
> the missing devices in seed filesystem will be accounted by the fs device
> of the seed filesystem, not by the new filesystem which is based on
> the seed filesystem, so when we remove the missing device in the
> seed filesystem, we should decrease the counter of its own fs device.
> Fix it.
> 
> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
> ---
> This patch is against:
> [PATCH 8/9] Btrfs: fix unzeroed members in fs_devices when creating a fs from seed fs
> ---
>  fs/btrfs/volumes.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index daecfa5..4cfbe76 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -1723,7 +1723,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
>  	device->fs_devices->total_devices--;
>  
>  	if (device->missing)
> -		root->fs_info->fs_devices->missing_devices--;
> +		device->fs_devices->missing_devices--;

But it is 'root->fs_info->fs_devices->missing_devices' that is increased in the
case of both read_one_dev() and add_missing_dev().

Well, in add_missing_dev(), they're consistent, but in read_one_dev(),
device->fs_devices could be a seed one, while root->fs_info->fs_devices is not.

Am I missing?

-liubo

>  
>  	next_device = list_entry(root->fs_info->fs_devices->devices.next,
>  				 struct btrfs_device, dev_list);
> -- 
> 1.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/2] Btrfs: fix wrong missing device counter decrease
  2014-07-17  2:37 ` Liu Bo
@ 2014-07-17  3:21   ` Miao Xie
  0 siblings, 0 replies; 3+ messages in thread
From: Miao Xie @ 2014-07-17  3:21 UTC (permalink / raw)
  To: bo.li.liu; +Cc: linux-btrfs

On Thu, 17 Jul 2014 10:37:57 +0800, Liu Bo wrote:
> On Wed, Jul 16, 2014 at 06:38:01PM +0800, Miao Xie wrote:
>> The missing devices are accounted by its own fs device, for example
>> the missing devices in seed filesystem will be accounted by the fs device
>> of the seed filesystem, not by the new filesystem which is based on
>> the seed filesystem, so when we remove the missing device in the
>> seed filesystem, we should decrease the counter of its own fs device.
>> Fix it.
>>
>> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
>> ---
>> This patch is against:
>> [PATCH 8/9] Btrfs: fix unzeroed members in fs_devices when creating a fs from seed fs
>> ---
>>  fs/btrfs/volumes.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index daecfa5..4cfbe76 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -1723,7 +1723,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
>>  	device->fs_devices->total_devices--;
>>  
>>  	if (device->missing)
>> -		root->fs_info->fs_devices->missing_devices--;
>> +		device->fs_devices->missing_devices--;
> 
> But it is 'root->fs_info->fs_devices->missing_devices' that is increased in the
> case of both read_one_dev() and add_missing_dev().
> 
> Well, in add_missing_dev(), they're consistent, but in read_one_dev(),
> device->fs_devices could be a seed one, while root->fs_info->fs_devices is not.

This is another bug, I will fix it later.

Thanks
Miao

> 
> Am I missing?
> 
> -liubo
> 
>>  
>>  	next_device = list_entry(root->fs_info->fs_devices->devices.next,
>>  				 struct btrfs_device, dev_list);
>> -- 
>> 1.9.3
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> .
> 


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

end of thread, other threads:[~2014-07-17  3:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-16 10:38 [PATCH 1/2] Btrfs: fix wrong missing device counter decrease Miao Xie
2014-07-17  2:37 ` Liu Bo
2014-07-17  3:21   ` Miao Xie

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).