Skip to content

Commit

Permalink
block: add a sanity check for a live disk in del_gendisk
Browse files Browse the repository at this point in the history
Add a sanity check to del_gendisk to do nothing when the disk wasn't
successfully added.  This papers over the complete lack of add_disk
error handling, which is about to get fixed gradually.

Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Hannes Reinecke <[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 23, 2021
1 parent d152c68 commit 40b3a52
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 @@ -579,7 +579,7 @@ void del_gendisk(struct gendisk *disk)
{
might_sleep();

if (WARN_ON_ONCE(!disk->queue))
if (WARN_ON_ONCE(!disk_live(disk)))
return;

blk_integrity_del(disk);
Expand Down

0 comments on commit 40b3a52

Please sign in to comment.