linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix wrong failed mirror_num of read-repair on raid56
@ 2017-03-24 19:13 Liu Bo
  2017-03-27 17:07 ` David Sterba
  2017-03-29 17:54 ` [PATCH v2] " Liu Bo
  0 siblings, 2 replies; 7+ messages in thread
From: Liu Bo @ 2017-03-24 19:13 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

In raid56 senario, after trying parity recovery, we didn't set
mirror_num for btrfs_bio with failed mirror_num, hence
end_bio_extent_readpage() will report a random mirror_num in dmesg
log.

Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/volumes.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 73d56ee..be64e4a 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -6197,6 +6197,7 @@ int btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
 		} else {
 			ret = raid56_parity_recover(fs_info, bio, bbio,
 						    map_length, mirror_num, 1);
+			btrfs_io_bio(bio)->mirror_num = mirror_num;
 		}
 
 		btrfs_bio_counter_dec(fs_info);
-- 
2.5.5


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

* Re: [PATCH] Btrfs: fix wrong failed mirror_num of read-repair on raid56
  2017-03-24 19:13 [PATCH] Btrfs: fix wrong failed mirror_num of read-repair on raid56 Liu Bo
@ 2017-03-27 17:07 ` David Sterba
  2017-03-29  4:54   ` Liu Bo
  2017-03-29 17:54 ` [PATCH v2] " Liu Bo
  1 sibling, 1 reply; 7+ messages in thread
From: David Sterba @ 2017-03-27 17:07 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-btrfs, David Sterba

On Fri, Mar 24, 2017 at 12:13:42PM -0700, Liu Bo wrote:
> In raid56 senario, after trying parity recovery, we didn't set
> mirror_num for btrfs_bio with failed mirror_num, hence
> end_bio_extent_readpage() will report a random mirror_num in dmesg
> log.
> 
> Cc: David Sterba <dsterba@suse.cz>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
>  fs/btrfs/volumes.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 73d56ee..be64e4a 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -6197,6 +6197,7 @@ int btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
>  		} else {
>  			ret = raid56_parity_recover(fs_info, bio, bbio,
>  						    map_length, mirror_num, 1);
> +			btrfs_io_bio(bio)->mirror_num = mirror_num;

Should the mirror be set inside raid56_parity_recover? There's another
caller, scrub_submit_raid56_bio_wait, that does not update the
bio->mirror_num. I am not sure if this is the same case though.

>  		}
>  
>  		btrfs_bio_counter_dec(fs_info);

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

* Re: [PATCH] Btrfs: fix wrong failed mirror_num of read-repair on raid56
  2017-03-27 17:07 ` David Sterba
@ 2017-03-29  4:54   ` Liu Bo
  0 siblings, 0 replies; 7+ messages in thread
From: Liu Bo @ 2017-03-29  4:54 UTC (permalink / raw)
  To: dsterba, linux-btrfs

On Mon, Mar 27, 2017 at 07:07:15PM +0200, David Sterba wrote:
> On Fri, Mar 24, 2017 at 12:13:42PM -0700, Liu Bo wrote:
> > In raid56 senario, after trying parity recovery, we didn't set
> > mirror_num for btrfs_bio with failed mirror_num, hence
> > end_bio_extent_readpage() will report a random mirror_num in dmesg
> > log.
> > 
> > Cc: David Sterba <dsterba@suse.cz>
> > Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> > ---
> >  fs/btrfs/volumes.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> > index 73d56ee..be64e4a 100644
> > --- a/fs/btrfs/volumes.c
> > +++ b/fs/btrfs/volumes.c
> > @@ -6197,6 +6197,7 @@ int btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
> >  		} else {
> >  			ret = raid56_parity_recover(fs_info, bio, bbio,
> >  						    map_length, mirror_num, 1);
> > +			btrfs_io_bio(bio)->mirror_num = mirror_num;
> 
> Should the mirror be set inside raid56_parity_recover? There's another
> caller, scrub_submit_raid56_bio_wait, that does not update the
> bio->mirror_num. I am not sure if this is the same case though.
>

scrub_submit_raid56_bio_wait doesn't need to, but yes, we could set the
mirror inside raid56_parity_recover iff @generic_io is 1.

Thanks,

-liubo

> >  		}
> >  
> >  		btrfs_bio_counter_dec(fs_info);


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

* [PATCH v2] Btrfs: fix wrong failed mirror_num of read-repair on raid56
  2017-03-24 19:13 [PATCH] Btrfs: fix wrong failed mirror_num of read-repair on raid56 Liu Bo
  2017-03-27 17:07 ` David Sterba
