Commit d753856c9f9ae33a980192aa7b81d8b97d79dec2

Authored by Linus Torvalds

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "This is a set of three fixes: one to correct an abort path thinko
  causing failures (and a panic) in USB on device misbehaviour, One to
  fix an out of order issue in the fnic driver and one to match discard
  expectations to qemu which otherwise cause Linux to behave badly as a
  guest"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  SCSI: fix regression in scsi_send_eh_cmnd()
  fnic: IOMMU Fault occurs when IO and abort IO is out of order
  sd: tweak discard heuristics to work around QEMU SCSI issue

Showing 4 changed files Side-by-side Diff

drivers/scsi/fnic/fnic.h
... ... @@ -39,7 +39,7 @@
39 39  
40 40 #define DRV_NAME "fnic"
41 41 #define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
42   -#define DRV_VERSION "1.6.0.16"
  42 +#define DRV_VERSION "1.6.0.17"
43 43 #define PFX DRV_NAME ": "
44 44 #define DFX DRV_NAME "%d: "
45 45  
drivers/scsi/fnic/fnic_scsi.c
... ... @@ -1892,6 +1892,21 @@
1892 1892 goto fnic_abort_cmd_end;
1893 1893 }
1894 1894  
  1895 + /* IO out of order */
  1896 +
  1897 + if (!(CMD_FLAGS(sc) & (FNIC_IO_ABORTED | FNIC_IO_DONE))) {
  1898 + spin_unlock_irqrestore(io_lock, flags);
  1899 + FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
  1900 + "Issuing Host reset due to out of order IO\n");
  1901 +
  1902 + if (fnic_host_reset(sc) == FAILED) {
  1903 + FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
  1904 + "fnic_host_reset failed.\n");
  1905 + }
  1906 + ret = FAILED;
  1907 + goto fnic_abort_cmd_end;
  1908 + }
  1909 +
1895 1910 CMD_STATE(sc) = FNIC_IOREQ_ABTS_COMPLETE;
1896 1911  
1897 1912 /*
drivers/scsi/scsi_error.c
... ... @@ -1041,7 +1041,7 @@
1041 1041 }
1042 1042 /* signal not to enter either branch of the if () below */
1043 1043 timeleft = 0;
1044   - rtn = NEEDS_RETRY;
  1044 + rtn = FAILED;
1045 1045 } else {
1046 1046 timeleft = wait_for_completion_timeout(&done, timeout);
1047 1047 rtn = SUCCESS;
... ... @@ -1081,7 +1081,7 @@
1081 1081 rtn = FAILED;
1082 1082 break;
1083 1083 }
1084   - } else if (!rtn) {
  1084 + } else if (rtn != FAILED) {
1085 1085 scsi_abort_eh_cmnd(scmd);
1086 1086 rtn = FAILED;
1087 1087 }
... ... @@ -2623,8 +2623,9 @@
2623 2623 sd_config_discard(sdkp, SD_LBP_WS16);
2624 2624  
2625 2625 } else { /* LBP VPD page tells us what to use */
2626   -
2627   - if (sdkp->lbpws)
  2626 + if (sdkp->lbpu && sdkp->max_unmap_blocks && !sdkp->lbprz)
  2627 + sd_config_discard(sdkp, SD_LBP_UNMAP);
  2628 + else if (sdkp->lbpws)
2628 2629 sd_config_discard(sdkp, SD_LBP_WS16);
2629 2630 else if (sdkp->lbpws10)
2630 2631 sd_config_discard(sdkp, SD_LBP_WS10);