Skip to content

Commit 90ea17a

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: "13 fixes, all in drivers. The most extensive changes are in the iscsi series (affecting drivers qedi, cxgbi and bnx2i), the next most is scsi_debug, but that's just a simple revert and then minor updates to pm80xx" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: iscsi: MAINTAINERS: Add Mike Christie as co-maintainer scsi: qedi: Fix failed disconnect handling scsi: iscsi: Fix NOP handling during conn recovery scsi: iscsi: Merge suspend fields scsi: iscsi: Fix unbound endpoint error handling scsi: iscsi: Fix conn cleanup and stop race during iscsid restart scsi: iscsi: Fix endpoint reuse regression scsi: iscsi: Release endpoint ID when its freed scsi: iscsi: Fix offload conn cleanup when iscsid restarts scsi: iscsi: Move iscsi_ep_disconnect() scsi: pm80xx: Enable upper inbound, outbound queues scsi: pm80xx: Mask and unmask upper interrupt vectors 32-63 Revert "scsi: scsi_debug: Address races following module load"
2 parents b008683 + 70a3bae commit 90ea17a

12 files changed

Lines changed: 280 additions & 311 deletions

File tree

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10371,6 +10371,7 @@ F: include/linux/isapnp.h
1037110371
ISCSI
1037210372
M: Lee Duncan <lduncan@suse.com>
1037310373
M: Chris Leech <cleech@redhat.com>
10374+
M: Mike Christie <michael.christie@oracle.com>
1037410375
L: open-iscsi@googlegroups.com
1037510376
L: linux-scsi@vger.kernel.org
1037610377
S: Maintained

drivers/scsi/bnx2i/bnx2i_hwi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1977,7 +1977,7 @@ static int bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn)
19771977
if (nopin->cq_req_sn != qp->cqe_exp_seq_sn)
19781978
break;
19791979

