Commit ee3dce9f authored by Dmitry Bogdanov's avatar Dmitry Bogdanov Committed by Martin K. Petersen
Browse files

scsi: efct: Fix nport free

nport_free for an empty nport hangs the state machine waiting for mbox
completion if nport is not yet attached thinking that it is attaching right
now.  Add a check for nport attaching state and complete nport free.

Link: https://lore.kernel.org/r/20210914105539.6942-3-d.bogdanov@yadro.com


Reviewed-by: default avatarRam Vegesna <ram.vegesna@broadcom.com>
Signed-off-by: default avatarDmitry Bogdanov <d.bogdanov@yadro.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 8d4efd00
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -249,6 +249,7 @@ efc_nport_attach_reg_vpi_cb(struct efc *efc, int status, u8 *mqe,
{
	struct efc_nport *nport = arg;

	nport->attaching = false;
	if (efc_nport_get_mbox_status(nport, mqe, status)) {
		efc_nport_free_resources(nport, EFC_EVT_NPORT_ATTACH_FAIL, mqe);
		return -EIO;
@@ -286,6 +287,8 @@ efc_cmd_nport_attach(struct efc *efc, struct efc_nport *nport, u32 fc_id)
	if (rc) {
		efc_log_err(efc, "REG_VPI command failure\n");
		efc_nport_free_resources(nport, EFC_EVT_NPORT_ATTACH_FAIL, buf);
	} else {
		nport->attaching = true;
	}

	return rc;
@@ -302,8 +305,10 @@ efc_cmd_nport_free(struct efc *efc, struct efc_nport *nport)
	/* Issue the UNREG_VPI command to free the assigned VPI context */
	if (nport->attached)
		efc_nport_free_unreg_vpi(nport);
	else
	else if (nport->attaching)
		nport->free_req_pending = true;
	else
		efc_sm_post_event(&nport->sm, EFC_EVT_NPORT_FREE_OK, NULL);

	return 0;
}
+1 −0
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@ struct efc_nport {
	bool			is_vport;
	bool			free_req_pending;
	bool			attached;
	bool			attaching;
	bool			p2p_winner;
	struct efc_domain	*domain;
	u64			wwpn;