All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Niklas Cassel <cassel@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	linux-block@vger.kernel.org
Subject: Re: [PATCH 2/2] null_blk: don't finish zones to set them read-only or offline
Date: Thu, 22 Oct 2026 09:42:59 +0200	[thread overview]
Message-ID: <7e115ae2-37ae-4d95-b9e8-fa4c59b1b09c@kernel.org> (raw)
In-Reply-To: <atm9FQQIkyEp-RBp@ryzen>

On 2026/10/22 9:36, Niklas Cassel wrote:
> On Thu, Oct 22, 2026 at 09:15:32AM +0200, Damien Le Moal wrote:
>> On 2026/10/21 22:21, Niklas Cassel wrote:
>>> null_set_zone_cond() calls null_finish_zone() to release the zone
>>> resources held by a zone before setting it read-only or offline.
>>>
>>> For an empty or closed zone, null_finish_zone() first runs the zone
>>> resource checks, which can close an unrelated implicitly open zone, or
>>> fail. As the error is ignored, a failure for a closed zone leaks
>>> nr_zones_closed, permanently lowering the effective active zone limit.
>>>
>>> Setting a zone read-only or offline requires no zone resources, so
>>> release the zone resources held by the zone directly instead, using a
>>> new helper, null_release_zone_resources().
>>>
>>> Fixes: d3a5738849e0 ("null_blk: support read-only and offline zone conditions")
>>> Signed-off-by: Niklas Cassel <cassel@kernel.org>
>>
>> Looks good, modulo one nit below.
>>
>> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
> 
> (snip)
> 
>>> @@ -768,9 +795,7 @@ static void null_set_zone_cond(struct nullb_device *dev,
>>
>> This function is called only from zone_cond_store() with cond either
>> BLK_ZONE_COND_READONLY or BLK_ZONE_COND_OFFLINE. Since your change is valid only
>> for these 2 conditions, we really should check that cond is either of the
>> already used values and add a comment, to avoid invalid use of
>> null_set_zone_cond() in the future (without tweaking it).
> 
> Could you clarify with code what you mean?
> 
> 
> For a comment, there is one already:
> https://github.com/torvalds/linux/blob/v7.3/drivers/block/null_blk/zoned.c#L746
> 
> For a check that cond is either read-only or offline, there such a check
> already:
> https://github.com/torvalds/linux/blob/v7.3/drivers/block/null_blk/zoned.c#L751-L752

Ah! I missed that! So please ignore my nit comment.

That said, adding a cleanup patch that changes null_set_zone_cond() to something
like:

static void null_set_zone_readonly_or_offline(struct nullb_device *dev,
			       		      struct nullb_zone *zone,
					      bool set_offline)

would make things a lot clearer :)


-- 
Damien Le Moal
Western Digital Research

      reply	other threads:[~2026-10-22  7:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21 20:21 [PATCH 0/2] null_blk: zone resource management fixes Niklas Cassel
2026-10-21 20:21 ` [PATCH 1/2] null_blk: fix opening closed zones at the active zone limit Niklas Cassel
2026-10-22  7:09   ` Damien Le Moal
2026-10-21 20:21 ` [PATCH 2/2] null_blk: don't finish zones to set them read-only or offline Niklas Cassel
2026-10-22  7:15   ` Damien Le Moal
2026-10-22  7:36     ` Niklas Cassel
2026-10-22  7:42       ` Damien Le Moal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e115ae2-37ae-4d95-b9e8-fa4c59b1b09c@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=cassel@kernel.org \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-block@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.