summaryrefslogtreecommitdiff
path: root/drivers/scsi/qedf
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.com>2019-03-26 00:38:44 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2019-03-27 21:54:52 -0400
commit6d1368e8f987dd4bb1be6506d5416cb90b4ecf7a (patch)
treea25cc9c300b8ef1162cce297a4deffbfe3002482 /drivers/scsi/qedf
parent4262d35c32c652344b6784cad51ec5a0e2e5258b (diff)
scsi: qedf: fixup locking in qedf_restart_rport()
fc_rport_create() needs to be called with disc_mutex held. And we should re-assign the 'rdata' pointer in case it got changed. Signed-off-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Saurav Kashyap <skashyap@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/qedf')
-rw-r--r--drivers/scsi/qedf/qedf_els.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c
index ac2bfc26bcdb..aad1f7c464fd 100644
--- a/drivers/scsi/qedf/qedf_els.c
+++ b/drivers/scsi/qedf/qedf_els.c
@@ -380,10 +380,16 @@ void qedf_restart_rport(struct qedf_rport *fcport)
QEDF_ERR(&(fcport->qedf->dbg_ctx),
"LOGO port_id=%x.\n", port_id);
fc_rport_logoff(rdata);
+ mutex_lock(&lport->disc.disc_mutex);
/* Recreate the rport and log back in */
rdata = fc_rport_create(lport, port_id);
- if (rdata)
+ if (rdata) {
+ mutex_unlock(&lport->disc.disc_mutex);
fc_rport_login(rdata);
+ fcport->rdata = rdata;
+ } else {
+ mutex_unlock(&lport->disc.disc_mutex);
+ }
}
clear_bit(QEDF_RPORT_IN_RESET, &fcport->flags);
}