diff options
-rw-r--r-- | drivers/scsi/libfc/fc_disc.c | 8 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_lport.c | 14 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_rport.c | 11 |
3 files changed, 15 insertions, 18 deletions
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c index 8427396909e8..e6b13bfecf73 100644 --- a/drivers/scsi/libfc/fc_disc.c +++ b/drivers/scsi/libfc/fc_disc.c | |||
@@ -115,9 +115,6 @@ static void fc_disc_rport_callback(struct fc_lport *lport, | |||
115 | case RPORT_EV_LOGO: | 115 | case RPORT_EV_LOGO: |
116 | case RPORT_EV_FAILED: | 116 | case RPORT_EV_FAILED: |
117 | case RPORT_EV_STOP: | 117 | case RPORT_EV_STOP: |
118 | mutex_lock(&disc->disc_mutex); | ||
119 | list_del(&rdata->peers); | ||
120 | mutex_unlock(&disc->disc_mutex); | ||
121 | break; | 118 | break; |
122 | default: | 119 | default: |
123 | break; | 120 | break; |
@@ -385,9 +382,6 @@ static int fc_disc_new_target(struct fc_disc *disc, | |||
385 | rdata = lport->tt.rport_create(lport, ids); | 382 | rdata = lport->tt.rport_create(lport, ids); |
386 | if (!rdata) | 383 | if (!rdata) |
387 | error = -ENOMEM; | 384 | error = -ENOMEM; |
388 | else | ||
389 | list_add_tail(&rdata->peers, | ||
390 | &disc->rports); | ||
391 | } | 385 | } |
392 | } | 386 | } |
393 | if (rdata) { | 387 | if (rdata) { |
@@ -562,7 +556,6 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len) | |||
562 | rdata = lport->tt.rport_create(lport, &ids); | 556 | rdata = lport->tt.rport_create(lport, &ids); |
563 | if (rdata) { | 557 | if (rdata) { |
564 | rdata->ops = &fc_disc_rport_ops; | 558 | rdata->ops = &fc_disc_rport_ops; |
565 | list_add_tail(&rdata->peers, &disc->rports); | ||
566 | lport->tt.rport_login(rdata); | 559 | lport->tt.rport_login(rdata); |
567 | } else | 560 | } else |
568 | printk(KERN_WARNING "libfc: Failed to allocate " | 561 | printk(KERN_WARNING "libfc: Failed to allocate " |
@@ -709,7 +702,6 @@ static void fc_disc_single(struct fc_disc *disc, struct fc_disc_port *dp) | |||
709 | if (rdata) { | 702 | if (rdata) { |
710 | rdata->ops = &fc_disc_rport_ops; | 703 | rdata->ops = &fc_disc_rport_ops; |
711 | kfree(dp); | 704 | kfree(dp); |
712 | list_add_tail(&rdata->peers, &disc->rports); | ||
713 | lport->tt.rport_login(rdata); | 705 | lport->tt.rport_login(rdata); |
714 | } | 706 | } |
715 | return; | 707 | return; |
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index 22c0f7bc004f..f33e5732e3fc 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
@@ -205,12 +205,11 @@ static void fc_lport_ptp_setup(struct fc_lport *lport, | |||
205 | ids.node_name = remote_wwnn; | 205 | ids.node_name = remote_wwnn; |
206 | ids.roles = FC_RPORT_ROLE_UNKNOWN; | 206 | ids.roles = FC_RPORT_ROLE_UNKNOWN; |
207 | 207 | ||
208 | if (lport->ptp_rp) { | 208 | mutex_lock(&lport->disc.disc_mutex); |
209 | if (lport->ptp_rp) | ||
209 | lport->tt.rport_logoff(lport->ptp_rp); | 210 | lport->tt.rport_logoff(lport->ptp_rp); |
210 | lport->ptp_rp = NULL; | ||
211 | } | ||
212 | |||
213 | lport->ptp_rp = lport->tt.rport_create(lport, &ids); | 211 | lport->ptp_rp = lport->tt.rport_create(lport, &ids); |
212 | mutex_unlock(&lport->disc.disc_mutex); | ||
214 | 213 | ||
215 | lport->tt.rport_login(lport->ptp_rp); | 214 | lport->tt.rport_login(lport->ptp_rp); |
216 | 215 | ||
@@ -931,10 +930,7 @@ static void fc_lport_reset_locked(struct fc_lport *lport) | |||
931 | if (lport->dns_rp) | 930 | if (lport->dns_rp) |
932 | lport->tt.rport_logoff(lport->dns_rp); | 931 | lport->tt.rport_logoff(lport->dns_rp); |
933 | 932 | ||
934 | if (lport->ptp_rp) { | 933 | lport->ptp_rp = NULL; |
935 | lport->tt.rport_logoff(lport->ptp_rp); | ||
936 | lport->ptp_rp = NULL; | ||
937 | } | ||
938 | 934 | ||
939 | lport->tt.disc_stop(lport); | 935 | lport->tt.disc_stop(lport); |
940 | 936 | ||
@@ -1304,7 +1300,9 @@ static void fc_lport_enter_dns(struct fc_lport *lport) | |||
1304 | 1300 | ||
1305 | fc_lport_state_enter(lport, LPORT_ST_DNS); | 1301 | fc_lport_state_enter(lport, LPORT_ST_DNS); |
1306 | 1302 | ||
1303 | mutex_lock(&lport->disc.disc_mutex); | ||
1307 | rdata = lport->tt.rport_create(lport, &ids); | 1304 | rdata = lport->tt.rport_create(lport, &ids); |
1305 | mutex_unlock(&lport->disc.disc_mutex); | ||
1308 | if (!rdata) | 1306 | if (!rdata) |
1309 | goto err; | 1307 | goto err; |
1310 | 1308 | ||
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index 6ecf36d4708c..a9087b31bce9 100644 --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c | |||
@@ -91,8 +91,7 @@ static const char *fc_rport_state_names[] = { | |||
91 | * @lport: local port. | 91 | * @lport: local port. |
92 | * @ids: remote port identifiers. | 92 | * @ids: remote port identifiers. |
93 | * | 93 | * |
94 | * Locking note: this may be called without locks held, but | 94 | * Locking note: must be called with the disc_mutex held. |
95 | * is usually called from discovery with the disc_mutex held. | ||
96 | */ | 95 | */ |
97 | static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, | 96 | static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, |
98 | struct fc_rport_identifiers *ids) | 97 | struct fc_rport_identifiers *ids) |
@@ -115,6 +114,8 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, | |||
115 | rdata->maxframe_size = FC_MIN_MAX_PAYLOAD; | 114 | rdata->maxframe_size = FC_MIN_MAX_PAYLOAD; |
116 | INIT_DELAYED_WORK(&rdata->retry_work, fc_rport_timeout); | 115 | INIT_DELAYED_WORK(&rdata->retry_work, fc_rport_timeout); |
117 | INIT_WORK(&rdata->event_work, fc_rport_work); | 116 | INIT_WORK(&rdata->event_work, fc_rport_work); |
117 | if (ids->port_id != FC_FID_DIR_SERV) | ||
118 | list_add(&rdata->peers, &lport->disc.rports); | ||
118 | return rdata; | 119 | return rdata; |
119 | } | 120 | } |
120 | 121 | ||
@@ -258,6 +259,12 @@ static void fc_rport_work(struct work_struct *work) | |||
258 | port_id = rdata->ids.port_id; | 259 | port_id = rdata->ids.port_id; |
259 | mutex_unlock(&rdata->rp_mutex); | 260 | mutex_unlock(&rdata->rp_mutex); |
260 | 261 | ||
262 | if (port_id != FC_FID_DIR_SERV) { | ||
263 | mutex_lock(&lport->disc.disc_mutex); | ||
264 | list_del(&rdata->peers); | ||
265 | mutex_unlock(&lport->disc.disc_mutex); | ||
266 | } | ||
267 | |||
261 | if (rport_ops->event_callback) { | 268 | if (rport_ops->event_callback) { |
262 | FC_RPORT_DBG(rdata, "callback ev %d\n", event); | 269 | FC_RPORT_DBG(rdata, "callback ev %d\n", event); |
263 | rport_ops->event_callback(lport, rdata, event); | 270 | rport_ops->event_callback(lport, rdata, event); |