Skip to content

Commit a6ca887

Browse files
alexeipstgNicholas Bellinger
authored andcommitted
qla2xxx: delay plogi/prli ack until existing sessions are deleted
- keep qla_tgt_sess object on the session list until it's freed - modify use of sess->deleted flag to differentiate delayed session deletion that can be cancelled from irreversible one: QLA_SESS_DELETION_PENDING vs QLA_SESS_DELETION_IN_PROGRESS - during IN_PROGRESS deletion all newly arrived commands and TMRs will be rejected, existing commands and TMRs will be terminated when given by the core to the fabric or simply dropped if session logout has already happened (logout terminates all existing exchanges) - new PLOGI will initiate deletion of the following sessions (unless deletion is already IN_PROGRESS): - with the same port_name (with logout) - different port_name, different loop_id but the same port_id (with logout) - different port_name, different port_id, but the same loop_id (without logout) - additionally each new PLOGI will store imm notify iocb in the same port_name session being deleted. When deletion process completes this iocb will be acked. Only the most recent PLOGI iocb is stored. The older ones will be terminated when replaced. - new PRLI will initiate deletion of the following sessions (unless deletion is already IN_PROGRESS): - different port_name, different port_id, but the same loop_id (without logout) Cc: <stable@vger.kernel.org> # v3.18+ Signed-off-by: Alexei Potashnik <alexei@purestorage.com> Acked-by: Quinn Tran <quinn.tran@qlogic.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent 8b2f5ff commit a6ca887

File tree

7 files changed

+481
-22
lines changed

7 files changed

+481
-22
lines changed

drivers/scsi/qla2xxx/qla_dbg.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@
6767
* | | | 0xd031-0xd0ff |
6868
* | | | 0xd101-0xd1fe |
6969
* | | | 0xd214-0xd2fe |
70-
* | Target Mode | 0xe079 | |
71-
* | Target Mode Management | 0xf083 | 0xf002 |
70+
* | Target Mode | 0xe080 | |
71+
* | Target Mode Management | 0xf091 | 0xf002 |
7272
* | | | 0xf046-0xf049 |
73-
* | Target Mode Task Management | 0x1000b | |
73+
* | Target Mode Task Management | 0x1000d | |
7474
* ----------------------------------------------------------------------
7575
*/
7676

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@
274274
#define RESPONSE_ENTRY_CNT_FX00 256 /* Number of response entries.*/
275275

276276
struct req_que;
277+
struct qla_tgt_sess;
277278

278279
/*
279280
* (sd.h is not exported, hence local inclusion)
@@ -2026,6 +2027,7 @@ typedef struct fc_port {
20262027
uint16_t port_id;
20272028

20282029
unsigned long retry_delay_timestamp;
2030+
struct qla_tgt_sess *tgt_session;
20292031
} fc_port_t;
20302032

20312033
#include "qla_mr.h"

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ qla2x00_async_iocb_timeout(void *data)
115115
QLA_LOGIO_LOGIN_RETRIED : 0;
116116
qla2x00_post_async_login_done_work(fcport->vha, fcport,
117117
lio->u.logio.data);
118+
} else if (sp->type == SRB_LOGOUT_CMD) {
119+
qlt_logo_completion_handler(fcport, QLA_FUNCTION_TIMEOUT);
118120
}
119121
}
120122

@@ -497,7 +499,10 @@ void
497499
qla2x00_async_logout_done(struct scsi_qla_host *vha, fc_port_t *fcport,
498500
uint16_t *data)
499501
{
500-
qla2x00_mark_device_lost(vha, fcport, 1, 0);
502+
/* Don't re-login in target mode */
503+
if (!fcport->tgt_session)
504+
qla2x00_mark_device_lost(vha, fcport, 1, 0);
505+
qlt_logo_completion_handler(fcport, data[0]);
501506
return;
502507
}
503508

drivers/scsi/qla2xxx/qla_iocb.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,6 +1943,9 @@ qla24xx_logout_iocb(srb_t *sp, struct logio_entry_24xx *logio)
19431943
logio->entry_type = LOGINOUT_PORT_IOCB_TYPE;
19441944
logio->control_flags =
19451945
cpu_to_le16(LCF_COMMAND_LOGO|LCF_IMPL_LOGO);
1946+
if (!sp->fcport->tgt_session ||
1947+
!sp->fcport->tgt_session->keep_nport_handle)
1948+
logio->control_flags |= cpu_to_le16(LCF_FREE_NPORT);
19461949
logio->nport_handle = cpu_to_le16(sp->fcport->loop_id);
19471950
logio->port_id[0] = sp->fcport->d_id.b.al_pa;
19481951
logio->port_id[1] = sp->fcport->d_id.b.area;

0 commit comments

Comments
 (0)