When forcefully removing a USB device on linux while there are outstanding writes to the device the kernel log fills up with
blk_update_request: I/O error, dev sdg, sector 50618368 Buffer I/O error on dev sdg, logical block 6327555, lost async page write [...]
messages and USB device resets:
usb 4-2: reset SuperSpeed USB device number 2 using xhci_hcd
I assume async page write refers to dirty pages in the buffer cache (write-back caching). It appears as if the kernel tries again for each dirty page, which takes a long time. All processes using the device hang.
Is there any way to tell the kernel, the block device
/dev/sdg is gone and is not going to come back - please drop all dirty pages for this block device?
Note: This would probably apply to any type of block device as well.