* [PATCH] btrfs: zoned: propagate do_zone_finish() error in btrfs_zone_finish_endio()
@ 2026-08-18 10:00 Johannes Thumshirn
2026-08-18 22:41 ` Qu Wenruo
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Thumshirn @ 2026-08-18 10:00 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba, Naohiro Aota, 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 <johannes.thumshirn@wdc.com>
---
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)
--
2.55.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: zoned: propagate do_zone_finish() error in btrfs_zone_finish_endio()
2026-08-18 10:00 [PATCH] btrfs: zoned: propagate do_zone_finish() error in btrfs_zone_finish_endio() Johannes Thumshirn
@ 2026-08-18 22:41 ` Qu Wenruo
2026-08-18 22:44 ` Qu Wenruo
0 siblings, 1 reply; 4+ messages in thread
From: Qu Wenruo @ 2026-08-18 22:41 UTC (permalink / raw)
To: Johannes Thumshirn, linux-btrfs; +Cc: David Sterba, Naohiro Aota
在 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 <johannes.thumshirn@wdc.com>
Reviewed-by: Qu Wenruo <wqu@suse.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)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: zoned: propagate do_zone_finish() error in btrfs_zone_finish_endio()
2026-08-18 22:41 ` Qu Wenruo
@ 2026-08-18 22:44 ` Qu Wenruo
2026-08-19 8:34 ` Johannes Thumshirn
0 siblings, 1 reply; 4+ messages in thread
From: Qu Wenruo @ 2026-08-18 22:44 UTC (permalink / raw)
To: Johannes Thumshirn, linux-btrfs; +Cc: David Sterba, Naohiro Aota
在 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 <johannes.thumshirn@wdc.com>
>
> Reviewed-by: Qu Wenruo <wqu@suse.com>
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)
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: zoned: propagate do_zone_finish() error in btrfs_zone_finish_endio()
2026-08-18 22:44 ` Qu Wenruo
@ 2026-08-19 8:34 ` Johannes Thumshirn
0 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2026-08-19 8:34 UTC (permalink / raw)
To: Qu Wenruo, linux-btrfs; +Cc: David Sterba, Naohiro Aota
On 8/19/26 12:44 AM, Qu Wenruo wrote:
>
>
> 在 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 <johannes.thumshirn@wdc.com>
>>
>> Reviewed-by: Qu Wenruo <wqu@suse.com>
>
> 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
Oh thanks, I would've missed this. From a quick glance it looks valid.
I'll take care of it.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-19 8:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 10:00 [PATCH] btrfs: zoned: propagate do_zone_finish() error in btrfs_zone_finish_endio() Johannes Thumshirn
2026-08-18 22:41 ` Qu Wenruo
2026-08-18 22:44 ` Qu Wenruo
2026-08-19 8:34 ` Johannes Thumshirn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox