On Mon, May 29, 2017 at 11:31:07AM +0900, Nobuo Iwata wrote: > This patch adds recovery from false busy state on concurrent attach > operation. > > The procedure of attach operation is as below. > > 1) Find an unused port in /sys/devices/platform/vhci_hcd/status. > (userspace) > > 2) Request attach found port to driver through > /sys/devices/platform/vhci_hcd/attach. (userspace) > > 3) Lock table, reserve requested port and unlock table. (vhci driver) > > Attaching more than one remote devices concurrently, same unused port > number will be found in step-1. Then one request will succeed and > others will fail even though there are some unused ports. > > It is possible to avoid this fail by introdocing userspace exclusive > control. But it's exaggerated for this special condition. The locking > itself is done in driver. > > With this patch, driver returns EBUSY when requested port has already > been used. In this case, attach command retries from step-1: finding > another unused port. If there's no unused port, the attach operation > will fail. Othrwise it retries automatically using new free port. > > Currunt userspace src/usbip_attach.c:import_device() doesn't use the > errno. > > vhci-hcd's interface (only errno) is changed as following. > > Current errno New errno Condition > EINVAL same as left specified port numbre is in invalid > range > EAGAIN same as left platform_get_drvdata() failed > EINVAL same as left specified socket fd is not valid > EINVAL EBUSY specified port status is not free > > --- > Version information > > v2) > Gathered usbip_vhci_driver_close() for errors under an exit label. > > Signed-off-by: Nobuo Iwata <nobuo.iwata@xxxxxxxxxxxxxxx> Version info should go below this line: > --- > drivers/usb/usbip/vhci_sysfs.c | 8 ++++++-- > tools/usb/usbip/src/usbip_attach.c | 33 +++++++++++++++++------------- > 2 files changed, 25 insertions(+), 16 deletions(-) Otherwise you just cut off the signed-off-by line in the changelog :( Also, I need an ack from a usbip maintainer... thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html