Skip to contentSkip to conversation

block: refine the disk_live check in del_gendisk

PATCH Applied Christoph Hellwig 2 participants 2 messages Aug 24, 2021 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: refine the disk_live check in del_gendisk

hidden gendisks will never be marked live.

Fixes 40b3a52ffc5b ("block: add a sanity check for a live disk in del_gendisk")
---
 block/genhd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/genhd.c +1 -1
index a925f773145f..6a5c85aa2e31 100644
@@ -591,7 +591,7 @@ void del_gendisk(struct gendisk *disk)
 {
 	might_sleep();
 
-	if (WARN_ON_ONCE(!disk_live(disk)))
+	if (WARN_ON_ONCE(!disk_live(disk) && !(disk->flags & GENHD_FL_HIDDEN)))
 		return;
 
 	blk_integrity_del(disk);
Signature · 1 line
2.30.2
maintainer Applied
#1 lore raw
Quoted 1 line · Christoph Hellwig

hidden gendisks will never be marked live.

Applied, thanks.

Signature · 1 line
Jens Axboe