On Sat, 2019-07-06 at 14:37 -0400, Alan Stern wrote: > On Sat, 6 Jul 2019, Benjamin Herrenschmidt wrote: > > > On Fri, 2019-07-05 at 10:08 -0400, Alan Stern wrote: > > > On Fri, 5 Jul 2019, Benjamin Herrenschmidt wrote: > > > > > Sure but it would be nice if the mass storage dealt with > -ESHUTDOWN > > > > properly and stopped :-) Or other errors... if the UDC HW for > example > > > > dies for some reason, mass storage will lockup. > > > > > > I suppose we could add code to check for this case and handle > it, > > > although I'm not sure what would be the right thing to do. Delay > for > > > one second and try again? Disable the gadget until the host does > a > > > reset? > > > > I think just stop it until the next reset yes. > > Can you test this patch? Not for a few days, I'm away from the machine and that test requires me being physically present, but I will when I'm back. Thanks ! Cheers, Ben. > Alan Stern > > > > Index: usb-devel/drivers/usb/gadget/function/f_mass_storage.c > =================================================================== > --- usb-devel.orig/drivers/usb/gadget/function/f_mass_storage.c > +++ usb-devel/drivers/usb/gadget/function/f_mass_storage.c > @@ -552,13 +552,14 @@ static int start_transfer(struct fsg_dev > > /* We can't do much more than wait for a reset */ > req->status = rc; > + if (rc == -ESHUTDOWN) > + fsg->common->running = 0; > > /* > * Note: currently the net2280 driver fails zero- > length > * submissions if DMA is enabled. > */ > - if (rc != -ESHUTDOWN && > - !(rc == -EOPNOTSUPP && req->length == > 0)) > + else if (!(rc == -EOPNOTSUPP && req->length == 0)) > WARNING(fsg, "error in submission: %s --> > %d\n", > ep->name, rc); > }