1980-
if (unlikely(test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx))) {
1980+
if (unlikely(test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) {
19811981
if (nopin->op_code == ISCSI_OP_NOOP_IN &&
19821982
nopin->itt == (u16) RESERVED_ITT) {
19831983
printk(KERN_ALERT "bnx2i: Unsolicited "

drivers/scsi/bnx2i/bnx2i_iscsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1721,7 +1721,7 @@ static int bnx2i_tear_down_conn(struct bnx2i_hba *hba,
17211721
struct iscsi_conn *conn = ep->conn->cls_conn->dd_data;
17221722

17231723
/* Must suspend all rx queue activity for this ep */
1724-
set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
1724+
set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags);
17251725
}
17261726
/* CONN_DISCONNECT timeout may or may not be an issue depending
17271727
* on what transcribed in TCP layer, different targets behave

drivers/scsi/cxgbi/libcxgbi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,11 +1634,11 @@ void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk)
16341634
log_debug(1 << CXGBI_DBG_PDU_RX,
16351635
"csk 0x%p, conn 0x%p.\n", csk, conn);
16361636

1637-
if (unlikely(!conn || conn->suspend_rx)) {
1637+
if (unlikely(!conn || test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) {
16381638
log_debug(1 << CXGBI_DBG_PDU_RX,
1639-
"csk 0x%p, conn 0x%p, id %d, suspend_rx %lu!\n",
1639+
"csk 0x%p, conn 0x%p, id %d, conn flags 0x%lx!\n",
16401640
csk, conn, conn ? conn->id : 0xFF,
1641-
conn ? conn->suspend_rx : 0xFF);
1641+
conn ? conn->flags : 0xFF);
16421642
return;
16431643
}
16441644

drivers/scsi/libiscsi.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,8 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
678678
struct iscsi_task *task;
679679
itt_t itt;
680680

681-
if (session->state == ISCSI_STATE_TERMINATE)
681+
if (session->state == ISCSI_STATE_TERMINATE ||
682+
!test_bit(ISCSI_CONN_FLAG_BOUND, &conn->flags))
682683
return NULL;
683684

684685
if (opcode == ISCSI_OP_LOGIN || opcode == ISCSI_OP_TEXT) {
@@ -1392,8 +1393,8 @@ static bool iscsi_set_conn_failed(struct iscsi_conn *conn)
13921393
if (conn->stop_stage == 0)
13931394
session->state = ISCSI_STATE_FAILED;
13941395

1395-
set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
1396-
set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
1396+
set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags);
1397+
set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags);
13971398
return true;
13981399
}
13991400

@@ -1454,7 +1455,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task,
14541455
* Do this after dropping the extra ref because if this was a requeue
14551456
* it's removed from that list and cleanup_queued_task would miss it.
14561457
*/
1457-
if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) {
1458+
if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) {
14581459
/*
14591460
* Save the task and ref in case we weren't cleaning up this
14601461
* task and get woken up again.
@@ -1532,7 +1533,7 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
15321533
int rc = 0;
15331534

15341535
spin_lock_bh(&conn->session->frwd_lock);
1535-
if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) {
1536+
if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) {
15361537
ISCSI_DBG_SESSION(conn->session, "Tx suspended!\n");
15371538
spin_unlock_bh(&conn->session->frwd_lock);
15381539
return -ENODATA;
@@ -1746,7 +1747,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)
17461747
goto fault;
17471748
}
17481749

1749-
if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) {
1750+
if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) {
17501751
reason = FAILURE_SESSION_IN_RECOVERY;
17511752
sc->result = DID_REQUEUE << 16;
17521753
goto fault;
@@ -1935,7 +1936,7 @@ static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error)
19351936
void iscsi_suspend_queue(struct iscsi_conn *conn)
19361937
{
19371938
spin_lock_bh(&conn->session->frwd_lock);
1938-
set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
1939+
set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags);
19391940
spin_unlock_bh(&conn->session->frwd_lock);
19401941
}
19411942
EXPORT_SYMBOL_GPL(iscsi_suspend_queue);
@@ -1953,15 +1954,15 @@ void iscsi_suspend_tx(struct iscsi_conn *conn)
19531954
struct Scsi_Host *shost = conn->session->host;
19541955
struct iscsi_host *ihost = shost_priv(shost);
19551956

1956-
set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
1957+
set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags);
19571958
if (ihost->workq)
19581959
flush_workqueue(ihost->workq);
19591960
}
19601961
EXPORT_SYMBOL_GPL(iscsi_suspend_tx);
19611962

19621963
static void iscsi_start_tx(struct iscsi_conn *conn)
19631964
{
1964-
clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
1965+
clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags);
19651966
iscsi_conn_queue_work(conn);
19661967
}
19671968

@@ -2214,6 +2215,8 @@ void iscsi_conn_unbind(struct iscsi_cls_conn *cls_conn, bool is_active)
22142215
iscsi_suspend_tx(conn);
22152216

22162217
spin_lock_bh(&session->frwd_lock);
2218+
clear_bit(ISCSI_CONN_FLAG_BOUND, &conn->flags);
2219+
22172220
if (!is_active) {
22182221
/*
22192222
* if logout timed out before userspace could even send a PDU
@@ -3317,6 +3320,8 @@ int iscsi_conn_bind(struct iscsi_cls_session *cls_session,
33173320
spin_lock_bh(&session->frwd_lock);
33183321
if (is_leading)
33193322
session->leadconn = conn;
3323+
3324+
set_bit(ISCSI_CONN_FLAG_BOUND, &conn->flags);
33203325
spin_unlock_bh(&session->frwd_lock);
33213326

33223327
/*
@@ -3329,8 +3334,8 @@ int iscsi_conn_bind(struct iscsi_cls_session *cls_session,
33293334
/*
33303335
* Unblock xmitworker(), Login Phase will pass through.
33313336
*/
3332-
clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
3333-
clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
3337+
clear_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags);
3338+
clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags);
33343339
return 0;
33353340
}
33363341
EXPORT_SYMBOL_GPL(iscsi_conn_bind);

drivers/scsi/libiscsi_tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ int iscsi_tcp_recv_skb(struct iscsi_conn *conn, struct sk_buff *skb,
927927
*/
928928
conn->last_recv = jiffies;
929929

930-
if (unlikely(conn->suspend_rx)) {
930+
if (unlikely(test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) {
931931
ISCSI_DBG_TCP(conn, "Rx suspended!\n");
932932
*status = ISCSI_TCP_SUSPENDED;
933933
return 0;

drivers/scsi/pm8001/pm80xx_hwi.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,10 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha)
766766
pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_severity = 0x01;
767767
pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt = 0x01;
768768

769+
/* Enable higher IQs and OQs, 32 to 63, bit 16 */
770+
if (pm8001_ha->max_q_num > 32)
771+
pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt |=
772+
1 << 16;
769773
/* Disable end to end CRC checking */
770774
pm8001_ha->main_cfg_tbl.pm80xx_tbl.crc_core_dump = (0x1 << 16);
771775

@@ -1027,6 +1031,13 @@ static int mpi_init_check(struct pm8001_hba_info *pm8001_ha)
10271031
if (0x0000 != gst_len_mpistate)
10281032
return -EBUSY;
10291033

1034+
/*
1035+
* As per controller datasheet, after successful MPI
1036+
* initialization minimum 500ms delay is required before
1037+
* issuing commands.
1038+
*/
1039+
msleep(500);
1040+
10301041
return 0;
10311042
}
10321043

@@ -1727,10 +1738,11 @@ static void
17271738
pm80xx_chip_interrupt_enable(struct pm8001_hba_info *pm8001_ha, u8 vec)
17281739
{
17291740
#ifdef PM8001_USE_MSIX
1730-
u32 mask;
1731-
mask = (u32)(1 << vec);
1732-
1733-
pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_CLR, (u32)(mask & 0xFFFFFFFF));
1741+
if (vec < 32)
1742+
pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_CLR, 1U << vec);
1743+
else
1744+
pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_CLR_U,
1745+
1U << (vec - 32));
17341746
return;
17351747
#endif
17361748
pm80xx_chip_intx_interrupt_enable(pm8001_ha);
@@ -1746,12 +1758,15 @@ static void
17461758
pm80xx_chip_interrupt_disable(struct pm8001_hba_info *pm8001_ha, u8 vec)
17471759
{
17481760
#ifdef PM8001_USE_MSIX
1749-
u32 mask;
1750-
if (vec == 0xFF)
1751-
mask = 0xFFFFFFFF;
1761+
if (vec == 0xFF) {
1762+
/* disable all vectors 0-31, 32-63 */
1763+
pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, 0xFFFFFFFF);
1764+
pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_U, 0xFFFFFFFF);
1765+
} else if (vec < 32)
1766+
pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, 1U << vec);
17521767
else
1753-
mask = (u32)(1 << vec);
1754-
pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, (u32)(mask & 0xFFFFFFFF));
1768+
pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_U,
1769+
1U << (vec - 32));
17551770
return;
17561771
#endif
17571772
pm80xx_chip_intx_interrupt_disable(pm8001_ha);

