Re: [PATCH] btrfs: zoned: propagate do_zone_finish() error in btrfs_zone_finish_endio()

Qu Wenruo <[email protected]>
Newsgroups org.kernel.vger.linux-btrfs
Message-ID <[email protected]>

在 2026/8/19 08:11, Qu Wenruo 写道:
> 
> 
> 在 2026/8/18 19:30, Johannes Thumshirn 写道:
>> btrfs_zone_finish_endio() ignored the return value of do_zone_finish()
>> and always returned 0, silently dropping a failed zone finish.
>>
>> Instead propagate any error from do_zone_finish() as the caller
>> btrfs_finish_ordered_io() already handles it.
>>
>> Signed-off-by: Johannes Thumshirn <[email protected]>
> 
> Reviewed-by: Qu Wenruo <[email protected]>

BTW, you may still want to check the sashiko review, which exposed an 
pre-existing bug in the error handling path:

https://sashiko.dev/#/patchset/20260818100037.1366563-1-johannes.thumshirn%40wdc.com

> 
> Thanks,
> Qu
> 
>> ---
>>   fs/btrfs/zoned.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
>> index a016cb471beb..82c2394dd43c 100644
>> --- a/fs/btrfs/zoned.c
>> +++ b/fs/btrfs/zoned.c
>> @@ -2713,6 +2713,7 @@ int btrfs_zone_finish_endio(struct btrfs_fs_info 
>> *fs_info, u64 logical, u64 leng
>>   {
>>       struct btrfs_block_group *block_group;
>>       u64 min_alloc_bytes;
>> +    int ret = 0;
>>       if (!btrfs_is_zoned(fs_info))
>>           return 0;
>> @@ -2732,11 +2733,11 @@ int btrfs_zone_finish_endio(struct 
>> btrfs_fs_info *fs_info, u64 logical, u64 leng
>>           block_group->start + block_group->zone_capacity)
>>           goto out;
>> -    do_zone_finish(block_group, true);
>> +    ret = do_zone_finish(block_group, true);
>>   out:
>>       btrfs_put_block_group(block_group);
>> -    return 0;
>> +    return ret;
>>   }
>>   static void btrfs_zone_finish_endio_workfn(struct work_struct *work)
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.