diff mbox series

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

Message ID 20211014130231.1468538-1-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series block: warn when putting the final reference on a registered disk | expand

Commit Message

Christoph Hellwig Oct. 14, 2021, 1:02 p.m. UTC
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.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/genhd.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jens Axboe Oct. 17, 2021, 12:59 p.m. UTC | #1
On Thu, 14 Oct 2021 15:02:31 +0200, Christoph Hellwig wrote:
> 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,
diff mbox series

Patch

diff --git a/block/genhd.c b/block/genhd.c
index 5e8aa0ab66c2a..dd7e949f876ed 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -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);