Skip to content

Commit 552c114

Browse files
damien-lemoalaxboe
authored andcommitted
block: Clear BLK_ZONE_WPLUG_PLUGGED when aborting plugged BIOs
Commit fe0418e ("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: fe0418e ("block: Prevent potential deadlocks in zone write plug error recovery") Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Niklas Cassel <cassel@kernel.org> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent c196bf4 commit 552c114

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

block/blk-zoned.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,13 +741,17 @@ static void disk_zone_wplug_abort(struct blk_zone_wplug *zwplug)
741741
{
742742
struct bio *bio;
743743

744+
lockdep_assert_held(&zwplug->lock);
745+
744746
if (bio_list_empty(&zwplug->bio_list))
745747
return;
746748

747749
pr_warn_ratelimited("%s: zone %u: Aborting plugged BIOs\n",
748750
zwplug->disk->disk_name, zwplug->zone_no);
749751
while ((bio = bio_list_pop(&zwplug->bio_list)))
750752
blk_zone_wplug_bio_io_error(zwplug, bio);
753+
754+
zwplug->flags &= ~BLK_ZONE_WPLUG_PLUGGED;
751755
}
752756

753757
/*

0 commit comments

Comments
 (0)