Re: All USB tools hang when one descriptor read fails and needs to timeout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 07, 2023 at 09:25:55AM +0100, Troels Liebe Bentsen wrote:
> Hi again,
> 
> Did a bit more testing and found another lock that would be nice to remove,
> the /dev/bus/usb/$BUS/$DEV file for the hub is also locked:
> 
> Bus 003 Device 016: ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
> 
> strace lsusb -v
> ...
> openat(AT_FDCWD, "/dev/bus/usb/003/016", O_RDWR|O_CLOEXEC...
> 
> The openat can not be canceled from userspace and even kill -9 won't stop
> the process until the descriptor read times out.

Yes, that really should be an interruptible lock.  In fact, all the 
locks connected with usbfs should be interruptible.

However, it can't be eliminated entirely.  This is a case where two 
things end up being mutually exclusive with each other because they both 
need to be mutually exclusive with a third thing.  In other words, 
opening a hub's usbfs file and probing a hub's children both have to be 
mutually exclusive with disconnecting the hub.  The three pathways all 
use the device lock for this purpose, so they are all mutually exclusive 
with each other.

> Also managed to get "lsusb -v" to hang in an unkillable way even after
> I unplugged the device and hub:
>
> ) = 1 ([{fd=5, revents=POLLIN}])
> ioctl(8, USBDEVFS_DISCARDURB

Making these lock calls interruptible should fix this problem, right?

Alan Stern



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux