[v2] Btrfs: fix wrong failed mirror_num of read-repair on raid56
diff mbox

Message ID 1490810066-18764-1-git-send-email-bo.li.liu@oracle.com
State New
Headers show

Commit Message

Liu Bo March 29, 2017, 5:54 p.m. UTC
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(+)

Comments

David Sterba March 30, 2017, 11:43 a.m. UTC | #1
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>
--
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
Qu Wenruo March 31, 2017, 1:14 a.m. UTC | #2
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)
>


--
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
Qu Wenruo March 31, 2017, 1:21 a.m. UTC | #3
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


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

Patch
diff mbox

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)