Skip to content

Commit dec943f

Browse files
committed
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
2 parents de55bbb + dc6311d commit dec943f

8 files changed

Lines changed: 60 additions & 37 deletions

File tree

‎MAINTAINERS‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2744,6 +2744,13 @@ W: http://www.chelsio.com
27442744
S: Supported
27452745
F: drivers/net/ethernet/chelsio/cxgb3/
27462746

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+
27472754
CXGB3 IWARP RNIC DRIVER (IW_CXGB3)
27482755
M: Steve Wise <swise@chelsio.com>
27492756
L: linux-rdma@vger.kernel.org
@@ -2758,6 +2765,13 @@ W: http://www.chelsio.com
27582765
S: Supported
27592766
F: drivers/net/ethernet/chelsio/cxgb4/
27602767

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
2774+
27612775
CXGB4 IWARP RNIC DRIVER (IW_CXGB4)
27622776
M: Steve Wise <swise@chelsio.com>
27632777
L: linux-rdma@vger.kernel.org

‎drivers/scsi/bnx2fc/bnx2fc_els.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,7 @@ void bnx2fc_rec_compl(struct bnx2fc_els_cb_arg *cb_arg)
480480
bnx2fc_initiate_cleanup(orig_io_req);
481481
/* Post a new IO req with the same sc_cmd */
482482
BNX2FC_IO_DBG(rec_req, "Post IO request again\n");
483-
spin_unlock_bh(&tgt->tgt_lock);
484483
rc = bnx2fc_post_io_req(tgt, new_io_req);
485-
spin_lock_bh(&tgt->tgt_lock);
486484
if (!rc)
487485
goto free_frame;
488486
BNX2FC_IO_DBG(rec_req, "REC: io post err\n");

‎drivers/scsi/bnx2fc/bnx2fc_io.c‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,18 +1894,24 @@ int bnx2fc_queuecommand(struct Scsi_Host *host,
18941894
goto exit_qcmd;
18951895
}
18961896
}
1897+
1898+
spin_lock_bh(&tgt->tgt_lock);
1899+
18971900
io_req = bnx2fc_cmd_alloc(tgt);
18981901
if (!io_req) {
18991902
rc = SCSI_MLQUEUE_HOST_BUSY;
1900-
goto exit_qcmd;
1903+
goto exit_qcmd_tgtlock;
19011904
}
19021905
io_req->sc_cmd = sc_cmd;
19031906

19041907
if (bnx2fc_post_io_req(tgt, io_req)) {
19051908
printk(KERN_ERR PFX "Unable to post io_req\n");
19061909
rc = SCSI_MLQUEUE_HOST_BUSY;
1907-
goto exit_qcmd;
1910+
goto exit_qcmd_tgtlock;
19081911
}
1912+
1913+
exit_qcmd_tgtlock:
1914+
spin_unlock_bh(&tgt->tgt_lock);
19091915
exit_qcmd:
19101916
return rc;
19111917
}
@@ -2020,6 +2026,8 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt,
20202026
int task_idx, index;
20212027
u16 xid;
20222028

2029+
/* bnx2fc_post_io_req() is called with the tgt_lock held */
2030+
20232031
/* Initialize rest of io_req fields */
20242032
io_req->cmd_type = BNX2FC_SCSI_CMD;
20252033
io_req->port = port;
@@ -2047,9 +2055,7 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt,
20472055
/* Build buffer descriptor list for firmware from sg list */
20482056
if (bnx2fc_build_bd_list_from_sg(io_req)) {
20492057
printk(KERN_ERR PFX "BD list creation failed\n");
2050-
spin_lock_bh(&tgt->tgt_lock);
20512058
kref_put(&io_req->refcount, bnx2fc_cmd_release);
2052-
spin_unlock_bh(&tgt->tgt_lock);
20532059
return -EAGAIN;
20542060
}
20552061

@@ -2061,19 +2067,15 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt,
20612067
task = &(task_page[index]);
20622068
bnx2fc_init_task(io_req, task);
20632069