drivers/scsi/qedi/qedi_iscsi.c

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,37 @@ static int qedi_task_xmit(struct iscsi_task *task)
860860
return qedi_iscsi_send_ioreq(task);
861861
}
862862

863+
static void qedi_offload_work(struct work_struct *work)
864+
{
865+
struct qedi_endpoint *qedi_ep =
866+
container_of(work, struct qedi_endpoint, offload_work);
867+
struct qedi_ctx *qedi;
868+
int wait_delay = 5 * HZ;
869+
int ret;
870+
871+
qedi = qedi_ep->qedi;
872+
873+
ret = qedi_iscsi_offload_conn(qedi_ep);
874+
if (ret) {
875+
QEDI_ERR(&qedi->dbg_ctx,
876+
"offload error: iscsi_cid=%u, qedi_ep=%p, ret=%d\n",
877+
qedi_ep->iscsi_cid, qedi_ep, ret);
878+
qedi_ep->state = EP_STATE_OFLDCONN_FAILED;
879+
return;
880+
}
881+
882+
ret = wait_event_interruptible_timeout(qedi_ep->tcp_ofld_wait,
883+
(qedi_ep->state ==
884+
EP_STATE_OFLDCONN_COMPL),
885+
wait_delay);
886+
if (ret <= 0 || qedi_ep->state != EP_STATE_OFLDCONN_COMPL) {
887+
qedi_ep->state = EP_STATE_OFLDCONN_FAILED;
888+
QEDI_ERR(&qedi->dbg_ctx,
889+
"Offload conn TIMEOUT iscsi_cid=%u, qedi_ep=%p\n",
890+
qedi_ep->iscsi_cid, qedi_ep);
891+
}
892+
}
893+
863894
static struct iscsi_endpoint *
864895
qedi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
865896
int non_blocking)
@@ -908,6 +939,7 @@ qedi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
908939
}
909940
qedi_ep = ep->dd_data;
910941
memset(qedi_ep, 0, sizeof(struct qedi_endpoint));
942+
INIT_WORK(&qedi_ep->offload_work, qedi_offload_work);
911943
qedi_ep->state = EP_STATE_IDLE;
912944
qedi_ep->iscsi_cid = (u32)-1;
913945
qedi_ep->qedi = qedi;
@@ -1056,12 +1088,11 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep)
10561088
qedi_ep = ep->dd_data;
10571089
qedi = qedi_ep->qedi;
10581090

