From: Quinn Tran <qut...@marvell.com>

commit 50457dab670f396557e60c07f086358460876353 upstream.

On unload, session cleanup prematurely gave the signal for driver unload
path to advance.

Link: https://lore.kernel.org/r/20200929102152.32278-6-njav...@marvell.com
Fixes: 726b85487067 ("qla2xxx: Add framework for async fabric discovery")
Cc: sta...@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madh...@oracle.com>
Signed-off-by: Quinn Tran <qut...@marvell.com>
Signed-off-by: Nilesh Javali <njav...@marvell.com>
Signed-off-by: Martin K. Petersen <martin.peter...@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>

---
 drivers/scsi/qla2xxx/qla_target.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1230,14 +1230,15 @@ void qlt_schedule_sess_for_deletion(stru
        case DSC_DELETE_PEND:
                return;
        case DSC_DELETED:
-               if (tgt && tgt->tgt_stop && (tgt->sess_count == 0))
-                       wake_up_all(&tgt->waitQ);
-               if (sess->vha->fcport_count == 0)
-                       wake_up_all(&sess->vha->fcport_waitQ);
-
                if (!sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN] &&
-                       !sess->plogi_link[QLT_PLOGI_LINK_CONFLICT])
+                       !sess->plogi_link[QLT_PLOGI_LINK_CONFLICT]) {
+                       if (tgt && tgt->tgt_stop && tgt->sess_count == 0)
+                               wake_up_all(&tgt->waitQ);
+
+                       if (sess->vha->fcport_count == 0)
+                               wake_up_all(&sess->vha->fcport_waitQ);
                        return;
+               }
                break;
        case DSC_UPD_FCPORT:
                /*


Reply via email to