Commit dec943f5f3d1ae2f1cffbdef6c39156e357aa35e

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 six fixes and a MAINTAINER update.

  The fixes are two multipath (one in Test Unit Ready handling for the
  path checkers and one in the section of code that sends a start unit
  after failover; both of these were perturbed by the scsi-mq update), a
  CD-ROM door locking fix that was likewise introduced by scsi-mq and
  three driver fixes for a previous code update in cxgb4i, megaraid_sas
  and bnx2fc"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  bnx2fc: fix tgt spinlock locking
  megaraid_sas: fix bug in handling return value of pci_enable_msix_range()
  cxgb4i: send abort_rpl correctly
  cxgbi: add maintainer for cxgb3i/cxgb4i
  scsi: TUR path is down after adapter gets reset with multipath
  scsi: call device handler for failed TUR command
  scsi: only re-lock door after EH on devices that were reset

Showing 8 changed files Side-by-side Diff

... ... @@ -2744,6 +2744,13 @@
2744 2744 S: Supported
2745 2745 F: drivers/net/ethernet/chelsio/cxgb3/
2746 2746  
  2747 +CXGB3 ISCSI DRIVER (CXGB3I)
  2748 +M: Karen Xie <kxie@chelsio.com>
  2749 +L: linux-scsi@vger.kernel.org
  2750 +W: http://www.chelsio.com
  2751 +S: Supported
  2752 +F: drivers/scsi/cxgbi/cxgb3i
  2753 +
2747 2754 CXGB3 IWARP RNIC DRIVER (IW_CXGB3)
2748 2755 M: Steve Wise <swise@chelsio.com>
2749 2756 L: linux-rdma@vger.kernel.org
... ... @@ -2757,6 +2764,13 @@
2757 2764 W: http://www.chelsio.com
2758 2765 S: Supported
2759 2766 F: drivers/net/ethernet/chelsio/cxgb4/
  2767 +
  2768 +CXGB4 ISCSI DRIVER (CXGB4I)
  2769 +M: Karen Xie <kxie@chelsio.com>
  2770 +L: linux-scsi@vger.kernel.org
  2771 +W: http://www.chelsio.com
  2772 +S: Supported
  2773 +F: drivers/scsi/cxgbi/cxgb4i
2760 2774  
2761 2775 CXGB4 IWARP RNIC DRIVER (IW_CXGB4)
2762 2776 M: Steve Wise <swise@chelsio.com>
drivers/scsi/bnx2fc/bnx2fc_els.c
... ... @@ -480,9 +480,7 @@
480 480 bnx2fc_initiate_cleanup(orig_io_req);
481 481 /* Post a new IO req with the same sc_cmd */
482 482 BNX2FC_IO_DBG(rec_req, "Post IO request again\n");
483   - spin_unlock_bh(&tgt->tgt_lock);
484 483 rc = bnx2fc_post_io_req(tgt, new_io_req);
485   - spin_lock_bh(&tgt->tgt_lock);
486 484 if (!rc)
487 485 goto free_frame;
488 486 BNX2FC_IO_DBG(rec_req, "REC: io post err\n");
drivers/scsi/bnx2fc/bnx2fc_io.c
... ... @@ -1894,18 +1894,24 @@
1894 1894 goto exit_qcmd;
1895 1895 }
1896 1896 }
  1897 +
  1898 + spin_lock_bh(&tgt->tgt_lock);
  1899 +
1897 1900 io_req = bnx2fc_cmd_alloc(tgt);
1898 1901 if (!io_req) {
1899 1902 rc = SCSI_MLQUEUE_HOST_BUSY;
1900   - goto exit_qcmd;
  1903 + goto exit_qcmd_tgtlock;
1901 1904 }
1902 1905 io_req->sc_cmd = sc_cmd;
1903 1906  
1904 1907 if (bnx2fc_post_io_req(tgt, io_req)) {
1905 1908 printk(KERN_ERR PFX "Unable to post io_req\n");
1906 1909 rc = SCSI_MLQUEUE_HOST_BUSY;
1907   - goto exit_qcmd;
  1910 + goto exit_qcmd_tgtlock;
1908 1911 }
  1912 +
  1913 +exit_qcmd_tgtlock:
  1914 + spin_unlock_bh(&tgt->tgt_lock);
