The previous commit missed three infinite KeWaitForSingleObject calls:
- pnp.c: Ext2PnpRemove and Ext2PnpSurpriseRemove wait forever for the
lower driver to complete the PnP IRP after device removal
- fsctl.c: Ext2IsMediaWriteProtected waits forever for the
write-protect check IRP to complete
All three now use 30-second timeouts with IRP cancellation on timeout,
matching the pattern used in block.c.
When a USB drive with an ext4 filesystem is removed while the driver has
outstanding I/O, the system hangs indefinitely because
KeWaitForSingleObject calls block forever waiting for completions that
will never arrive from the removed device.
This commit fixes the issue with three changes:
- block.c: add 30-second timeouts to all KeWaitForSingleObject calls and
cancel pending IRPs on timeout instead of waiting forever
- pnp.c: set VCB_DEVICE_REMOVED flag early in both PnpRemove and
PnpSurpriseRemove so concurrent I/O threads can fail fast
- read.c, write.c: check VCB_DEVICE_REMOVED flag before issuing new I/O
and return STATUS_NO_SUCH_DEVICE immediately