block: Clear BLK_ZONE_WPLUG_PLUGGED when aborting plugged BIOs
Subsystems (2)
Damien Le Moal
maintainerPATCH 1/1 block: Clear BLK_ZONE_WPLUG_PLUGGED when aborting plugged BIOs
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.
--- block/blk-zoned.c | 4 ++++ 1 file changed, 4 insertions(+)
block/blk-zoned.c +4 -0
@@ -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 ; }/*
Signature · 1 line
2.52.0
Looks good,
Quoted 11 lines · Damien Le Moal
Commit
fe0418eb9bd6("block: Prevent potential deadlocks in zone write plug error recovery") added a WARN check indisk_put_zone_wplug()to verify that when the last reference to a zone write plug is dropped, this zone write plug does not have theBLK_ZONE_WPLUG_PLUGGEDflag 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 thedisk_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:
Quoted 6 lines · Damien Le Moal
Commit
fe0418eb9bd6("block: Prevent potential deadlocks in zone write plug error recovery") added a WARN check indisk_put_zone_wplug()to verify that when the last reference to a zone write plug is dropped, this zone write plug does not have theBLK_ZONE_WPLUG_PLUGGEDflag set, that is, that it is not plugged.
Quoted 8 lines
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 thedisk_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,
Signature · 1 line
Jens Axboe