* [PATCH] block: Clear BLK_ZONE_WPLUG_PLUGGED when aborting plugged BIOs
@ 2025-12-04 10:59 Damien Le Moal
2025-12-04 12:28 ` Johannes Thumshirn
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Damien Le Moal @ 2025-12-04 10:59 UTC (permalink / raw)
To: Jens Axboe, linux-block
Commit fe0418eb9bd6 ("block: Prevent potential deadlocks in zone write
plug error recovery") added a WARN check in disk_put_zone_wplug() to
verify that when the last reference to a zone write plug is dropped,
this zone write plug does not have the BLK_ZONE_WPLUG_PLUGGED flag set,
that is, that it is not plugged.
However, the function disk_zone_wplug_abort(), which is called for zone
reset and zone finish operations, does not clear this flag after
emptying a zone write plug BIO list. This can result in the
disk_put_zone_wplug() warning to trigger if the user (erroneously as
that is bad pratcice) issues zone reset or zone finish operations while
the target zone still has plugged BIOs.
Modify disk_put_zone_wplug() to clear the BLK_ZONE_WPLUG_PLUGGED flag.
And while at it, also add a lockdep annotation to ensure that this
function is called with the zone write plug spinlock held.
Fixes: fe0418eb9bd6 ("block: Prevent potential deadlocks in zone write plug error recovery")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
block/blk-zoned.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index dcc295721c2c..394d8d74bba9 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -741,6 +741,8 @@ static void disk_zone_wplug_abort(struct blk_zone_wplug *zwplug)
{
struct bio *bio;
+ lockdep_assert_held(&zwplug->lock);
+
if (bio_list_empty(&zwplug->bio_list))
return;
@@ -748,6 +750,8 @@ static void disk_zone_wplug_abort(struct blk_zone_wplug *zwplug)
zwplug->disk->disk_name, zwplug->zone_no);
while ((bio = bio_list_pop(&zwplug->bio_list)))
blk_zone_wplug_bio_io_error(zwplug, bio);
+
+ zwplug->flags &= ~BLK_ZONE_WPLUG_PLUGGED;
}
/*
--
2.52.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] block: Clear BLK_ZONE_WPLUG_PLUGGED when aborting plugged BIOs
2025-12-04 10:59 [PATCH] block: Clear BLK_ZONE_WPLUG_PLUGGED when aborting plugged BIOs Damien Le Moal
@ 2025-12-04 12:28 ` Johannes Thumshirn
2025-12-04 13:45 ` Niklas Cassel
2025-12-04 14:25 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2025-12-04 12:28 UTC (permalink / raw)
To: Damien Le Moal, Jens Axboe, linux-block@vger.kernel.org
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] block: Clear BLK_ZONE_WPLUG_PLUGGED when aborting plugged BIOs
2025-12-04 10:59 [PATCH] block: Clear BLK_ZONE_WPLUG_PLUGGED when aborting plugged BIOs Damien Le Moal
2025-12-04 12:28 ` Johannes Thumshirn
@ 2025-12-04 13:45 ` Niklas Cassel
2025-12-04 14:25 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Niklas Cassel @ 2025-12-04 13:45 UTC (permalink / raw)
To: Damien Le Moal; +Cc: Jens Axboe, linux-block
On Thu, Dec 04, 2025 at 07:59:52PM +0900, Damien Le Moal wrote:
> Commit fe0418eb9bd6 ("block: Prevent potential deadlocks in zone write
> plug error recovery") added a WARN check in disk_put_zone_wplug() to
> verify that when the last reference to a zone write plug is dropped,
> this zone write plug does not have the BLK_ZONE_WPLUG_PLUGGED flag set,
> that is, that it is not plugged.
>
> However, the function disk_zone_wplug_abort(), which is called for zone
> reset and zone finish operations, does not clear this flag after
> emptying a zone write plug BIO list. This can result in the
> disk_put_zone_wplug() warning to trigger if the user (erroneously as
> that is bad pratcice) issues zone reset or zone finish operations while
s/pratcice/practice/
Regardless:
Reviewed-by: Niklas Cassel <cassel@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] block: Clear BLK_ZONE_WPLUG_PLUGGED when aborting plugged BIOs
2025-12-04 10:59 [PATCH] block: Clear BLK_ZONE_WPLUG_PLUGGED when aborting plugged BIOs Damien Le Moal
2025-12-04 12:28 ` Johannes Thumshirn
2025-12-04 13:45 ` Niklas Cassel
@ 2025-12-04 14:25 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2025-12-04 14:25 UTC (permalink / raw)
To: linux-block, Damien Le Moal
On Thu, 04 Dec 2025 19:59:52 +0900, Damien Le Moal wrote:
> Commit fe0418eb9bd6 ("block: Prevent potential deadlocks in zone write
> plug error recovery") added a WARN check in disk_put_zone_wplug() to
> verify that when the last reference to a zone write plug is dropped,
> this zone write plug does not have the BLK_ZONE_WPLUG_PLUGGED flag set,
> that is, that it is not plugged.
>
> However, the function disk_zone_wplug_abort(), which is called for zone
> reset and zone finish operations, does not clear this flag after
> emptying a zone write plug BIO list. This can result in the
> disk_put_zone_wplug() warning to trigger if the user (erroneously as
> that is bad pratcice) issues zone reset or zone finish operations while
> the target zone still has plugged BIOs.
>
> [...]
Applied, thanks!
[1/1] block: Clear BLK_ZONE_WPLUG_PLUGGED when aborting plugged BIOs
commit: 96fd48daf5f23e2c051120943b7a66ee90806bbe
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-04 14:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-04 10:59 [PATCH] block: Clear BLK_ZONE_WPLUG_PLUGGED when aborting plugged BIOs Damien Le Moal
2025-12-04 12:28 ` Johannes Thumshirn
2025-12-04 13:45 ` Niklas Cassel
2025-12-04 14:25 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).