1909 1915 exit_qcmd:
1910 1916 return rc;
1911 1917 }
... ... @@ -2020,6 +2026,8 @@
2020 2026 int task_idx, index;
2021 2027 u16 xid;
2022 2028  
  2029 + /* bnx2fc_post_io_req() is called with the tgt_lock held */
  2030 +
2023 2031 /* Initialize rest of io_req fields */
2024 2032 io_req->cmd_type = BNX2FC_SCSI_CMD;
2025 2033 io_req->port = port;
2026 2034  
... ... @@ -2047,9 +2055,7 @@
2047 2055 /* Build buffer descriptor list for firmware from sg list */
2048 2056 if (bnx2fc_build_bd_list_from_sg(io_req)) {
2049 2057 printk(KERN_ERR PFX "BD list creation failed\n");
2050   - spin_lock_bh(&tgt->tgt_lock);
2051 2058 kref_put(&io_req->refcount, bnx2fc_cmd_release);
2052   - spin_unlock_bh(&tgt->tgt_lock);
2053 2059 return -EAGAIN;
2054 2060 }
2055 2061  
2056 2062  
2057 2063  
... ... @@ -2061,19 +2067,15 @@
2061 2067 task = &(task_page[index]);
2062 2068 bnx2fc_init_task(io_req, task);
2063 2069  
2064   - spin_lock_bh(&tgt->tgt_lock);
2065   -
2066 2070 if (tgt->flush_in_prog) {
2067 2071 printk(KERN_ERR PFX "Flush in progress..Host Busy\n");
2068 2072 kref_put(&io_req->refcount, bnx2fc_cmd_release);
2069   - spin_unlock_bh(&tgt->tgt_lock);
2070 2073 return -EAGAIN;
2071 2074 }
2072 2075  
2073 2076 if (!test_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags)) {
2074 2077 printk(KERN_ERR PFX "Session not ready...post_io\n");
2075 2078 kref_put(&io_req->refcount, bnx2fc_cmd_release);
2076   - spin_unlock_bh(&tgt->tgt_lock);
2077 2079 return -EAGAIN;
2078 2080 }
2079 2081  
... ... @@ -2091,7 +2093,6 @@
2091 2093  
2092 2094 /* Ring doorbell */
2093 2095 bnx2fc_ring_doorbell(tgt);
2094   - spin_unlock_bh(&tgt->tgt_lock);
2095 2096 return 0;
2096 2097 }
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
... ... @@ -936,20 +936,23 @@
936 936 cxgbi_sock_get(csk);
937 937 spin_lock_bh(&csk->lock);
938 938  
939   - if (!cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) {
940   - cxgbi_sock_set_flag(csk, CTPF_ABORT_REQ_RCVD);
941   - cxgbi_sock_set_state(csk, CTP_ABORTING);
942   - goto done;
  939 + cxgbi_sock_clear_flag(csk, CTPF_ABORT_REQ_RCVD);
  940 +
  941 + if (!cxgbi_sock_flag(csk, CTPF_TX_DATA_SENT)) {
  942 + send_tx_flowc_wr(csk);
  943 + cxgbi_sock_set_flag(csk, CTPF_TX_DATA_SENT);
943 944 }
944 945  
945   - cxgbi_sock_clear_flag(csk, CTPF_ABORT_REQ_RCVD);
  946 + cxgbi_sock_set_flag(csk, CTPF_ABORT_REQ_RCVD);
  947 + cxgbi_sock_set_state(csk, CTP_ABORTING);
  948 +
946 949 send_abort_rpl(csk, rst_status);
947 950  
948 951 if (!cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) {
949 952 csk->err = abort_status_to_errno(csk, req->status, &rst_status);
950 953 cxgbi_sock_closed(csk);
951 954 }
952   -done:
  955 +
953 956 spin_unlock_bh(&csk->lock);
954 957 cxgbi_sock_put(csk);
955 958 rel_skb:
drivers/scsi/cxgbi/libcxgbi.c
... ... @@ -905,18 +905,16 @@
905 905 {
906 906 cxgbi_sock_get(csk);
907 907 spin_lock_bh(&csk->lock);
  908 +
  909 + cxgbi_sock_set_flag(csk, CTPF_ABORT_RPL_RCVD);
908 910 if (cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) {
909   - if (!cxgbi_sock_flag(csk, CTPF_ABORT_RPL_RCVD))
910   - cxgbi_sock_set_flag(csk, CTPF_ABORT_RPL_RCVD);
911   - else {
912   - cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_RCVD);
913   - cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_PENDING);
914   - if (cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD))
915   - pr_err("csk 0x%p,%u,0x%lx,%u,ABT_RPL_RSS.\n",
916   - csk, csk->state, csk->flags, csk->tid);
917   - cxgbi_sock_closed(csk);
918   - }
  911 + cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_PENDING);
  912 + if (cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD))
  913 + pr_err("csk 0x%p,%u,0x%lx,%u,ABT_RPL_RSS.\n",
  914 + csk, csk->state, csk->flags, csk->tid);
  915 + cxgbi_sock_closed(csk);
