Commit cdf54668 authored by Bhanu Prakash Gollapudi's avatar Bhanu Prakash Gollapudi Committed by James Bottomley

[SCSI] bnx2fc: Do not attempt destroying NPIV port twice

When NPIV ports are created/deleted rapidly there is a race condition between
bnx2fc_vport_destroy() from sysfs and bnx2fc_flogi_resp(), which could try to
delete the NPIV port from the list twice. Fix is to loop through the list of
NPIV ports to find a match, and only when it exists remove it.
Signed-off-by: default avatarBhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent b65d4579
...@@ -1028,8 +1028,20 @@ static int bnx2fc_vport_destroy(struct fc_vport *vport) ...@@ -1028,8 +1028,20 @@ static int bnx2fc_vport_destroy(struct fc_vport *vport)
struct fc_lport *n_port = shost_priv(shost); struct fc_lport *n_port = shost_priv(shost);
struct fc_lport *vn_port = vport->dd_data; struct fc_lport *vn_port = vport->dd_data;
struct fcoe_port *port = lport_priv(vn_port); struct fcoe_port *port = lport_priv(vn_port);
struct fc_lport *v_port;
bool found = false;
mutex_lock(&n_port->lp_mutex); mutex_lock(&n_port->lp_mutex);
list_for_each_entry(v_port, &n_port->vports, list)
if (v_port->vport == vport) {
found = true;
break;
}
if (!found) {
mutex_unlock(&n_port->lp_mutex);
return -ENOENT;
}
list_del(&vn_port->list); list_del(&vn_port->list);
mutex_unlock(&n_port->lp_mutex); mutex_unlock(&n_port->lp_mutex);
queue_work(bnx2fc_wq, &port->destroy_work); queue_work(bnx2fc_wq, &port->destroy_work);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment