diff mbox series

[5/7] qla2xxx: fix crash on session cleanup with unload

Message ID 20200928055023.3950-6-njavali@marvell.com
State Superseded
Headers show
Series qla2xxx bug fixes | expand

Commit Message

Nilesh Javali Sept. 28, 2020, 5:50 a.m. UTC
From: Quinn Tran <qutran@marvell.com>

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

Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
---
 drivers/scsi/qla2xxx/qla_target.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Himanshu Madhani Sept. 28, 2020, 9:04 p.m. UTC | #1
On 9/28/20 12:50 AM, Nilesh Javali wrote:
> From: Quinn Tran <qutran@marvell.com>

> 

> On unload, session cleanup prematurely gave the signal for driver

> unload path to advance.

> 

> Signed-off-by: Quinn Tran <qutran@marvell.com>

> Signed-off-by: Nilesh Javali <njavali@marvell.com>

> ---

>   drivers/scsi/qla2xxx/qla_target.c | 13 +++++++------

>   1 file changed, 7 insertions(+), 6 deletions(-)

> 

> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c

> index 7711f95033c0..2a0d3c85766a 100644

> --- a/drivers/scsi/qla2xxx/qla_target.c

> +++ b/drivers/scsi/qla2xxx/qla_target.c

> @@ -1231,14 +1231,15 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess)

>   	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:

>   		/*q

> 


This needs to go to stable as well.

Please add

Fixes: 726b85487067d  ("qla2xxx: Add framework for async fabric discovery")

otherwise looks good

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>


-- 
Himanshu Madhani                         Oracle Linux Engineering
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 7711f95033c0..2a0d3c85766a 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1231,14 +1231,15 @@  void qlt_schedule_sess_for_deletion(struct fc_port *sess)
 	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:
 		/*