1091+
flush_work(&qedi_ep->offload_work);
1092+
10591093
if (qedi_ep->state == EP_STATE_OFLDCONN_START)
10601094
goto ep_exit_recover;
10611095

1062-
if (qedi_ep->state != EP_STATE_OFLDCONN_NONE)
1063-
flush_work(&qedi_ep->offload_work);
1064-
10651096
if (qedi_ep->conn) {
10661097
qedi_conn = qedi_ep->conn;
10671098
abrt_conn = qedi_conn->abrt_conn;
@@ -1235,37 +1266,6 @@ static int qedi_data_avail(struct qedi_ctx *qedi, u16 vlanid)
12351266
return rc;
12361267
}
12371268

1238-
static void qedi_offload_work(struct work_struct *work)
1239-
{
1240-
struct qedi_endpoint *qedi_ep =
1241-
container_of(work, struct qedi_endpoint, offload_work);
1242-
struct qedi_ctx *qedi;
1243-
int wait_delay = 5 * HZ;
1244-
int ret;
1245-
1246-
qedi = qedi_ep->qedi;
1247-
1248-
ret = qedi_iscsi_offload_conn(qedi_ep);
1249-
if (ret) {
1250-
QEDI_ERR(&qedi->dbg_ctx,
1251-
"offload error: iscsi_cid=%u, qedi_ep=%p, ret=%d\n",
1252-
qedi_ep->iscsi_cid, qedi_ep, ret);
1253-
qedi_ep->state = EP_STATE_OFLDCONN_FAILED;
1254-
return;
1255-
}
1256-
1257-
ret = wait_event_interruptible_timeout(qedi_ep->tcp_ofld_wait,
1258-
(qedi_ep->state ==
1259-
EP_STATE_OFLDCONN_COMPL),
1260-
wait_delay);
1261-
if ((ret <= 0) || (qedi_ep->state != EP_STATE_OFLDCONN_COMPL)) {
1262-
qedi_ep->state = EP_STATE_OFLDCONN_FAILED;
1263-
QEDI_ERR(&qedi->dbg_ctx,
1264-
"Offload conn TIMEOUT iscsi_cid=%u, qedi_ep=%p\n",
1265-
qedi_ep->iscsi_cid, qedi_ep);
1266-
}
1267-
}
1268-
12691269
static int qedi_set_path(struct Scsi_Host *shost, struct iscsi_path *path_data)
12701270
{
12711271
struct qedi_ctx *qedi;
@@ -1381,7 +1381,6 @@ static int qedi_set_path(struct Scsi_Host *shost, struct iscsi_path *path_data)
13811381
qedi_ep->dst_addr, qedi_ep->dst_port);
13821382
}
13831383

1384-
INIT_WORK(&qedi_ep->offload_work, qedi_offload_work);
13851384
queue_work(qedi->offload_thread, &qedi_ep->offload_work);
13861385

13871386
ret = 0;

0 commit comments

Comments
 (0)