diff options
author | Christoph Hellwig <hch@lst.de> | 2021-10-14 15:02:31 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-10-17 06:59:45 -0600 |
commit | a20417611b98e12a724e5c828c472ea16990b71f (patch) | |
tree | 6918dd9fdd14216f1a4a43dd1744ca8787c9e015 | |
parent | f7bf35862477d6d4f8a9746c645a4380de984700 (diff) | |
download | lwn-a20417611b98e12a724e5c828c472ea16990b71f.tar.gz lwn-a20417611b98e12a724e5c828c472ea16990b71f.zip |
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.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211014130231.1468538-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | block/genhd.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c index 7a766cc613c7..b49858550fa6 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1078,6 +1078,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); |