Previously disk_free_zone_resources() would only clean up zoned settings
on a disk if the disk had write plugs allocated. Make it clean up zoned
settings on any disk, so disks that don't allocate write plugs can use
it as well.

Signed-off-by: Benjamin Marzinski <bmarz...@redhat.com>
---
 block/blk-zoned.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 761ea662ddc3..d7dc89cbdccb 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -1363,24 +1363,23 @@ static unsigned int disk_set_conv_zones_bitmap(struct 
gendisk *disk,
 
 void disk_free_zone_resources(struct gendisk *disk)
 {
-       if (!disk->zone_wplugs_pool)
-               return;
-
-       if (disk->zone_wplugs_wq) {
-               destroy_workqueue(disk->zone_wplugs_wq);
-               disk->zone_wplugs_wq = NULL;
-       }
+       if (disk->zone_wplugs_pool) {
+               if (disk->zone_wplugs_wq) {
+                       destroy_workqueue(disk->zone_wplugs_wq);
+                       disk->zone_wplugs_wq = NULL;
+               }
 
-       disk_destroy_zone_wplugs_hash_table(disk);
+               disk_destroy_zone_wplugs_hash_table(disk);
 
-       /*
-        * Wait for the zone write plugs to be RCU-freed before
-        * destorying the mempool.
-        */
-       rcu_barrier();
+               /*
+                * Wait for the zone write plugs to be RCU-freed before
+                * destorying the mempool.
+                */
+               rcu_barrier();
 
-       mempool_destroy(disk->zone_wplugs_pool);
-       disk->zone_wplugs_pool = NULL;
+               mempool_destroy(disk->zone_wplugs_pool);
+               disk->zone_wplugs_pool = NULL;
+       }
 
        disk_set_conv_zones_bitmap(disk, NULL);
        disk->zone_capacity = 0;
-- 
2.48.1


Reply via email to