Skip to content

Commit 44ac971

Browse files
mikechristiemartinkpetersen
authored andcommitted
scsi: iscsi: Fix NOP handling during conn recovery
If a offload driver doesn't use the xmit workqueue, then when we are doing ep_disconnect libiscsi can still inject PDUs to the driver. This adds a check for if the connection is bound before trying to inject PDUs. Link: https://lore.kernel.org/r/20220408001314.5014-9-michael.christie@oracle.com Tested-by: Manish Rangankar <mrangankar@marvell.com> Reviewed-by: Lee Duncan <lduncan@suse.com> Reviewed-by: Chris Leech <cleech@redhat.com> Signed-off-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 5bd8562 commit 44ac971

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

drivers/scsi/libiscsi.c

Lines changed: 6 additions & 1 deletion
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) {
@@ -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
/*

include/scsi/libiscsi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ enum {
5656
/* Connection flags */
5757
#define ISCSI_CONN_FLAG_SUSPEND_TX BIT(0)
5858
#define ISCSI_CONN_FLAG_SUSPEND_RX BIT(1)
59-
59+
#define ISCSI_CONN_FLAG_BOUND BIT(2)
6060

6161
#define ISCSI_ITT_MASK 0x1fff
6262
#define ISCSI_TOTAL_CMDS_MAX 4096

0 commit comments

Comments
 (0)