Skip to content

Commit a204176

Browse files
Christoph Hellwigaxboe
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent f7bf358 commit a204176

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

block/genhd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,7 @@ static void disk_release(struct device *dev)
10781078
struct gendisk *disk = dev_to_disk(dev);
10791079

10801080
might_sleep();
1081+
WARN_ON_ONCE(disk_live(disk));
10811082

10821083
disk_release_events(disk);
10831084
kfree(disk->random);

0 commit comments

Comments
 (0)