diff options
author | Bhanu Prakash Gollapudi <bprakash@broadcom.com> | 2011-08-04 20:38:39 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-08-27 10:35:30 -0400 |
commit | cdf54668bc48193e43adc8f75ce419ce0ce50fc0 (patch) | |
tree | d15e76c2f1ce2bddabb92799791920acb86d6e2a /drivers/scsi/bnx2fc/bnx2fc_fcoe.c | |
parent | b65d457913d1c0644394287d5d834373f42fb99a (diff) |
[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: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bnx2fc/bnx2fc_fcoe.c')
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index 9e2bf398ff91..21792e7eaeb2 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c | |||
@@ -1028,8 +1028,20 @@ static int bnx2fc_vport_destroy(struct fc_vport *vport) | |||
1028 | struct fc_lport *n_port = shost_priv(shost); | 1028 | struct fc_lport *n_port = shost_priv(shost); |
1029 | struct fc_lport *vn_port = vport->dd_data; | 1029 | struct fc_lport *vn_port = vport->dd_data; |
1030 | struct fcoe_port *port = lport_priv(vn_port); | 1030 | struct fcoe_port *port = lport_priv(vn_port); |
1031 | struct fc_lport *v_port; | ||
1032 | bool found = false; | ||
1031 | 1033 | ||
1032 | mutex_lock(&n_port->lp_mutex); | 1034 | mutex_lock(&n_port->lp_mutex); |
1035 | list_for_each_entry(v_port, &n_port->vports, list) | ||
1036 | if (v_port->vport == vport) { | ||
1037 | found = true; | ||
1038 | break; | ||
1039 | } | ||
1040 | |||
1041 | if (!found) { | ||
1042 | mutex_unlock(&n_port->lp_mutex); | ||
1043 | return -ENOENT; | ||
1044 | } | ||
1033 | list_del(&vn_port->list); | 1045 | list_del(&vn_port->list); |
1034 | mutex_unlock(&n_port->lp_mutex); | 1046 | mutex_unlock(&n_port->lp_mutex); |
1035 | queue_work(bnx2fc_wq, &port->destroy_work); | 1047 | queue_work(bnx2fc_wq, &port->destroy_work); |