Re: [PATCH v2 08/13] block: propagate readonly and offline conditions to zone write plugs

Hannes Reinecke <[email protected]> Fri, 7 Aug 2026 12:32:56 +0200
Newsgroups org.kernel.vger.linux-block
Message-ID <[email protected]>
On 8/6/26 6:04 PM, Damien Le Moal wrote:
> When revalidating the zones of a zoned block device, or when handling a
> zone which has a zone write plug flagged with
> BLK_ZONE_WPLUG_NEED_WP_UPDATE, the function
> disk_zone_wplug_sync_wp_offset() is used to update the write pointer
> offset of a zone write plug. However, this does not take into account the
> condition of the zone, which may have changed to readonly or offline,
> which in itself will always cause errors.
> 
> In order to catch such errors, rename disk_zone_wplug_sync_wp_offset() to
> disk_zone_wplug_sync_state() and in addition to the zone write pointer,
> also update the zone write plug condition if the zone is readonly or
> offline.
> 
> This change also requires changes to how a reset all zones operation
> (REQ_OP_ZONE_RESET_ALL) is handled so that the offline or read-only
> condition of zone write plugs is not overwritten with an erroneous empty
> condition. To do so, introduce the helper function
> disk_zone_is_offline_or_readonly() to skip updating the condition of zones
> that are read-only or offline and that do not have a zone write plug.
> For zones that have a zone write plug, the helper function
> disk_zone_wplug_is_offline_or_readonly() is used in
> disk_zone_wplug_set_wp_offset() to not update a zone write plug write
> pointer and condition for read-only and offline zones.
> 
> Signed-off-by: Damien Le Moal <[email protected]>
> ---
>   block/blk-zoned.c | 52 +++++++++++++++++++++++++++++++++++++++--------
>   1 file changed, 43 insertions(+), 9 deletions(-)
> 
Reviewed-by: Hannes Reinecke <[email protected]>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
[email protected]                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich