Commit 6d1368e8 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen
Browse files

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: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarSaurav Kashyap <skashyap@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 4262d35c
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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);
}