Re: [PATCH v3] usb: uas: wait for pending commands before unbinding

From: Jiayi Li

Date: Tue Oct 27 2026 - 22:11:13 EST


Hi,

No worries, and thank you for taking another look.

On Tue, 27 Oct 2026 at 15:35:34 +0100, Oliver Neukum wrote:
> I'd say both ought to use cancel_work_sync()

The physical disconnect case is why I kept the first call
non-synchronous.

USB core has already terminated the interface URBs, but a running
synchronous scan may still be waiting for SCSI command completion.
Waiting for scan_work at the beginning of uas_disconnect() would
therefore delay the command cleanup below.

In testing, using cancel_work_sync() at the beginning waited for
about 11 seconds before reaching uas_pre_disconnect().

I would therefore keep cancel_work() at the beginning and synchronize
scan_work after the command cleanup.

Thanks,
Jiayi