diff options
Diffstat (limited to 'drivers/scsi/fcoe/fcoe_transport.c')
-rw-r--r-- | drivers/scsi/fcoe/fcoe_transport.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c index 7b61d00f5c43..ec0f395263c5 100644 --- a/drivers/scsi/fcoe/fcoe_transport.c +++ b/drivers/scsi/fcoe/fcoe_transport.c | |||
@@ -343,6 +343,7 @@ EXPORT_SYMBOL(fcoe_transport_attach); | |||
343 | int fcoe_transport_detach(struct fcoe_transport *ft) | 343 | int fcoe_transport_detach(struct fcoe_transport *ft) |
344 | { | 344 | { |
345 | int rc = 0; | 345 | int rc = 0; |
346 | struct fcoe_netdev_mapping *nm = NULL, *tmp; | ||
346 | 347 | ||
347 | mutex_lock(&ft_mutex); | 348 | mutex_lock(&ft_mutex); |
348 | if (!ft->attached) { | 349 | if (!ft->attached) { |
@@ -352,6 +353,19 @@ int fcoe_transport_detach(struct fcoe_transport *ft) | |||
352 | goto out_attach; | 353 | goto out_attach; |
353 | } | 354 | } |
354 | 355 | ||
356 | /* remove netdev mapping for this transport as it is going away */ | ||
357 | mutex_lock(&fn_mutex); | ||
358 | list_for_each_entry_safe(nm, tmp, &fcoe_netdevs, list) { | ||
359 | if (nm->ft == ft) { | ||
360 | LIBFCOE_TRANSPORT_DBG("transport %s going away, " | ||
361 | "remove its netdev mapping for %s\n", | ||
362 | ft->name, nm->netdev->name); | ||
363 | list_del(&nm->list); | ||
364 | kfree(nm); | ||
365 | } | ||
366 | } | ||
367 | mutex_unlock(&fn_mutex); | ||
368 | |||
355 | list_del(&ft->list); | 369 | list_del(&ft->list); |
356 | ft->attached = false; | 370 | ft->attached = false; |
357 | LIBFCOE_TRANSPORT_DBG("detaching transport %s\n", ft->name); | 371 | LIBFCOE_TRANSPORT_DBG("detaching transport %s\n", ft->name); |