Skip to contentSkip to conversation

block: warn when putting the final reference on a registered disk

PATCH Applied Christoph Hellwig 2 participants 2 messages Oct 14, 2021 – Oct 17, 2021 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: warn when putting the final reference on a registered disk

Warn when the last reference on a live disk is put without calling del_gendisk first. There are some BDI related bug reports that look like a case of this, so make sure we have the proper instrumentation to catch it.

---
 block/genhd.c | 1 +
 1 file changed, 1 insertion(+)
block/genhd.c +1 -0
index 5e8aa0ab66c2a..dd7e949f876ed 100644
@@ -1057,6 +1057,7 @@ static void disk_release(struct device *dev)
 	struct gendisk *disk = dev_to_disk(dev);
 
 	might_sleep();
+	WARN_ON_ONCE(disk_live(disk));
 
 	disk_release_events(disk);
 	kfree(disk->random);
Signature · 1 line
2.30.2
maintainer Applied
#1 lore raw
Quoted 6 lines · Christoph Hellwig

Warn when the last reference on a live disk is put without calling del_gendisk first. There are some BDI related bug reports that look like a case of this, so make sure we have the proper instrumentation to catch it.

Applied, thanks!

[1/1] block: warn when putting the final reference on a registered disk

      commit: a20417611b98e12a724e5c828c472ea16990b71f

Best regards,

Signature · 1 line
Jens Axboe