Re: [PATCH] btrfs: handle bio_split() error
From: Johannes Thumshirn
Date: Wed Oct 30 2024 - 10:33:19 EST
On 30.10.24 15:21, John Garry wrote:
> On 30/10/2024 14:06, Johannes Thumshirn wrote:
>>>>> ret @@ got long @@
>> Yep that definitively needs to be:
>>
>> diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
>> index 96cacd5c03a5..847af28ecff9 100644
>> --- a/fs/btrfs/bio.c
>> +++ b/fs/btrfs/bio.c
>> @@ -691,7 +691,7 @@ static bool btrfs_submit_chunk(struct btrfs_bio
>> *bbio, int mirror_num)
>> if (map_length < length) {
>> bbio = btrfs_split_bio(fs_info, bbio, map_length);
>> if (IS_ERR(bbio)) {
>> - ret = PTR_ERR(bbio);
>> + ret = errno_to_blk_status(PTR_ERR(bbio));
>> goto fail;
>> }
>> bio = &bbio->bio;
>>
>> Can you fold that in John or do you want me to send a new version?
>
> Sure, no problem.
>
> But I would have suggested to not use variable name "ret" for holding a
> blk_status_t in original code, especially when it is mixed with
> PTR_ERR() usage ...
Yeah but the original code is using "blk_status_t ret", otherwise it
would be sth. like:
error = PTR_ERR(bbio);
ret = errno_to_blk_status(error);
goto fail;
[...]
fail:
btrfs_bio_end_io(bbio, ret);
Or changing the original code, which we could do but there's way more
urgent problems :)