Skip to content

Commit

Permalink
block: refine the disk_live check in del_gendisk
Browse files Browse the repository at this point in the history
hidden gendisks will never be marked live.

Fixes: 40b3a52 ("block: add a sanity check for a live disk in del_gendisk")
Reported-by: Bruno Goncalves <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Aug 24, 2021
1 parent 1743fa5 commit 9f28699
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,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);
Expand Down

0 comments on commit 9f28699

Please sign in to comment.