block: add a sanity check for a live disk in del_gendisk

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]>
This commit is contained in:
Christoph Hellwig authored and Jens Axboe committed 2021-08-23 12:55:45 -06:00
1 parent d152c682f0
commit 40b3a52ffc
1 file changed
+1 -1
+1 -1
View File
@@ -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);