@ 2017-03-29 17:54 ` Liu Bo
  2017-03-30 11:43   ` David Sterba
  1 sibling, 1 reply; 7+ messages in thread
From: Liu Bo @ 2017-03-29 17:54 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

In raid56 scenario, after trying parity recovery, we didn't set
mirror_num for btrfs_bio with failed mirror_num, hence
end_bio_extent_readpage() will report a random mirror_num in dmesg
log.

Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
v2: Set mirror_num inside raid56_parity_recover so that all callers
can get a correct mirror_num if they need.

 fs/btrfs/raid56.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 1571bf2..a333acc 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -2118,6 +2118,11 @@ int raid56_parity_recover(struct btrfs_fs_info *fs_info, struct bio *bio,
 	struct btrfs_raid_bio *rbio;
 	int ret;
 
+	if (generic_io) {
+		ASSERT(bbio->mirror_num == mirror_num);
+		btrfs_io_bio(bio)->mirror_num = mirror_num;
+	}
+
 	rbio = alloc_rbio(fs_info, bbio, stripe_len);
 	if (IS_ERR(rbio)) {
 		if (generic_io)
-- 
2.5.5


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

* Re: [PATCH v2] Btrfs: fix wrong failed mirror_num of read-repair on raid56
  2017-03-29 17:54 ` [PATCH v2] " Liu Bo
@ 2017-03-30 11:43   ` David Sterba
  0 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2017-03-30 11:43 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-btrfs, David Sterba

On Wed, Mar 29, 2017 at 10:54:26AM -0700, Liu Bo wrote:
> In raid56 scenario, after trying parity recovery, we didn't set
> mirror_num for btrfs_bio with failed mirror_num, hence
> end_bio_extent_readpage() will report a random mirror_num in dmesg
> log.
> 
> Cc: David Sterba <dsterba@suse.cz>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>

Reviewed-by: David Sterba <dsterba@suse.com>

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

* Re: [PATCH v2] Btrfs: fix wrong failed mirror_num of read-repair on raid56
  2017-03-29 17:53 [PATCH v2] Btrfs: enable repair during read for raid56 profile Liu Bo
@ 2017-03-31  1:14 ` Qu Wenruo
  2017-03-31  1:21   ` Qu Wenruo
  0 siblings, 1 reply; 7+ messages in thread
From: Qu Wenruo @ 2017-03-31  1:14 UTC (permalink / raw)
  To: Liu Bo, linux-btrfs; +Cc: David Sterba



At 03/30/2017 01:54 AM, Liu Bo wrote:
> In raid56 scenario, after trying parity recovery, we didn't set
> mirror_num for btrfs_bio with failed mirror_num, hence
> end_bio_extent_readpage() will report a random mirror_num in dmesg
> log.
>
> Cc: David Sterba <dsterba@suse.cz>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>

Tested-by: Qu Wenruo <quwenruo@cn.fujitsu.com>

The test case is btrfs/125, with compress=lzo.

Even with ordered_extent error handler enhancement, compress=lzo mount 
option will cause test case to fail due to mismatch csum.

With these patches applied, btrfs/125 passws without error.

Thanks,
Qu
> ---
> v2: Set mirror_num inside raid56_parity_recover so that all callers
> can get a correct mirror_num if they need.
>
>  fs/btrfs/raid56.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
> index 1571bf2..a333acc 100644
> --- a/fs/btrfs/raid56.c
> +++ b/fs/btrfs/raid56.c
> @@ -2118,6 +2118,11 @@ int raid56_parity_recover(struct btrfs_fs_info *fs_info, struct bio *bio,
>  	struct btrfs_raid_bio *rbio;
>  	int ret;
>
> +	if (generic_io) {
> +		ASSERT(bbio->mirror_num == mirror_num);
> +		btrfs_io_bio(bio)->mirror_num = mirror_num;
> +	}
> +
>  	rbio = alloc_rbio(fs_info, bbio, stripe_len);
>  	if (IS_ERR(rbio)) {
>  		if (generic_io)
>



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

* Re: [PATCH v2] Btrfs: fix wrong failed mirror_num of read-repair on raid56
  2017-03-31  1:14 ` [PATCH v2] Btrfs: fix wrong failed mirror_num of read-repair on raid56 Qu Wenruo
@ 2017-03-31  1:21   ` Qu Wenruo
  0 siblings, 0 replies; 7+ messages in thread
From: Qu Wenruo @ 2017-03-31  1:21 UTC (permalink / raw)
  To: Liu Bo, linux-btrfs; +Cc: David Sterba



At 03/31/2017 09:14 AM, Qu Wenruo wrote:
>
>
> At 03/30/2017 01:54 AM, Liu Bo wrote:
>> In raid56 scenario, after trying parity recovery, we didn't set
>> mirror_num for btrfs_bio with failed mirror_num, hence
>> end_bio_extent_readpage() will report a random mirror_num in dmesg
>> log.
>>
>> Cc: David Sterba <dsterba@suse.cz>
>> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
>
> Tested-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
>
> The test case is btrfs/125, with compress=lzo.
>
> Even with ordered_extent error handler enhancement, compress=lzo mount
> option will cause test case to fail due to mismatch csum.
>
> With these patches applied, btrfs/125 passws without error.
>
> Thanks,
> Qu

Errr, sorry wrong patch, it should be previous patch "Btrfs: enable 
repair during read for raid56 profile".

Thanks,
Qu
>> ---
>> v2: Set mirror_num inside raid56_parity_recover so that all callers
>> can get a correct mirror_num if they need.
>>
>>  fs/btrfs/raid56.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
>> index 1571bf2..a333acc 100644
>> --- a/fs/btrfs/raid56.c
>> +++ b/fs/btrfs/raid56.c
>> @@ -2118,6 +2118,11 @@ int raid56_parity_recover(struct btrfs_fs_info
>> *fs_info, struct bio *bio,
>>      struct btrfs_raid_bio *rbio;
>>      int ret;
>>
>> +    if (generic_io) {
>> +        ASSERT(bbio->mirror_num == mirror_num);
>> +        btrfs_io_bio(bio)->mirror_num = mirror_num;
>> +    }
>> +
>>      rbio = alloc_rbio(fs_info, bbio, stripe_len);
>>      if (IS_ERR(rbio)) {
>>          if (generic_io)
>>
>
>
> --
> 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] 7+ messages in thread

end of thread, other threads:[~2017-03-31  1:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-24 19:13 [PATCH] Btrfs: fix wrong failed mirror_num of read-repair on raid56 Liu Bo
2017-03-27 17:07 ` David Sterba
2017-03-29  4:54   ` Liu Bo
2017-03-29 17:54 ` [PATCH v2] " Liu Bo
2017-03-30 11:43   ` David Sterba
  -- strict thread matches above, loose matches on Subject: below --
2017-03-29 17:53 [PATCH v2] Btrfs: enable repair during read for raid56 profile Liu Bo
2017-03-31  1:14 ` [PATCH v2] Btrfs: fix wrong failed mirror_num of read-repair on raid56 Qu Wenruo
2017-03-31  1:21   ` Qu Wenruo

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