On Wed, 14 Mar 2012, Alan Stern wrote: > On Thu, 15 Mar 2012, Ming Lei wrote: > > > On Thu, Mar 15, 2012 at 12:04 AM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: > > > > > Is there any way to reproduce this? > > > > > > It seems to be saying that usb_stor_pre_reset() was called twice > > > without usb_stor_post_reset() being called in between, because the > > > post_reset routine is where the lock gets released. �I don't know of > > > any way that could happen. > > > > Looks it is a device with multiple usb mass interfaces, care to > > post the 'lsusb -v' of the device? > > > > If so, the following patch should remove the warning. > > > > diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c > > index c18538e..1c209a0 100644 > > --- a/drivers/usb/storage/usb.c > > +++ b/drivers/usb/storage/usb.c > > @@ -194,11 +194,13 @@ EXPORT_SYMBOL_GPL(usb_stor_reset_resume); > > int usb_stor_pre_reset(struct usb_interface *iface) > > { > > struct us_data *us = usb_get_intfdata(iface); > > + int if_num = (int)(iface - > > + us->pusb_dev->actconfig->interface[0]); > > > > US_DEBUGP("%s\n", __func__); > > > > /* Make sure no command runs during the reset */ > > - mutex_lock(&us->dev_mutex); > > + mutex_lock_nested(&us->dev_mutex, if_num); > > return 0; > > } > > EXPORT_SYMBOL_GPL(usb_stor_pre_reset); > > No, it won't fix the problem. It will work once, say when the driver > for interface 0 does a reset and calls the routine for interface 1. > But then what will happen when the driver for interface 1 does a reset > and calls the routine for interface 0? I take this back. It doesn't matter which driver thread does the reset, because the usb_reset_device() routine always calls the pre_reset methods in the same order. So yes, this patch should indeed fix the problem. On the other hand, that order is given by the entries in the us->pusb_dev->actconfig array, not by the interface numbers. Therefore this original version of the patch should be used instead of the revised version. Alan Stern -- 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