Re: [usb-storage] [PATCH v5 1/2] scsi: sd: mark disk dead on surprise host removal to avoid I/O hang
From: Oliver Neukum
Date: Tue Oct 13 2026 - 04:15:56 EST
On 09.10.26 13:29, '胡连勤' via USB Mass Storage on Linux wrote:
index a1b21ea14e54..98f861fb7e80 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -4272,6 +4272,10 @@ static void sd_remove(struct scsi_device *sdp)
scsi_autopm_get_device(sdkp->device);
Here you resume the device
+ /* Device is gone; avoid sync_filesystem() hang in del_gendisk(). */
+ if (sdkp->device->host->surprise_removal)
+ blk_mark_disk_dead(sdkp->disk);
Here you check whether it exists.
That seems a bit inverted. What is the point of resuming a device
that has gone away?
Regards
Oliver