919 916 }
  917 +
920 918 spin_unlock_bh(&csk->lock);
921 919 cxgbi_sock_put(csk);
922 920 }
drivers/scsi/device_handler/scsi_dh_alua.c
... ... @@ -474,6 +474,13 @@
474 474 * LUN Not Ready -- Offline
475 475 */
476 476 return SUCCESS;
  477 + if (sdev->allow_restart &&
  478 + sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x02)
  479 + /*
  480 + * if the device is not started, we need to wake
  481 + * the error handler to start the motor
  482 + */
  483 + return FAILED;
477 484 break;
478 485 case UNIT_ATTENTION:
479 486 if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00)
drivers/scsi/megaraid/megaraid_sas_base.c
... ... @@ -4453,7 +4453,7 @@
4453 4453 instance->msixentry[i].entry = i;
4454 4454 i = pci_enable_msix_range(instance->pdev, instance->msixentry,
4455 4455 1, instance->msix_vectors);
4456   - if (i)
  4456 + if (i > 0)
4457 4457 instance->msix_vectors = i;
4458 4458 else
4459 4459 instance->msix_vectors = 0;
drivers/scsi/scsi_error.c
... ... @@ -459,14 +459,6 @@
459 459 if (! scsi_command_normalize_sense(scmd, &sshdr))
460 460 return FAILED; /* no valid sense data */
461 461  
462   - if (scmd->cmnd[0] == TEST_UNIT_READY && scmd->scsi_done != scsi_eh_done)
463   - /*
464   - * nasty: for mid-layer issued TURs, we need to return the
465   - * actual sense data without any recovery attempt. For eh
466   - * issued ones, we need to try to recover and interpret
467   - */
468   - return SUCCESS;
469   -
470 462 scsi_report_sense(sdev, &sshdr);
471 463  
472 464 if (scsi_sense_is_deferred(&sshdr))
... ... @@ -482,6 +474,14 @@
482 474 /* handler does not care. Drop down to default handling */
483 475 }
484 476  
  477 + if (scmd->cmnd[0] == TEST_UNIT_READY && scmd->scsi_done != scsi_eh_done)
  478 + /*
  479 + * nasty: for mid-layer issued TURs, we need to return the
  480 + * actual sense data without any recovery attempt. For eh
  481 + * issued ones, we need to try to recover and interpret
  482 + */
  483 + return SUCCESS;
  484 +
485 485 /*
486 486 * Previous logic looked for FILEMARK, EOM or ILI which are
487 487 * mainly associated with tapes and returned SUCCESS.
488 488  
... ... @@ -2001,8 +2001,10 @@
2001 2001 * is no point trying to lock the door of an off-line device.
2002 2002 */
2003 2003 shost_for_each_device(sdev, shost) {
2004   - if (scsi_device_online(sdev) && sdev->locked)
  2004 + if (scsi_device_online(sdev) && sdev->was_reset && sdev->locked) {
2005 2005 scsi_eh_lock_door(sdev);
  2006 + sdev->was_reset = 0;
  2007 + }
2006 2008 }
2007 2009  
2008 2010 /*