Linux block layer
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: Damien Le Moal <dlemoal@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:36:53 +0200	[thread overview]
Message-ID: <atm9FQQIkyEp-RBp@ryzen> (raw)
In-Reply-To: <3222f1e8-07a8-4948-bd95-3d816fd1d71e@kernel.org>

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


Kind regards,
Niklas

  reply	other threads:[~2026-10-22  7:36 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 [this message]
2026-10-22  7:42       ` Damien Le Moal

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=atm9FQQIkyEp-RBp@ryzen \
    --to=cassel@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=dlemoal@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox