答复: [PATCH v5 2/2] usb: storage: set surprise_removal flag on physical removal
From: 胡连勤
Date: Fri Nov 20 2026 - 07:32:05 EST
Hi Greg,
> > Set the surprise_removal flag in struct Scsi_Host when the USB device
> > state is USB_STATE_NOTATTACHED, indicating the device has been
> > physically removed and cannot handle I/O.
> >
> > This flag is checked by sd_remove() (added in the previous patch) to
> > skip sync_filesystem() during surprise removal, avoiding a hang waiting
> > for I/O that can never complete.
>
> There is no previous patch.
>
> > For orderly removal (e.g. rmmod, sysfs unbind) the USB device state is
> > not NOTATTACHED, so the flag is not set and sync proceeds normally,
> > preserving dirty data writeback.
> >
> > Signed-off-by: Lianqin Hu <hulianqin@xxxxxxxx>
>
> Does not match the From: line :(
Thanks for the review. Apologies for the issues:
1. Missing previous patch
Patch v5 1/2 was sent separately to the SCSI list:
https://lore.kernel.org/all/TYUPR06MB6217DD31B1B3CD09E431CC12D2922@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
I should have sent both patches together as a series with a cover
letter. My mistake.
2. From: / Signed-off-by mismatch
The From: header shows my Chinese name while Signed-off-by: uses the
English transliteration. I'll ensure they match in future submissions.
3. This patch is superseded
The issue has already been fixed by Bart Van Assche's patch, which was
merged upstream:
scsi: sd: Mark the disk dead if runtime resume fails in sd_remove()
https://lore.kernel.org/all/2c0c76d70f0fe197932836b9bcf8496095135d1b.1792446921.git.bvanassche@xxxxxxx/
Bart's solution is cleaner — it calls blk_mark_disk_dead() directly in
sd_remove() when scsi_autopm_get_device() fails, without needing a new
surprise_removal flag.
Thanks,
Lianqin