From: Greg Kroah-Hartman Date: Tue, 13 Mar 2018 14:18:06 +0000 (+0100) Subject: 4.14-stable patches X-Git-Tag: v4.14.27~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c96fb8e8eb256cb5fc15c2d520b4d92197a4ff6a;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: nfs-fix-an-incorrect-type-in-struct-nfs_direct_req.patch nfs-fix-unstable-write-completion.patch pnfs-prevent-the-layout-header-refcount-going-to-zero-in-pnfs_roc.patch scsi-qla2xxx-clear-loop-id-after-delete.patch scsi-qla2xxx-defer-processing-of-gs-iocb-calls.patch scsi-qla2xxx-fix-abort-command-deadlock-due-to-spinlock.patch scsi-qla2xxx-fix-gpnid-error-processing.patch scsi-qla2xxx-fix-login-state-machine-stuck-at-gpdb.patch scsi-qla2xxx-fix-memory-leak-in-dual-target-mode.patch scsi-qla2xxx-fix-npiv-host-cleanup-in-target-mode.patch scsi-qla2xxx-fix-prli-state-check.patch scsi-qla2xxx-fix-re-login-for-nport-handle-in-use.patch scsi-qla2xxx-fix-relogin-being-triggered-too-fast.patch scsi-qla2xxx-fix-scan-state-field-for-fcport.patch scsi-qla2xxx-fix-system-crash-for-notify-ack-timeout-handling.patch scsi-qla2xxx-fix-system-crash-in-qlt_plogi_ack_unref.patch scsi-qla2xxx-move-session-delete-to-driver-work-queue.patch scsi-qla2xxx-remove-aborting-els-iocb-call-issued-as-part-of-timeout.patch scsi-qla2xxx-replace-fcport-alloc-with-qla2x00_alloc_fcport.patch scsi-qla2xxx-retry-switch-command-on-time-out.patch scsi-qla2xxx-serialize-gpnid-for-multiple-rscn.patch scsi-qla2xxx-skip-irq-affinity-for-target-qpairs.patch --- diff --git a/queue-4.14/nfs-fix-an-incorrect-type-in-struct-nfs_direct_req.patch b/queue-4.14/nfs-fix-an-incorrect-type-in-struct-nfs_direct_req.patch new file mode 100644 index 00000000000..0a05861ba36 --- /dev/null +++ b/queue-4.14/nfs-fix-an-incorrect-type-in-struct-nfs_direct_req.patch @@ -0,0 +1,34 @@ +From d9ee65539d3eabd9ade46cca1780e3309ad0f907 Mon Sep 17 00:00:00 2001 +From: Trond Myklebust +Date: Tue, 6 Mar 2018 12:47:08 -0500 +Subject: NFS: Fix an incorrect type in struct nfs_direct_req + +From: Trond Myklebust + +commit d9ee65539d3eabd9ade46cca1780e3309ad0f907 upstream. + +The start offset needs to be of type loff_t. + +Fixed: 5fadeb47dcc5c ("nfs: count DIO good bytes correctly with mirroring") +Cc: stable@vger.kernel.org # v4.0+ +Signed-off-by: Trond Myklebust +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfs/direct.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/nfs/direct.c ++++ b/fs/nfs/direct.c +@@ -86,10 +86,10 @@ struct nfs_direct_req { + struct nfs_direct_mirror mirrors[NFS_PAGEIO_DESCRIPTOR_MIRROR_MAX]; + int mirror_count; + ++ loff_t io_start; /* Start offset for I/O */ + ssize_t count, /* bytes actually processed */ + max_count, /* max expected count */ + bytes_left, /* bytes left to be sent */ +- io_start, /* start of IO */ + error; /* any reported error */ + struct completion completion; /* wait for i/o completion */ + diff --git a/queue-4.14/nfs-fix-unstable-write-completion.patch b/queue-4.14/nfs-fix-unstable-write-completion.patch new file mode 100644 index 00000000000..bb1ab5a9768 --- /dev/null +++ b/queue-4.14/nfs-fix-unstable-write-completion.patch @@ -0,0 +1,146 @@ +From c4f24df942a181699c5bab01b8e5e82b925f77f3 Mon Sep 17 00:00:00 2001 +From: Trond Myklebust +Date: Wed, 7 Mar 2018 15:22:31 -0500 +Subject: NFS: Fix unstable write completion + +From: Trond Myklebust + +commit c4f24df942a181699c5bab01b8e5e82b925f77f3 upstream. + +We do want to respect the FLUSH_SYNC argument to nfs_commit_inode() to +ensure that all outstanding COMMIT requests to the inode in question are +complete. Currently we may exit early from both nfs_commit_inode() and +nfs_write_inode() even if there are COMMIT requests in flight, or unstable +writes on the commit list. + +In order to get the right semantics w.r.t. sync_inode(), we don't need +to have nfs_commit_inode() reset the inode dirty flags when called from +nfs_wb_page() and/or nfs_wb_all(). We just need to ensure that +nfs_write_inode() leaves them in the right state if there are outstanding +commits, or stable pages. + +Reported-by: Scott Mayhew +Fixes: dc4fd9ab01ab ("nfs: don't wait on commit in nfs_commit_inode()...") +Cc: stable@vger.kernel.org # v4.14+ +Signed-off-by: Trond Myklebust +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfs/write.c | 83 +++++++++++++++++++++++++++++---------------------------- + 1 file changed, 43 insertions(+), 40 deletions(-) + +--- a/fs/nfs/write.c ++++ b/fs/nfs/write.c +@@ -1877,40 +1877,43 @@ int nfs_generic_commit_list(struct inode + return status; + } + +-int nfs_commit_inode(struct inode *inode, int how) ++static int __nfs_commit_inode(struct inode *inode, int how, ++ struct writeback_control *wbc) + { + LIST_HEAD(head); + struct nfs_commit_info cinfo; + int may_wait = how & FLUSH_SYNC; +- int error = 0; +- int res; ++ int ret, nscan; + + nfs_init_cinfo_from_inode(&cinfo, inode); + nfs_commit_begin(cinfo.mds); +- res = nfs_scan_commit(inode, &head, &cinfo); +- if (res) +- error = nfs_generic_commit_list(inode, &head, how, &cinfo); ++ for (;;) { ++ ret = nscan = nfs_scan_commit(inode, &head, &cinfo); ++ if (ret <= 0) ++ break; ++ ret = nfs_generic_commit_list(inode, &head, how, &cinfo); ++ if (ret < 0) ++ break; ++ ret = 0; ++ if (wbc && wbc->sync_mode == WB_SYNC_NONE) { ++ if (nscan < wbc->nr_to_write) ++ wbc->nr_to_write -= nscan; ++ else ++ wbc->nr_to_write = 0; ++ } ++ if (nscan < INT_MAX) ++ break; ++ cond_resched(); ++ } + nfs_commit_end(cinfo.mds); +- if (res == 0) +- return res; +- if (error < 0) +- goto out_error; +- if (!may_wait) +- goto out_mark_dirty; +- error = wait_on_commit(cinfo.mds); +- if (error < 0) +- return error; +- return res; +-out_error: +- res = error; +- /* Note: If we exit without ensuring that the commit is complete, +- * we must mark the inode as dirty. Otherwise, future calls to +- * sync_inode() with the WB_SYNC_ALL flag set will fail to ensure +- * that the data is on the disk. +- */ +-out_mark_dirty: +- __mark_inode_dirty(inode, I_DIRTY_DATASYNC); +- return res; ++ if (ret || !may_wait) ++ return ret; ++ return wait_on_commit(cinfo.mds); ++} ++ ++int nfs_commit_inode(struct inode *inode, int how) ++{ ++ return __nfs_commit_inode(inode, how, NULL); + } + EXPORT_SYMBOL_GPL(nfs_commit_inode); + +@@ -1920,11 +1923,11 @@ int nfs_write_inode(struct inode *inode, + int flags = FLUSH_SYNC; + int ret = 0; + +- /* no commits means nothing needs to be done */ +- if (!atomic_long_read(&nfsi->commit_info.ncommit)) +- return ret; +- + if (wbc->sync_mode == WB_SYNC_NONE) { ++ /* no commits means nothing needs to be done */ ++ if (!atomic_long_read(&nfsi->commit_info.ncommit)) ++ goto check_requests_outstanding; ++ + /* Don't commit yet if this is a non-blocking flush and there + * are a lot of outstanding writes for this mapping. + */ +@@ -1935,16 +1938,16 @@ int nfs_write_inode(struct inode *inode, + flags = 0; + } + +- ret = nfs_commit_inode(inode, flags); +- if (ret >= 0) { +- if (wbc->sync_mode == WB_SYNC_NONE) { +- if (ret < wbc->nr_to_write) +- wbc->nr_to_write -= ret; +- else +- wbc->nr_to_write = 0; +- } +- return 0; +- } ++ ret = __nfs_commit_inode(inode, flags, wbc); ++ if (!ret) { ++ if (flags & FLUSH_SYNC) ++ return 0; ++ } else if (atomic_long_read(&nfsi->commit_info.ncommit)) ++ goto out_mark_dirty; ++ ++check_requests_outstanding: ++ if (!atomic_read(&nfsi->commit_info.rpcs_out)) ++ return ret; + out_mark_dirty: + __mark_inode_dirty(inode, I_DIRTY_DATASYNC); + return ret; diff --git a/queue-4.14/pnfs-prevent-the-layout-header-refcount-going-to-zero-in-pnfs_roc.patch b/queue-4.14/pnfs-prevent-the-layout-header-refcount-going-to-zero-in-pnfs_roc.patch new file mode 100644 index 00000000000..c5856e3c37a --- /dev/null +++ b/queue-4.14/pnfs-prevent-the-layout-header-refcount-going-to-zero-in-pnfs_roc.patch @@ -0,0 +1,66 @@ +From 9c6376ebddad585da4238532dd6d90ae23ffee67 Mon Sep 17 00:00:00 2001 +From: Trond Myklebust +Date: Wed, 7 Mar 2018 14:49:06 -0500 +Subject: pNFS: Prevent the layout header refcount going to zero in pnfs_roc() + +From: Trond Myklebust + +commit 9c6376ebddad585da4238532dd6d90ae23ffee67 upstream. + +Ensure that we hold a reference to the layout header when processing +the pNFS return-on-close so that the refcount value does not inadvertently +go to zero. + +Reported-by: Tigran Mkrtchyan +Signed-off-by: Trond Myklebust +Cc: stable@vger.kernel.org # v4.10+ +Tested-by: Tigran Mkrtchyan +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfs/pnfs.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +--- a/fs/nfs/pnfs.c ++++ b/fs/nfs/pnfs.c +@@ -292,8 +292,11 @@ pnfs_detach_layout_hdr(struct pnfs_layou + void + pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo) + { +- struct inode *inode = lo->plh_inode; ++ struct inode *inode; + ++ if (!lo) ++ return; ++ inode = lo->plh_inode; + pnfs_layoutreturn_before_put_layout_hdr(lo); + + if (atomic_dec_and_lock(&lo->plh_refcount, &inode->i_lock)) { +@@ -1223,10 +1226,12 @@ retry: + spin_lock(&ino->i_lock); + lo = nfsi->layout; + if (!lo || !pnfs_layout_is_valid(lo) || +- test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) ++ test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) { ++ lo = NULL; + goto out_noroc; ++ } ++ pnfs_get_layout_hdr(lo); + if (test_bit(NFS_LAYOUT_RETURN_LOCK, &lo->plh_flags)) { +- pnfs_get_layout_hdr(lo); + spin_unlock(&ino->i_lock); + wait_on_bit(&lo->plh_flags, NFS_LAYOUT_RETURN, + TASK_UNINTERRUPTIBLE); +@@ -1294,10 +1299,12 @@ out_noroc: + struct pnfs_layoutdriver_type *ld = NFS_SERVER(ino)->pnfs_curr_ld; + if (ld->prepare_layoutreturn) + ld->prepare_layoutreturn(args); ++ pnfs_put_layout_hdr(lo); + return true; + } + if (layoutreturn) + pnfs_send_layoutreturn(lo, &stateid, iomode, true); ++ pnfs_put_layout_hdr(lo); + return false; + } + diff --git a/queue-4.14/scsi-qla2xxx-clear-loop-id-after-delete.patch b/queue-4.14/scsi-qla2xxx-clear-loop-id-after-delete.patch new file mode 100644 index 00000000000..14e0e52d55d --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-clear-loop-id-after-delete.patch @@ -0,0 +1,57 @@ +From ba743f9148e951abe1c94f89c174ec8e44fb145b Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:45:12 -0800 +Subject: scsi: qla2xxx: Clear loop id after delete + +From: Quinn Tran + +commit ba743f9148e951abe1c94f89c174ec8e44fb145b upstream. + +Clear loop id after delete to prevent session invalidation of stale +session. + +Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") +Cc: # 4.10+ +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_target.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_target.c ++++ b/drivers/scsi/qla2xxx/qla_target.c +@@ -974,7 +974,7 @@ static void qlt_free_session_done(struct + qlt_send_first_logo(vha, &logo); + } + +- if (sess->logout_on_delete) { ++ if (sess->logout_on_delete && sess->loop_id != FC_NO_LOOP_ID) { + int rc; + + rc = qla2x00_post_async_logout_work(vha, sess, NULL); +@@ -1033,8 +1033,7 @@ static void qlt_free_session_done(struct + sess->login_succ = 0; + } + +- if (sess->chip_reset != ha->base_qpair->chip_reset) +- qla2x00_clear_loop_id(sess); ++ qla2x00_clear_loop_id(sess); + + if (sess->conflict) { + sess->conflict->login_pause = 0; +@@ -4588,9 +4587,9 @@ qlt_find_sess_invalidate_other(scsi_qla_ + "Invalidating sess %p loop_id %d wwn %llx.\n", + other_sess, other_sess->loop_id, other_wwn); + +- + other_sess->keep_nport_handle = 1; +- *conflict_sess = other_sess; ++ if (other_sess->disc_state != DSC_DELETED) ++ *conflict_sess = other_sess; + qlt_schedule_sess_for_deletion(other_sess, + true); + } diff --git a/queue-4.14/scsi-qla2xxx-defer-processing-of-gs-iocb-calls.patch b/queue-4.14/scsi-qla2xxx-defer-processing-of-gs-iocb-calls.patch new file mode 100644 index 00000000000..8c3ea96f7cc --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-defer-processing-of-gs-iocb-calls.patch @@ -0,0 +1,54 @@ +From 5d3300a9b8b122b4743aed5a178bf12c87e2b8c9 Mon Sep 17 00:00:00 2001 +From: Giridhar Malavali +Date: Mon, 4 Dec 2017 14:45:13 -0800 +Subject: scsi: qla2xxx: Defer processing of GS IOCB calls + +From: Giridhar Malavali + +commit 5d3300a9b8b122b4743aed5a178bf12c87e2b8c9 upstream. + +This patch defers processing of GS IOCB calls from interrupt context to +avoid hardware spinlock recursion. + +Following stack trace is seen + +? mod_timer+0x193/0x330 +? ql_dbg+0xa7/0xf0 [qla2xxx] +_raw_spin_lock_irqsave+0x31/0x40 +qla2x00_start_sp+0x3b/0x250 [qla2xxx] +qla24xx_async_gnl+0x1d3/0x240 [qla2xxx] +qla24xx_fcport_handle_login+0x285/0x290 [qla2xxx] +? vprintk_func+0x20/0x50 + +Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") +Cc: # 4.10+ +Signed-off-by: Giridhar Malavali +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_init.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -973,7 +973,7 @@ int qla24xx_fcport_handle_login(struct s + ql_dbg(ql_dbg_disc, vha, 0x20bd, + "%s %d %8phC post gnl\n", + __func__, __LINE__, fcport->port_name); +- qla24xx_async_gnl(vha, fcport); ++ qla24xx_post_gnl_work(vha, fcport); + } else { + ql_dbg(ql_dbg_disc, vha, 0x20bf, + "%s %d %8phC post login\n", +@@ -1142,7 +1142,7 @@ void qla24xx_handle_relogin_event(scsi_q + ql_dbg(ql_dbg_disc, vha, 0x20e9, "%s %d %8phC post gidpn\n", + __func__, __LINE__, fcport->port_name); + +- qla24xx_async_gidpn(vha, fcport); ++ qla24xx_post_gidpn_work(vha, fcport); + return; + } + diff --git a/queue-4.14/scsi-qla2xxx-fix-abort-command-deadlock-due-to-spinlock.patch b/queue-4.14/scsi-qla2xxx-fix-abort-command-deadlock-due-to-spinlock.patch new file mode 100644 index 00000000000..e471d652563 --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-fix-abort-command-deadlock-due-to-spinlock.patch @@ -0,0 +1,53 @@ +From b0dcce746b32ac573343ad39cb3dc485030de95e Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:45:09 -0800 +Subject: scsi: qla2xxx: Fix abort command deadlock due to spinlock + +From: Quinn Tran + +commit b0dcce746b32ac573343ad39cb3dc485030de95e upstream. + +Original code acquires hardware_lock to add Abort IOCB onto driver +request queue for processing. However, abort_command() will also acquire +hardware lock to look up sp pointer before issuing abort IOCB command +resulting into a deadlock. This patch safely removes the possible +deadlock scenario by removing extra spinlock. + +Fixes: 6eb54715b54bb ("qla2xxx: Added interface to send explicit LOGO.") +Cc: # 4.10+ +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_iocb.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_iocb.c ++++ b/drivers/scsi/qla2xxx/qla_iocb.c +@@ -2394,7 +2394,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data + struct scsi_qla_host *vha = sp->vha; + struct qla_hw_data *ha = vha->hw; + struct srb_iocb *lio = &sp->u.iocb_cmd; +- unsigned long flags = 0; + + ql_dbg(ql_dbg_io, vha, 0x3069, + "%s Timeout, hdl=%x, portid=%02x%02x%02x\n", +@@ -2402,7 +2401,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data + fcport->d_id.b.al_pa); + + /* Abort the exchange */ +- spin_lock_irqsave(&ha->hardware_lock, flags); + if (ha->isp_ops->abort_command(sp)) { + ql_dbg(ql_dbg_io, vha, 0x3070, + "mbx abort_command failed.\n"); +@@ -2410,7 +2408,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data + ql_dbg(ql_dbg_io, vha, 0x3071, + "mbx abort_command success.\n"); + } +- spin_unlock_irqrestore(&ha->hardware_lock, flags); + + complete(&lio->u.els_logo.comp); + } diff --git a/queue-4.14/scsi-qla2xxx-fix-gpnid-error-processing.patch b/queue-4.14/scsi-qla2xxx-fix-gpnid-error-processing.patch new file mode 100644 index 00000000000..1cecd94868b --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-fix-gpnid-error-processing.patch @@ -0,0 +1,37 @@ +From 22e786ea47f8795c561e1a01b6a66bb2cae2fc20 Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:44:57 -0800 +Subject: scsi: qla2xxx: Fix gpnid error processing + +From: Quinn Tran + +commit 22e786ea47f8795c561e1a01b6a66bb2cae2fc20 upstream. + +Stop GPNID command from advancing if command has failed. + +Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") +Cc: # 4.10+ +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_gs.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/scsi/qla2xxx/qla_gs.c ++++ b/drivers/scsi/qla2xxx/qla_gs.c +@@ -3211,6 +3211,11 @@ static void qla2x00_async_gpnid_sp_done( + sp->name, res, ct_req->req.port_id.port_id, + ct_rsp->rsp.gpn_id.port_name); + ++ if (res) { ++ sp->free(sp); ++ return; ++ } ++ + memset(&ea, 0, sizeof(ea)); + memcpy(ea.port_name, ct_rsp->rsp.gpn_id.port_name, WWN_SIZE); + ea.sp = sp; diff --git a/queue-4.14/scsi-qla2xxx-fix-login-state-machine-stuck-at-gpdb.patch b/queue-4.14/scsi-qla2xxx-fix-login-state-machine-stuck-at-gpdb.patch new file mode 100644 index 00000000000..cbf645090a0 --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-fix-login-state-machine-stuck-at-gpdb.patch @@ -0,0 +1,57 @@ +From 414d9ff3f8039f85d23f619dcbbd1ba2628a1a67 Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:45:03 -0800 +Subject: scsi: qla2xxx: Fix login state machine stuck at GPDB + +From: Quinn Tran + +commit 414d9ff3f8039f85d23f619dcbbd1ba2628a1a67 upstream. + +This patch returns discovery state machine back to Login Complete. + +Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") +Cc: # 4.10+ +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_init.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -864,6 +864,7 @@ void qla24xx_handle_gpdb_event(scsi_qla_ + int rval = ea->rc; + fc_port_t *fcport = ea->fcport; + unsigned long flags; ++ u16 opt = ea->sp->u.iocb_cmd.u.mbx.out_mb[10]; + + fcport->flags &= ~FCF_ASYNC_SENT; + +@@ -894,7 +895,8 @@ void qla24xx_handle_gpdb_event(scsi_qla_ + } + + spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); +- ea->fcport->login_gen++; ++ if (opt != PDO_FORCE_ADISC) ++ ea->fcport->login_gen++; + ea->fcport->deleted = 0; + ea->fcport->logout_on_delete = 1; + +@@ -918,6 +920,13 @@ void qla24xx_handle_gpdb_event(scsi_qla_ + + qla24xx_post_gpsc_work(vha, fcport); + } ++ } else if (ea->fcport->login_succ) { ++ /* ++ * We have an existing session. A late RSCN delivery ++ * must have triggered the session to be re-validate. ++ * session is still valid. ++ */ ++ fcport->disc_state = DSC_LOGIN_COMPLETE; + } + spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); + } /* gpdb event */ diff --git a/queue-4.14/scsi-qla2xxx-fix-memory-leak-in-dual-target-mode.patch b/queue-4.14/scsi-qla2xxx-fix-memory-leak-in-dual-target-mode.patch new file mode 100644 index 00000000000..e028a48cfd3 --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-fix-memory-leak-in-dual-target-mode.patch @@ -0,0 +1,96 @@ +From 7867b98dceb7741065c9c1b645136facad5c2e93 Mon Sep 17 00:00:00 2001 +From: "himanshu.madhani@cavium.com" +Date: Mon, 4 Dec 2017 14:45:16 -0800 +Subject: scsi: qla2xxx: Fix memory leak in dual/target mode + +From: himanshu.madhani@cavium.com + +commit 7867b98dceb7741065c9c1b645136facad5c2e93 upstream. + +When driver is loaded in Target/Dual mode, it creates QPair to support +MQ and allocates resources for each QPair. This Qpair initialization is +delayed until the FW personality is changed to Dual/Target mode by +issuing chip reset. At the time of chip reset firmware is re-initilized +in correct personality all the QPairs are initialized by sending +MBC_INITIALIZE_MULTIQ (001Fh). + +This patch fixes memory leak by adding check to issue +MBC_INITIALIZE_MULTIQ command only while deleting rsp/req queue when the +flag is set for initiator mode, and clean up QPair resources correctly +during the driver unload. This MBX does not need to be issued for +Target/Dual mode because chip reset will reset ISP. + +Fixes: d65237c7f0860 ("scsi: qla2xxx: Fix mailbox failure while deleting Queue pairs") +Cc: # 4.10+ +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_init.c | 4 +--- + drivers/scsi/qla2xxx/qla_mid.c | 18 ++++++++++-------- + 2 files changed, 11 insertions(+), 11 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -8092,9 +8092,6 @@ int qla2xxx_delete_qpair(struct scsi_qla + int ret = QLA_FUNCTION_FAILED; + struct qla_hw_data *ha = qpair->hw; + +- if (!vha->flags.qpairs_req_created && !vha->flags.qpairs_rsp_created) +- goto fail; +- + qpair->delete_in_progress = 1; + while (atomic_read(&qpair->ref_count)) + msleep(500); +@@ -8102,6 +8099,7 @@ int qla2xxx_delete_qpair(struct scsi_qla + ret = qla25xx_delete_req_que(vha, qpair->req); + if (ret != QLA_SUCCESS) + goto fail; ++ + ret = qla25xx_delete_rsp_que(vha, qpair->rsp); + if (ret != QLA_SUCCESS) + goto fail; +--- a/drivers/scsi/qla2xxx/qla_mid.c ++++ b/drivers/scsi/qla2xxx/qla_mid.c +@@ -575,14 +575,15 @@ qla25xx_free_rsp_que(struct scsi_qla_hos + int + qla25xx_delete_req_que(struct scsi_qla_host *vha, struct req_que *req) + { +- int ret = -1; ++ int ret = QLA_SUCCESS; + +- if (req) { ++ if (req && vha->flags.qpairs_req_created) { + req->options |= BIT_0; + ret = qla25xx_init_req_que(vha, req); ++ if (ret != QLA_SUCCESS) ++ return QLA_FUNCTION_FAILED; + } +- if (ret == QLA_SUCCESS) +- qla25xx_free_req_que(vha, req); ++ qla25xx_free_req_que(vha, req); + + return ret; + } +@@ -590,14 +591,15 @@ qla25xx_delete_req_que(struct scsi_qla_h + int + qla25xx_delete_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp) + { +- int ret = -1; ++ int ret = QLA_SUCCESS; + +- if (rsp) { ++ if (rsp && vha->flags.qpairs_rsp_created) { + rsp->options |= BIT_0; + ret = qla25xx_init_rsp_que(vha, rsp); ++ if (ret != QLA_SUCCESS) ++ return QLA_FUNCTION_FAILED; + } +- if (ret == QLA_SUCCESS) +- qla25xx_free_rsp_que(vha, rsp); ++ qla25xx_free_rsp_que(vha, rsp); + + return ret; + } diff --git a/queue-4.14/scsi-qla2xxx-fix-npiv-host-cleanup-in-target-mode.patch b/queue-4.14/scsi-qla2xxx-fix-npiv-host-cleanup-in-target-mode.patch new file mode 100644 index 00000000000..5310ea9542a --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-fix-npiv-host-cleanup-in-target-mode.patch @@ -0,0 +1,40 @@ +From 3be63b1e1838e35ce93e83f19573e949f4b389b4 Mon Sep 17 00:00:00 2001 +From: Sawan Chandak +Date: Mon, 4 Dec 2017 14:45:04 -0800 +Subject: scsi: qla2xxx: Fix NPIV host cleanup in target mode + +From: Sawan Chandak + +commit 3be63b1e1838e35ce93e83f19573e949f4b389b4 upstream. + +Add check to make sure we are cleaning up global target host list only +for NPIV hosts + +Fixes: bdbe24de281e2 ("scsi: qla2xxx: Cleanup NPIV host in target mode during config teardown") +Cc: # 4.10+ +Signed-off-by: Sawan Chandak +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_target.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_target.c ++++ b/drivers/scsi/qla2xxx/qla_target.c +@@ -1561,8 +1561,11 @@ static void qlt_release(struct qla_tgt * + + btree_destroy64(&tgt->lun_qpair_map); + +- if (ha->tgt.tgt_ops && ha->tgt.tgt_ops->remove_target) +- ha->tgt.tgt_ops->remove_target(vha); ++ if (vha->vp_idx) ++ if (ha->tgt.tgt_ops && ++ ha->tgt.tgt_ops->remove_target && ++ vha->vha_tgt.target_lport_ptr) ++ ha->tgt.tgt_ops->remove_target(vha); + + vha->vha_tgt.qla_tgt = NULL; + diff --git a/queue-4.14/scsi-qla2xxx-fix-prli-state-check.patch b/queue-4.14/scsi-qla2xxx-fix-prli-state-check.patch new file mode 100644 index 00000000000..d09ce19bfd1 --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-fix-prli-state-check.patch @@ -0,0 +1,37 @@ +From 23c645595dab7b414f23639d0a428a07515807df Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:45:08 -0800 +Subject: scsi: qla2xxx: Fix PRLI state check + +From: Quinn Tran + +commit 23c645595dab7b414f23639d0a428a07515807df upstream. + +Get Port Database MBX cmd is to validate current Login state upon PRLI +completion. Current code looks at the last login state for re-validation +which was incorrect. This patch removed incorrect state check. + +Fixes: 15f30a5752287 ("qla2xxx: Use IOCB interface to submit non-critical MBX.") +Cc: # 4.10+ +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_mbx.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_mbx.c ++++ b/drivers/scsi/qla2xxx/qla_mbx.c +@@ -6078,8 +6078,7 @@ int __qla24xx_parse_gpdb(struct scsi_qla + } + + /* Check for logged in state. */ +- if (current_login_state != PDS_PRLI_COMPLETE && +- last_login_state != PDS_PRLI_COMPLETE) { ++ if (current_login_state != PDS_PRLI_COMPLETE) { + ql_dbg(ql_dbg_mbx, vha, 0x119a, + "Unable to verify login-state (%x/%x) for loop_id %x.\n", + current_login_state, last_login_state, fcport->loop_id); diff --git a/queue-4.14/scsi-qla2xxx-fix-re-login-for-nport-handle-in-use.patch b/queue-4.14/scsi-qla2xxx-fix-re-login-for-nport-handle-in-use.patch new file mode 100644 index 00000000000..d56d125cf2f --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-fix-re-login-for-nport-handle-in-use.patch @@ -0,0 +1,153 @@ +From a084fd68e1d26174c4cc1a13fbb0112f468ff7f4 Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:45:00 -0800 +Subject: scsi: qla2xxx: Fix re-login for Nport Handle in use + +From: Quinn Tran + +commit a084fd68e1d26174c4cc1a13fbb0112f468ff7f4 upstream. + +When NPort Handle is in use, driver needs to mark the handle as used and +pick another. Instead, the code clears the handle and re-pick the same +handle. + +Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") +Cc: # 4.10+ +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_gs.c | 16 ++++++++++---- + drivers/scsi/qla2xxx/qla_init.c | 44 ++++++++++++++++++++++++++++++++++++---- + drivers/scsi/qla2xxx/qla_isr.c | 5 ---- + 3 files changed, 51 insertions(+), 14 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_gs.c ++++ b/drivers/scsi/qla2xxx/qla_gs.c +@@ -2833,7 +2833,7 @@ void qla24xx_handle_gidpn_event(scsi_qla + } + } else { /* fcport->d_id.b24 != ea->id.b24 */ + fcport->d_id.b24 = ea->id.b24; +- if (fcport->deleted == QLA_SESS_DELETED) { ++ if (fcport->deleted != QLA_SESS_DELETED) { + ql_dbg(ql_dbg_disc, vha, 0x2021, + "%s %d %8phC post del sess\n", + __func__, __LINE__, fcport->port_name); +@@ -3206,10 +3206,16 @@ static void qla2x00_async_gpnid_sp_done( + struct event_arg ea; + struct qla_work_evt *e; + +- ql_dbg(ql_dbg_disc, vha, 0x2066, +- "Async done-%s res %x ID %3phC. %8phC\n", +- sp->name, res, ct_req->req.port_id.port_id, +- ct_rsp->rsp.gpn_id.port_name); ++ if (res) ++ ql_dbg(ql_dbg_disc, vha, 0x2066, ++ "Async done-%s fail res %x ID %3phC. %8phC\n", ++ sp->name, res, ct_req->req.port_id.port_id, ++ ct_rsp->rsp.gpn_id.port_name); ++ else ++ ql_dbg(ql_dbg_disc, vha, 0x2066, ++ "Async done-%s good ID %3phC. %8phC\n", ++ sp->name, ct_req->req.port_id.port_id, ++ ct_rsp->rsp.gpn_id.port_name); + + if (res) { + sp->free(sp); +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -1445,6 +1445,8 @@ static void + qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea) + { + port_id_t cid; /* conflict Nport id */ ++ u16 lid; ++ struct fc_port *conflict_fcport; + + switch (ea->data[0]) { + case MBS_COMMAND_COMPLETE: +@@ -1460,8 +1462,12 @@ qla24xx_handle_plogi_done_event(struct s + qla24xx_post_prli_work(vha, ea->fcport); + } else { + ql_dbg(ql_dbg_disc, vha, 0x20ea, +- "%s %d %8phC post gpdb\n", +- __func__, __LINE__, ea->fcport->port_name); ++ "%s %d %8phC LoopID 0x%x in use with %06x. post gnl\n", ++ __func__, __LINE__, ea->fcport->port_name, ++ ea->fcport->loop_id, ea->fcport->d_id.b24); ++ ++ set_bit(ea->fcport->loop_id, vha->hw->loop_id_map); ++ ea->fcport->loop_id = FC_NO_LOOP_ID; + ea->fcport->chip_reset = vha->hw->base_qpair->chip_reset; + ea->fcport->logout_on_delete = 1; + ea->fcport->send_els_logo = 0; +@@ -1506,8 +1512,38 @@ qla24xx_handle_plogi_done_event(struct s + ea->fcport->d_id.b.domain, ea->fcport->d_id.b.area, + ea->fcport->d_id.b.al_pa); + +- qla2x00_clear_loop_id(ea->fcport); +- qla24xx_post_gidpn_work(vha, ea->fcport); ++ lid = ea->iop[1] & 0xffff; ++ qlt_find_sess_invalidate_other(vha, ++ wwn_to_u64(ea->fcport->port_name), ++ ea->fcport->d_id, lid, &conflict_fcport); ++ ++ if (conflict_fcport) { ++ /* ++ * Another fcport share the same loop_id/nport id. ++ * Conflict fcport needs to finish cleanup before this ++ * fcport can proceed to login. ++ */ ++ conflict_fcport->conflict = ea->fcport; ++ ea->fcport->login_pause = 1; ++ ++ ql_dbg(ql_dbg_disc, vha, 0x20ed, ++ "%s %d %8phC NPortId %06x inuse with loopid 0x%x. post gidpn\n", ++ __func__, __LINE__, ea->fcport->port_name, ++ ea->fcport->d_id.b24, lid); ++ qla2x00_clear_loop_id(ea->fcport); ++ qla24xx_post_gidpn_work(vha, ea->fcport); ++ } else { ++ ql_dbg(ql_dbg_disc, vha, 0x20ed, ++ "%s %d %8phC NPortId %06x inuse with loopid 0x%x. sched delete\n", ++ __func__, __LINE__, ea->fcport->port_name, ++ ea->fcport->d_id.b24, lid); ++ ++ qla2x00_clear_loop_id(ea->fcport); ++ set_bit(lid, vha->hw->loop_id_map); ++ ea->fcport->loop_id = lid; ++ ea->fcport->keep_nport_handle = 0; ++ qlt_schedule_sess_for_deletion(ea->fcport, false); ++ } + break; + } + return; +--- a/drivers/scsi/qla2xxx/qla_isr.c ++++ b/drivers/scsi/qla2xxx/qla_isr.c +@@ -2341,7 +2341,6 @@ qla2x00_status_entry(scsi_qla_host_t *vh + int res = 0; + uint16_t state_flags = 0; + uint16_t retry_delay = 0; +- uint8_t no_logout = 0; + + sts = (sts_entry_t *) pkt; + sts24 = (struct sts_entry_24xx *) pkt; +@@ -2612,7 +2611,6 @@ check_scsi_status: + break; + + case CS_PORT_LOGGED_OUT: +- no_logout = 1; + case CS_PORT_CONFIG_CHG: + case CS_PORT_BUSY: + case CS_INCOMPLETE: +@@ -2643,9 +2641,6 @@ check_scsi_status: + port_state_str[atomic_read(&fcport->state)], + comp_status); + +- if (no_logout) +- fcport->logout_on_delete = 0; +- + qla2x00_mark_device_lost(fcport->vha, fcport, 1, 1); + qlt_schedule_sess_for_deletion_lock(fcport); + } diff --git a/queue-4.14/scsi-qla2xxx-fix-relogin-being-triggered-too-fast.patch b/queue-4.14/scsi-qla2xxx-fix-relogin-being-triggered-too-fast.patch new file mode 100644 index 00000000000..8a16323cbb7 --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-fix-relogin-being-triggered-too-fast.patch @@ -0,0 +1,118 @@ +From 4005a995668b8fd58f4cf1460dd4cf63efa18363 Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:45:06 -0800 +Subject: scsi: qla2xxx: Fix Relogin being triggered too fast + +From: Quinn Tran + +commit 4005a995668b8fd58f4cf1460dd4cf63efa18363 upstream. + +Current driver design schedules relogin process via DPC thread every 1 +second. In a large fabric, this DPC thread tries to schedule too many +jobs and might get overloaded. As a result of this processing of DPC +thread, it can schedule relogin earlier than 1 second. + +Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") +Cc: # 4.10+ +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_def.h | 1 + + drivers/scsi/qla2xxx/qla_mid.c | 22 ++++++++++++++-------- + drivers/scsi/qla2xxx/qla_os.c | 22 ++++++++++++++-------- + 3 files changed, 29 insertions(+), 16 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_def.h ++++ b/drivers/scsi/qla2xxx/qla_def.h +@@ -4085,6 +4085,7 @@ typedef struct scsi_qla_host { + #define LOOP_READY 5 + #define LOOP_DEAD 6 + ++ unsigned long relogin_jif; + unsigned long dpc_flags; + #define RESET_MARKER_NEEDED 0 /* Send marker to ISP. */ + #define RESET_ACTIVE 1 +--- a/drivers/scsi/qla2xxx/qla_mid.c ++++ b/drivers/scsi/qla2xxx/qla_mid.c +@@ -343,15 +343,21 @@ qla2x00_do_dpc_vp(scsi_qla_host_t *vha) + "FCPort update end.\n"); + } + +- if ((test_and_clear_bit(RELOGIN_NEEDED, &vha->dpc_flags)) && +- !test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) && +- atomic_read(&vha->loop_state) != LOOP_DOWN) { ++ if (test_bit(RELOGIN_NEEDED, &vha->dpc_flags) && ++ !test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) && ++ atomic_read(&vha->loop_state) != LOOP_DOWN) { + +- ql_dbg(ql_dbg_dpc, vha, 0x4018, +- "Relogin needed scheduled.\n"); +- qla2x00_relogin(vha); +- ql_dbg(ql_dbg_dpc, vha, 0x4019, +- "Relogin needed end.\n"); ++ if (!vha->relogin_jif || ++ time_after_eq(jiffies, vha->relogin_jif)) { ++ vha->relogin_jif = jiffies + HZ; ++ clear_bit(RELOGIN_NEEDED, &vha->dpc_flags); ++ ++ ql_dbg(ql_dbg_dpc, vha, 0x4018, ++ "Relogin needed scheduled.\n"); ++ qla2x00_relogin(vha); ++ ql_dbg(ql_dbg_dpc, vha, 0x4019, ++ "Relogin needed end.\n"); ++ } + } + + if (test_and_clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags) && +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -4860,7 +4860,7 @@ void qla2x00_relogin(struct scsi_qla_hos + */ + if (atomic_read(&fcport->state) != FCS_ONLINE && + fcport->login_retry && !(fcport->flags & FCF_ASYNC_SENT)) { +- fcport->login_retry--; ++ + if (fcport->flags & FCF_FABRIC_DEVICE) { + ql_dbg(ql_dbg_disc, fcport->vha, 0x2108, + "%s %8phC DS %d LS %d\n", __func__, +@@ -4871,6 +4871,7 @@ void qla2x00_relogin(struct scsi_qla_hos + ea.fcport = fcport; + qla2x00_fcport_event_handler(vha, &ea); + } else { ++ fcport->login_retry--; + status = qla2x00_local_device_login(vha, + fcport); + if (status == QLA_SUCCESS) { +@@ -5853,16 +5854,21 @@ qla2x00_do_dpc(void *data) + } + + /* Retry each device up to login retry count */ +- if ((test_and_clear_bit(RELOGIN_NEEDED, +- &base_vha->dpc_flags)) && ++ if (test_bit(RELOGIN_NEEDED, &base_vha->dpc_flags) && + !test_bit(LOOP_RESYNC_NEEDED, &base_vha->dpc_flags) && + atomic_read(&base_vha->loop_state) != LOOP_DOWN) { + +- ql_dbg(ql_dbg_dpc, base_vha, 0x400d, +- "Relogin scheduled.\n"); +- qla2x00_relogin(base_vha); +- ql_dbg(ql_dbg_dpc, base_vha, 0x400e, +- "Relogin end.\n"); ++ if (!base_vha->relogin_jif || ++ time_after_eq(jiffies, base_vha->relogin_jif)) { ++ base_vha->relogin_jif = jiffies + HZ; ++ clear_bit(RELOGIN_NEEDED, &base_vha->dpc_flags); ++ ++ ql_dbg(ql_dbg_dpc, base_vha, 0x400d, ++ "Relogin scheduled.\n"); ++ qla2x00_relogin(base_vha); ++ ql_dbg(ql_dbg_dpc, base_vha, 0x400e, ++ "Relogin end.\n"); ++ } + } + loop_resync_check: + if (test_and_clear_bit(LOOP_RESYNC_NEEDED, diff --git a/queue-4.14/scsi-qla2xxx-fix-scan-state-field-for-fcport.patch b/queue-4.14/scsi-qla2xxx-fix-scan-state-field-for-fcport.patch new file mode 100644 index 00000000000..5e6082730bb --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-fix-scan-state-field-for-fcport.patch @@ -0,0 +1,33 @@ +From 76f9a2dd4c60183879a1898bcd56a1dbab19a85d Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:45:11 -0800 +Subject: scsi: qla2xxx: Fix scan state field for fcport + +From: Quinn Tran + +commit 76f9a2dd4c60183879a1898bcd56a1dbab19a85d upstream. + +Add correct value of scan_state field indicating state of the FC port + +Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") +Cc: # 4.10+ +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_target.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/scsi/qla2xxx/qla_target.c ++++ b/drivers/scsi/qla2xxx/qla_target.c +@@ -5788,6 +5788,7 @@ static fc_port_t *qlt_get_port_database( + tfcp->port_type = fcport->port_type; + tfcp->supported_classes = fcport->supported_classes; + tfcp->flags |= fcport->flags; ++ tfcp->scan_state = QLA_FCPORT_FOUND; + + del = fcport; + fcport = tfcp; diff --git a/queue-4.14/scsi-qla2xxx-fix-system-crash-for-notify-ack-timeout-handling.patch b/queue-4.14/scsi-qla2xxx-fix-system-crash-for-notify-ack-timeout-handling.patch new file mode 100644 index 00000000000..fa9abf7979e --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-fix-system-crash-for-notify-ack-timeout-handling.patch @@ -0,0 +1,35 @@ +From 2e01d0ba868ec1d4d55ddcba519339e072b0bf4d Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:44:56 -0800 +Subject: scsi: qla2xxx: Fix system crash for Notify ack timeout handling + +From: Quinn Tran + +commit 2e01d0ba868ec1d4d55ddcba519339e072b0bf4d upstream. + +Fix NULL pointer crash due to missing timeout handling callback for +Notify Ack IOCB. + +Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") +Cc: # 4.10+ +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_target.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_target.c ++++ b/drivers/scsi/qla2xxx/qla_target.c +@@ -665,7 +665,7 @@ int qla24xx_async_notify_ack(scsi_qla_ho + qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha)+2); + + sp->u.iocb_cmd.u.nack.ntfy = ntfy; +- ++ sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout; + sp->done = qla2x00_async_nack_sp_done; + + rval = qla2x00_start_sp(sp); diff --git a/queue-4.14/scsi-qla2xxx-fix-system-crash-in-qlt_plogi_ack_unref.patch b/queue-4.14/scsi-qla2xxx-fix-system-crash-in-qlt_plogi_ack_unref.patch new file mode 100644 index 00000000000..35ca4ab0cb2 --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-fix-system-crash-in-qlt_plogi_ack_unref.patch @@ -0,0 +1,55 @@ +From 19759033e0d0beed70421ab9258f5ede79e070ae Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:45:15 -0800 +Subject: scsi: qla2xxx: Fix system crash in qlt_plogi_ack_unref + +From: Quinn Tran + +commit 19759033e0d0beed70421ab9258f5ede79e070ae upstream. + +Fix system crash due to NULL pointer access. + +qlt_plogi_ack_t and fc_port structures were not properly bound before +calling qlt_plogi_ack_unref(). + +RIP: 0010:qlt_plogi_ack_unref+0xa1/0x150 [qla2xxx] +Call Trace: +qla24xx_create_new_sess+0xb1/0x320 [qla2xxx] +qla2x00_do_work+0x123/0x260 [qla2xxx] +qla2x00_iocb_work_fn+0x30/0x40 [qla2xxx] +process_one_work+0x1f3/0x530 +worker_thread+0x4e/0x480 +kthread+0x10c/0x140 + +Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") +Cc: # 4.10+ +Signed-off-by: Quinn Tran +Signed-off-by: Giridhar Malavali +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_os.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -4734,11 +4734,11 @@ void qla24xx_create_new_sess(struct scsi + } else { + list_add_tail(&fcport->list, &vha->vp_fcports); + +- if (pla) { +- qlt_plogi_ack_link(vha, pla, fcport, +- QLT_PLOGI_LINK_SAME_WWN); +- pla->ref_count--; +- } ++ } ++ if (pla) { ++ qlt_plogi_ack_link(vha, pla, fcport, ++ QLT_PLOGI_LINK_SAME_WWN); ++ pla->ref_count--; + } + } + spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); diff --git a/queue-4.14/scsi-qla2xxx-move-session-delete-to-driver-work-queue.patch b/queue-4.14/scsi-qla2xxx-move-session-delete-to-driver-work-queue.patch new file mode 100644 index 00000000000..e77c08dc617 --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-move-session-delete-to-driver-work-queue.patch @@ -0,0 +1,52 @@ +From a01c77d2cbc45ba527e884e5c30363a1200a4130 Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:44:58 -0800 +Subject: scsi: qla2xxx: Move session delete to driver work queue + +From: Quinn Tran + +commit a01c77d2cbc45ba527e884e5c30363a1200a4130 upstream. + +Move session delete from system work queue to driver's work queue for in +time processing. + +Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") +Cc: # 4.10+ +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_os.c | 3 ++- + drivers/scsi/qla2xxx/qla_target.c | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -3177,10 +3177,11 @@ qla2x00_probe_one(struct pci_dev *pdev, + host->can_queue, base_vha->req, + base_vha->mgmt_svr_loop_id, host->sg_tablesize); + ++ ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 0); ++ + if (ha->mqenable) { + bool mq = false; + bool startit = false; +- ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 0); + + if (QLA_TGT_MODE_ENABLED()) { + mq = true; +--- a/drivers/scsi/qla2xxx/qla_target.c ++++ b/drivers/scsi/qla2xxx/qla_target.c +@@ -1205,7 +1205,8 @@ void qlt_schedule_sess_for_deletion(stru + ql_dbg(ql_dbg_tgt, sess->vha, 0xe001, + "Scheduling sess %p for deletion\n", sess); + +- schedule_work(&sess->del_work); ++ INIT_WORK(&sess->del_work, qla24xx_delete_sess_fn); ++ queue_work(sess->vha->hw->wq, &sess->del_work); + } + + void qlt_schedule_sess_for_deletion_lock(struct fc_port *sess) diff --git a/queue-4.14/scsi-qla2xxx-remove-aborting-els-iocb-call-issued-as-part-of-timeout.patch b/queue-4.14/scsi-qla2xxx-remove-aborting-els-iocb-call-issued-as-part-of-timeout.patch new file mode 100644 index 00000000000..4b9a9d164a6 --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-remove-aborting-els-iocb-call-issued-as-part-of-timeout.patch @@ -0,0 +1,58 @@ +From bf07ef86e882013522876f7c834c8eea085f35b4 Mon Sep 17 00:00:00 2001 +From: Giridhar Malavali +Date: Mon, 4 Dec 2017 14:45:14 -0800 +Subject: scsi: qla2xxx: Remove aborting ELS IOCB call issued as part of timeout. + +From: Giridhar Malavali + +commit bf07ef86e882013522876f7c834c8eea085f35b4 upstream. + +This fix the spinlock recursion issue seen while unloading the driver. + +14 [ffff9f2e21e03db8] native_queued_spin_lock_slowpath at ffffffffad0d8802 +15 [ffff9f2e21e03dc0] do_raw_spin_lock at ffffffffad0d99e4 +16 [ffff9f2e21e03dd8] _raw_spin_lock_irqsave at ffffffffad652471 +17 [ffff9f2e21e03e00] qla2x00_els_dcmd_iocb_timeout at ffffffffc070cd63 +18 [ffff9f2e21e03e40] qla2x00_sp_timeout at ffffffffc06f06d3 [qla2xxx] +19 [ffff9f2e21e03e68] call_timer_fn at ffffffffad0f97d8 +20 [ffff9f2e21e03ed8] run_timer_softirq at ffffffffad0faf47 +21 [ffff9f2e21e03f68] __softirqentry_text_start at ffffffffad655f32 + +Fixes: 6eb54715b54bb ("qla2xxx: Added interface to send explicit LOGO.") +Cc: # 4.10+ +Signed-off-by: Giridhar Malavali +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_iocb.c | 10 ---------- + 1 file changed, 10 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_iocb.c ++++ b/drivers/scsi/qla2xxx/qla_iocb.c +@@ -2392,7 +2392,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data + srb_t *sp = data; + fc_port_t *fcport = sp->fcport; + struct scsi_qla_host *vha = sp->vha; +- struct qla_hw_data *ha = vha->hw; + struct srb_iocb *lio = &sp->u.iocb_cmd; + + ql_dbg(ql_dbg_io, vha, 0x3069, +@@ -2400,15 +2399,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data + sp->name, sp->handle, fcport->d_id.b.domain, fcport->d_id.b.area, + fcport->d_id.b.al_pa); + +- /* Abort the exchange */ +- if (ha->isp_ops->abort_command(sp)) { +- ql_dbg(ql_dbg_io, vha, 0x3070, +- "mbx abort_command failed.\n"); +- } else { +- ql_dbg(ql_dbg_io, vha, 0x3071, +- "mbx abort_command success.\n"); +- } +- + complete(&lio->u.els_logo.comp); + } + diff --git a/queue-4.14/scsi-qla2xxx-replace-fcport-alloc-with-qla2x00_alloc_fcport.patch b/queue-4.14/scsi-qla2xxx-replace-fcport-alloc-with-qla2x00_alloc_fcport.patch new file mode 100644 index 00000000000..4a70ce94b64 --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-replace-fcport-alloc-with-qla2x00_alloc_fcport.patch @@ -0,0 +1,35 @@ +From 063b36d6b0ad74c748d536f5cb47bac2f850a0fa Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:45:10 -0800 +Subject: scsi: qla2xxx: Replace fcport alloc with qla2x00_alloc_fcport + +From: Quinn Tran + +commit 063b36d6b0ad74c748d536f5cb47bac2f850a0fa upstream. + +Current code manually allocate an fcport structure that is not properly +initialize. Replace kzalloc with qla2x00_alloc_fcport, so that all +fields are initialized. Also set set scan flag to port found + +Cc: +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_target.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_target.c ++++ b/drivers/scsi/qla2xxx/qla_target.c +@@ -5759,7 +5759,7 @@ static fc_port_t *qlt_get_port_database( + unsigned long flags; + u8 newfcport = 0; + +- fcport = kzalloc(sizeof(*fcport), GFP_KERNEL); ++ fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL); + if (!fcport) { + ql_dbg(ql_dbg_tgt_mgt, vha, 0xf06f, + "qla_target(%d): Allocation of tmp FC port failed", diff --git a/queue-4.14/scsi-qla2xxx-retry-switch-command-on-time-out.patch b/queue-4.14/scsi-qla2xxx-retry-switch-command-on-time-out.patch new file mode 100644 index 00000000000..46d5c1bc3b9 --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-retry-switch-command-on-time-out.patch @@ -0,0 +1,87 @@ +From 25ad76b703d9ad536f3411b15b1070aeb059ab55 Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:45:01 -0800 +Subject: scsi: qla2xxx: Retry switch command on time out + +From: Quinn Tran + +commit 25ad76b703d9ad536f3411b15b1070aeb059ab55 upstream. + +Retry GID_PN & GPN_ID switch commands for time out case. + +Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") +Cc: # 4.10+ +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_gs.c | 34 ++++++++++++++++++++++++++-------- + 1 file changed, 26 insertions(+), 8 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_gs.c ++++ b/drivers/scsi/qla2xxx/qla_gs.c +@@ -175,6 +175,9 @@ qla2x00_chk_ms_status(scsi_qla_host_t *v + set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); + } + break; ++ case CS_TIMEOUT: ++ rval = QLA_FUNCTION_TIMEOUT; ++ /* drop through */ + default: + ql_dbg(ql_dbg_disc, vha, 0x2033, + "%s failed, completion status (%x) on port_id: " +@@ -2889,9 +2892,22 @@ static void qla2x00_async_gidpn_sp_done( + ea.rc = res; + ea.event = FCME_GIDPN_DONE; + +- ql_dbg(ql_dbg_disc, vha, 0x204f, +- "Async done-%s res %x, WWPN %8phC ID %3phC \n", +- sp->name, res, fcport->port_name, id); ++ if (res == QLA_FUNCTION_TIMEOUT) { ++ ql_dbg(ql_dbg_disc, sp->vha, 0xffff, ++ "Async done-%s WWPN %8phC timed out.\n", ++ sp->name, fcport->port_name); ++ qla24xx_post_gidpn_work(sp->vha, fcport); ++ sp->free(sp); ++ return; ++ } else if (res) { ++ ql_dbg(ql_dbg_disc, sp->vha, 0xffff, ++ "Async done-%s fail res %x, WWPN %8phC\n", ++ sp->name, res, fcport->port_name); ++ } else { ++ ql_dbg(ql_dbg_disc, vha, 0x204f, ++ "Async done-%s good WWPN %8phC ID %3phC\n", ++ sp->name, fcport->port_name, id); ++ } + + qla2x00_fcport_event_handler(vha, &ea); + +@@ -3217,11 +3233,6 @@ static void qla2x00_async_gpnid_sp_done( + sp->name, ct_req->req.port_id.port_id, + ct_rsp->rsp.gpn_id.port_name); + +- if (res) { +- sp->free(sp); +- return; +- } +- + memset(&ea, 0, sizeof(ea)); + memcpy(ea.port_name, ct_rsp->rsp.gpn_id.port_name, WWN_SIZE); + ea.sp = sp; +@@ -3231,6 +3242,13 @@ static void qla2x00_async_gpnid_sp_done( + ea.rc = res; + ea.event = FCME_GPNID_DONE; + ++ if (res) { ++ if (res == QLA_FUNCTION_TIMEOUT) ++ qla24xx_post_gpnid_work(sp->vha, &ea.id); ++ sp->free(sp); ++ return; ++ } ++ + qla2x00_fcport_event_handler(vha, &ea); + + e = qla2x00_alloc_work(vha, QLA_EVT_GPNID_DONE); diff --git a/queue-4.14/scsi-qla2xxx-serialize-gpnid-for-multiple-rscn.patch b/queue-4.14/scsi-qla2xxx-serialize-gpnid-for-multiple-rscn.patch new file mode 100644 index 00000000000..792dc2dc8f5 --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-serialize-gpnid-for-multiple-rscn.patch @@ -0,0 +1,211 @@ +From 2d73ac6102d943c4be4945735a338005359c6abc Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:45:02 -0800 +Subject: scsi: qla2xxx: Serialize GPNID for multiple RSCN + +From: Quinn Tran + +commit 2d73ac6102d943c4be4945735a338005359c6abc upstream. + +GPNID is triggered by RSCN. For multiple RSCNs of the same affected +NPORT ID, serialize the GPNID to prevent confusion. + +Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") +Cc: # 4.10+ +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_def.h | 48 ++++++++++++++++++++++------------------- + drivers/scsi/qla2xxx/qla_gs.c | 35 +++++++++++++++++++++++++---- + drivers/scsi/qla2xxx/qla_isr.c | 2 - + drivers/scsi/qla2xxx/qla_os.c | 1 + 4 files changed, 58 insertions(+), 28 deletions(-) + +--- a/drivers/scsi/qla2xxx/qla_def.h ++++ b/drivers/scsi/qla2xxx/qla_def.h +@@ -315,6 +315,29 @@ struct srb_cmd { + /* To identify if a srb is of T10-CRC type. @sp => srb_t pointer */ + #define IS_PROT_IO(sp) (sp->flags & SRB_CRC_CTX_DSD_VALID) + ++/* ++ * 24 bit port ID type definition. ++ */ ++typedef union { ++ uint32_t b24 : 24; ++ ++ struct { ++#ifdef __BIG_ENDIAN ++ uint8_t domain; ++ uint8_t area; ++ uint8_t al_pa; ++#elif defined(__LITTLE_ENDIAN) ++ uint8_t al_pa; ++ uint8_t area; ++ uint8_t domain; ++#else ++#error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined!" ++#endif ++ uint8_t rsvd_1; ++ } b; ++} port_id_t; ++#define INVALID_PORT_ID 0xFFFFFF ++ + struct els_logo_payload { + uint8_t opcode; + uint8_t rsvd[3]; +@@ -332,6 +355,7 @@ struct ct_arg { + u32 rsp_size; + void *req; + void *rsp; ++ port_id_t id; + }; + + /* +@@ -480,6 +504,7 @@ typedef struct srb { + const char *name; + int iocbs; + struct qla_qpair *qpair; ++ struct list_head elem; + u32 gen1; /* scratch */ + u32 gen2; /* scratch */ + union { +@@ -2144,28 +2169,6 @@ struct imm_ntfy_from_isp { + #define REQUEST_ENTRY_SIZE (sizeof(request_t)) + + +-/* +- * 24 bit port ID type definition. +- */ +-typedef union { +- uint32_t b24 : 24; +- +- struct { +-#ifdef __BIG_ENDIAN +- uint8_t domain; +- uint8_t area; +- uint8_t al_pa; +-#elif defined(__LITTLE_ENDIAN) +- uint8_t al_pa; +- uint8_t area; +- uint8_t domain; +-#else +-#error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined!" +-#endif +- uint8_t rsvd_1; +- } b; +-} port_id_t; +-#define INVALID_PORT_ID 0xFFFFFF + + /* + * Switch info gathering structure. +@@ -4223,6 +4226,7 @@ typedef struct scsi_qla_host { + wait_queue_head_t fcport_waitQ; + wait_queue_head_t vref_waitq; + uint8_t min_link_speed_feat; ++ struct list_head gpnid_list; + } scsi_qla_host_t; + + struct qla27xx_image_status { +--- a/drivers/scsi/qla2xxx/qla_gs.c ++++ b/drivers/scsi/qla2xxx/qla_gs.c +@@ -3221,16 +3221,17 @@ static void qla2x00_async_gpnid_sp_done( + (struct ct_sns_rsp *)sp->u.iocb_cmd.u.ctarg.rsp; + struct event_arg ea; + struct qla_work_evt *e; ++ unsigned long flags; + + if (res) + ql_dbg(ql_dbg_disc, vha, 0x2066, +- "Async done-%s fail res %x ID %3phC. %8phC\n", +- sp->name, res, ct_req->req.port_id.port_id, ++ "Async done-%s fail res %x rscn gen %d ID %3phC. %8phC\n", ++ sp->name, res, sp->gen1, ct_req->req.port_id.port_id, + ct_rsp->rsp.gpn_id.port_name); + else + ql_dbg(ql_dbg_disc, vha, 0x2066, +- "Async done-%s good ID %3phC. %8phC\n", +- sp->name, ct_req->req.port_id.port_id, ++ "Async done-%s good rscn gen %d ID %3phC. %8phC\n", ++ sp->name, sp->gen1, ct_req->req.port_id.port_id, + ct_rsp->rsp.gpn_id.port_name); + + memset(&ea, 0, sizeof(ea)); +@@ -3242,11 +3243,20 @@ static void qla2x00_async_gpnid_sp_done( + ea.rc = res; + ea.event = FCME_GPNID_DONE; + ++ spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); ++ list_del(&sp->elem); ++ spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); ++ + if (res) { + if (res == QLA_FUNCTION_TIMEOUT) + qla24xx_post_gpnid_work(sp->vha, &ea.id); + sp->free(sp); + return; ++ } else if (sp->gen1) { ++ /* There was anoter RSNC for this Nport ID */ ++ qla24xx_post_gpnid_work(sp->vha, &ea.id); ++ sp->free(sp); ++ return; + } + + qla2x00_fcport_event_handler(vha, &ea); +@@ -3282,8 +3292,9 @@ int qla24xx_async_gpnid(scsi_qla_host_t + { + int rval = QLA_FUNCTION_FAILED; + struct ct_sns_req *ct_req; +- srb_t *sp; ++ srb_t *sp, *tsp; + struct ct_sns_pkt *ct_sns; ++ unsigned long flags; + + if (!vha->flags.online) + goto done; +@@ -3294,8 +3305,22 @@ int qla24xx_async_gpnid(scsi_qla_host_t + + sp->type = SRB_CT_PTHRU_CMD; + sp->name = "gpnid"; ++ sp->u.iocb_cmd.u.ctarg.id = *id; ++ sp->gen1 = 0; + qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2); + ++ spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); ++ list_for_each_entry(tsp, &vha->gpnid_list, elem) { ++ if (tsp->u.iocb_cmd.u.ctarg.id.b24 == id->b24) { ++ tsp->gen1++; ++ spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); ++ sp->free(sp); ++ goto done; ++ } ++ } ++ list_add_tail(&sp->elem, &vha->gpnid_list); ++ spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); ++ + sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev, + sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma, + GFP_KERNEL); +--- a/drivers/scsi/qla2xxx/qla_isr.c ++++ b/drivers/scsi/qla2xxx/qla_isr.c +@@ -1569,7 +1569,7 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vh + /* borrowing sts_entry_24xx.comp_status. + same location as ct_entry_24xx.comp_status + */ +- res = qla2x00_chk_ms_status(vha, (ms_iocb_entry_t *)pkt, ++ res = qla2x00_chk_ms_status(sp->vha, (ms_iocb_entry_t *)pkt, + (struct ct_sns_rsp *)sp->u.iocb_cmd.u.ctarg.rsp, + sp->name); + sp->done(sp, res); +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -4499,6 +4499,7 @@ struct scsi_qla_host *qla2x00_create_hos + INIT_LIST_HEAD(&vha->qp_list); + INIT_LIST_HEAD(&vha->gnl.fcports); + INIT_LIST_HEAD(&vha->nvme_rport_list); ++ INIT_LIST_HEAD(&vha->gpnid_list); + + spin_lock_init(&vha->work_lock); + spin_lock_init(&vha->cmd_list_lock); diff --git a/queue-4.14/scsi-qla2xxx-skip-irq-affinity-for-target-qpairs.patch b/queue-4.14/scsi-qla2xxx-skip-irq-affinity-for-target-qpairs.patch new file mode 100644 index 00000000000..908f56063ae --- /dev/null +++ b/queue-4.14/scsi-qla2xxx-skip-irq-affinity-for-target-qpairs.patch @@ -0,0 +1,43 @@ +From d68b850e1bfb9afb24b888a946165a186a710195 Mon Sep 17 00:00:00 2001 +From: Quinn Tran +Date: Mon, 4 Dec 2017 14:44:59 -0800 +Subject: scsi: qla2xxx: Skip IRQ affinity for Target QPairs + +From: Quinn Tran + +commit d68b850e1bfb9afb24b888a946165a186a710195 upstream. + +Fix co-existence between Block MQ and Target Mode. Block MQ and +initiator mode requires midlayer queue mapping to check for IRQ to be +affinitized. For target mode, it's not the case. + +Fixes: 09620eeb62c41 ("scsi: qla2xxx: Add debug knob for user control workload") +Cc: # 4.12+ +Signed-off-by: Quinn Tran +Signed-off-by: Himanshu Madhani +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/qla2xxx/qla_os.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/qla2xxx/qla_os.c ++++ b/drivers/scsi/qla2xxx/qla_os.c +@@ -6592,9 +6592,14 @@ qla83xx_disable_laser(scsi_qla_host_t *v + + static int qla2xxx_map_queues(struct Scsi_Host *shost) + { ++ int rc; + scsi_qla_host_t *vha = (scsi_qla_host_t *)shost->hostdata; + +- return blk_mq_pci_map_queues(&shost->tag_set, vha->hw->pdev); ++ if (USER_CTRL_IRQ(vha->hw)) ++ rc = blk_mq_map_queues(&shost->tag_set); ++ else ++ rc = blk_mq_pci_map_queues(&shost->tag_set, vha->hw->pdev); ++ return rc; + } + + static const struct pci_error_handlers qla2xxx_err_handler = { diff --git a/queue-4.14/series b/queue-4.14/series index 296fad82e64..51d96237f7c 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -21,6 +21,28 @@ tpm-keep-clkrun-enabled-throughout-the-duration-of-transmit_cmd.patch tpm-delete-the-tpm_tis_clk_enable-flag.patch tpm-remove-unused-variables.patch tpm-only-attempt-to-disable-the-lpc-clkrun-if-is-already-enabled.patch +scsi-qla2xxx-fix-system-crash-for-notify-ack-timeout-handling.patch +scsi-qla2xxx-fix-gpnid-error-processing.patch +scsi-qla2xxx-move-session-delete-to-driver-work-queue.patch +scsi-qla2xxx-skip-irq-affinity-for-target-qpairs.patch +scsi-qla2xxx-fix-re-login-for-nport-handle-in-use.patch +scsi-qla2xxx-retry-switch-command-on-time-out.patch +scsi-qla2xxx-serialize-gpnid-for-multiple-rscn.patch +scsi-qla2xxx-fix-login-state-machine-stuck-at-gpdb.patch +scsi-qla2xxx-fix-npiv-host-cleanup-in-target-mode.patch +scsi-qla2xxx-fix-relogin-being-triggered-too-fast.patch +scsi-qla2xxx-fix-prli-state-check.patch +scsi-qla2xxx-fix-abort-command-deadlock-due-to-spinlock.patch +scsi-qla2xxx-replace-fcport-alloc-with-qla2x00_alloc_fcport.patch +scsi-qla2xxx-fix-scan-state-field-for-fcport.patch +scsi-qla2xxx-clear-loop-id-after-delete.patch +scsi-qla2xxx-defer-processing-of-gs-iocb-calls.patch +scsi-qla2xxx-remove-aborting-els-iocb-call-issued-as-part-of-timeout.patch +scsi-qla2xxx-fix-system-crash-in-qlt_plogi_ack_unref.patch +scsi-qla2xxx-fix-memory-leak-in-dual-target-mode.patch +nfs-fix-an-incorrect-type-in-struct-nfs_direct_req.patch +pnfs-prevent-the-layout-header-refcount-going-to-zero-in-pnfs_roc.patch +nfs-fix-unstable-write-completion.patch rdma-ucma-limit-possible-option-size.patch rdma-ucma-check-that-user-doesn-t-overflow-qp-state.patch rdma-mlx5-fix-integer-overflow-while-resizing-cq.patch