2064-
spin_lock_bh(&tgt->tgt_lock);
2065-
20662070
if (tgt->flush_in_prog) {
20672071
printk(KERN_ERR PFX "Flush in progress..Host Busy\n");
20682072
kref_put(&io_req->refcount, bnx2fc_cmd_release);
2069-
spin_unlock_bh(&tgt->tgt_lock);
20702073
return -EAGAIN;
20712074
}
20722075

20732076
if (!test_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags)) {
20742077
printk(KERN_ERR PFX "Session not ready...post_io\n");
20752078
kref_put(&io_req->refcount, bnx2fc_cmd_release);
2076-
spin_unlock_bh(&tgt->tgt_lock);
20772079
return -EAGAIN;
20782080
}
20792081

@@ -2091,6 +2093,5 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt,
20912093

20922094
/* Ring doorbell */
20932095
bnx2fc_ring_doorbell(tgt);
2094-
spin_unlock_bh(&tgt->tgt_lock);
20952096
return 0;
20962097
}

‎drivers/scsi/cxgbi/cxgb4i/cxgb4i.c‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -936,20 +936,23 @@ static void do_abort_req_rss(struct cxgbi_device *cdev, struct sk_buff *skb)
936936
cxgbi_sock_get(csk);
937937
spin_lock_bh(&csk->lock);
938938

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);
943944
}
944945

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+
946949
send_abort_rpl(csk, rst_status);
947950

948951
if (!cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) {
949952
csk->err = abort_status_to_errno(csk, req->status, &rst_status);
950953
cxgbi_sock_closed(csk);
951954
}
952-
done:
955+
953956
spin_unlock_bh(&csk->lock);
954957
cxgbi_sock_put(csk);
955958
rel_skb:

‎drivers/scsi/cxgbi/libcxgbi.c‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -905,18 +905,16 @@ void cxgbi_sock_rcv_abort_rpl(struct cxgbi_sock *csk)
905905
{
906906
cxgbi_sock_get(csk);
907907
spin_lock_bh(&csk->lock);
908+
909+
cxgbi_sock_set_flag(csk, CTPF_ABORT_RPL_RCVD);
908910
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);
919916
}
917+
920918
spin_unlock_bh(&csk->lock);
921919
cxgbi_sock_put(csk);
922920
}

‎drivers/scsi/device_handler/scsi_dh_alua.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,13 @@ static int alua_check_sense(struct scsi_device *sdev,
474474
* LUN Not Ready -- Offline
475475
*/
476476
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;
477484
break;
478485
case UNIT_ATTENTION:
479486
if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00)

‎drivers/scsi/megaraid/megaraid_sas_base.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4453,7 +4453,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
44534453
instance->msixentry[i].entry = i;
44544454
i = pci_enable_msix_range(instance->pdev, instance->msixentry,
44554455
1, instance->msix_vectors);
4456-
if (i)
4456+
if (i > 0)
44574457
instance->msix_vectors = i;
44584458
else
44594459
instance->msix_vectors = 0;

‎drivers/scsi/scsi_error.c‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,6 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
459459
if (! scsi_command_normalize_sense(scmd, &sshdr))
460460
return FAILED; /* no valid sense data */
461461

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-
470462
scsi_report_sense(sdev, &sshdr);
471463

472464
if (scsi_sense_is_deferred(&sshdr))
@@ -482,6 +474,14 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
482474
/* handler does not care. Drop down to default handling */
483475
}
484476

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+
485485
/*
486486
* Previous logic looked for FILEMARK, EOM or ILI which are
487487
* mainly associated with tapes and returned SUCCESS.
@@ -2001,8 +2001,10 @@ static void scsi_restart_operations(struct Scsi_Host *shost)
20012001
* is no point trying to lock the door of an off-line device.
20022002
*/
20032003
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) {
20052005
scsi_eh_lock_door(sdev);
2006+
sdev->was_reset = 0;
2007+
}
20062008
}
20072009

20082010
/*

0 commit comments

Comments
 (0)