- /* abort processing: the bulk-only transport requires a reset
- * following an abort */
- Handle_Abort:
- srb->result = DID_ABORT << 16;
- if (us->protocol == US_PR_BULK)
+ /* Error and abort processing: try to resynchronize with the device
+ * by issuing a port reset. If that fails, try a class-specific
+ * device reset. */
+ Handle_Errors:
+
+ /* Set the RESETTING bit, and clear the ABORTING bit so that
+ * the reset may proceed. */
+ scsi_lock(us_to_host(us));
+ set_bit(US_FLIDX_RESETTING, &us->flags);
+ clear_bit(US_FLIDX_ABORTING, &us->flags);
+ scsi_unlock(us_to_host(us));
+
+ /* We must release the device lock because the pre_reset routine
+ * will want to acquire it. */
+ mutex_unlock(&us->dev_mutex);
+ result = usb_stor_port_reset(us);
+ mutex_lock(&us->dev_mutex);
+
+ if (result < 0) {
+ scsi_lock(us_to_host(us));
+ usb_stor_report_device_reset(us);
+ scsi_unlock(us_to_host(us));