diff options
author | Denis V. Lunev <den@openvz.org> | 2008-01-28 17:41:19 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:08:07 -0500 |
commit | b7c6ba6eb1234e35a74fb8ba8123232a7b1ba9e4 (patch) | |
tree | 672c08c95229a6ac242ab12a5195dceddb0f3127 /drivers | |
parent | 4f84d82f7a623f8641af2574425c329431ff158f (diff) |
[NETNS]: Consolidate kernel netlink socket destruction.
Create a specific helper for netlink kernel socket disposal. This just
let the code look better and provides a ground for proper disposal
inside a namespace.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Tested-by: Alexey Dobriyan <adobriyan@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/connector/connector.c | 9 | ||||
-rw-r--r-- | drivers/scsi/scsi_netlink.c | 2 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 4 |
3 files changed, 6 insertions, 9 deletions
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 37976dcf044b..fea2d3ed9cbd 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -420,8 +420,7 @@ static int __devinit cn_init(void) | |||
420 | 420 | ||
421 | dev->cbdev = cn_queue_alloc_dev("cqueue", dev->nls); | 421 | dev->cbdev = cn_queue_alloc_dev("cqueue", dev->nls); |
422 | if (!dev->cbdev) { | 422 | if (!dev->cbdev) { |
423 | if (dev->nls->sk_socket) | 423 | netlink_kernel_release(dev->nls); |
424 | sock_release(dev->nls->sk_socket); | ||
425 | return -EINVAL; | 424 | return -EINVAL; |
426 | } | 425 | } |
427 | 426 | ||
@@ -431,8 +430,7 @@ static int __devinit cn_init(void) | |||
431 | if (err) { | 430 | if (err) { |
432 | cn_already_initialized = 0; | 431 | cn_already_initialized = 0; |
433 | cn_queue_free_dev(dev->cbdev); | 432 | cn_queue_free_dev(dev->cbdev); |
434 | if (dev->nls->sk_socket) | 433 | netlink_kernel_release(dev->nls); |
435 | sock_release(dev->nls->sk_socket); | ||
436 | return -EINVAL; | 434 | return -EINVAL; |
437 | } | 435 | } |
438 | 436 | ||
@@ -447,8 +445,7 @@ static void __devexit cn_fini(void) | |||
447 | 445 | ||
448 | cn_del_callback(&dev->id); | 446 | cn_del_callback(&dev->id); |
449 | cn_queue_free_dev(dev->cbdev); | 447 | cn_queue_free_dev(dev->cbdev); |
450 | if (dev->nls->sk_socket) | 448 | netlink_kernel_release(dev->nls); |
451 | sock_release(dev->nls->sk_socket); | ||
452 | } | 449 | } |
453 | 450 | ||
454 | subsys_initcall(cn_init); | 451 | subsys_initcall(cn_init); |
diff --git a/drivers/scsi/scsi_netlink.c b/drivers/scsi/scsi_netlink.c index 3e1591828171..370c78cc1cb5 100644 --- a/drivers/scsi/scsi_netlink.c +++ b/drivers/scsi/scsi_netlink.c | |||
@@ -164,7 +164,7 @@ void | |||
164 | scsi_netlink_exit(void) | 164 | scsi_netlink_exit(void) |
165 | { | 165 | { |
166 | if (scsi_nl_sock) { | 166 | if (scsi_nl_sock) { |
167 | sock_release(scsi_nl_sock->sk_socket); | 167 | netlink_kernel_release(scsi_nl_sock); |
168 | netlink_unregister_notifier(&scsi_netlink_notifier); | 168 | netlink_unregister_notifier(&scsi_netlink_notifier); |
169 | } | 169 | } |
170 | 170 | ||
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index ef0e74264880..0d7b4e79415c 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -1558,7 +1558,7 @@ static __init int iscsi_transport_init(void) | |||
1558 | return 0; | 1558 | return 0; |
1559 | 1559 | ||
1560 | release_nls: | 1560 | release_nls: |
1561 | sock_release(nls->sk_socket); | 1561 | netlink_kernel_release(nls); |
1562 | unregister_session_class: | 1562 | unregister_session_class: |
1563 | transport_class_unregister(&iscsi_session_class); | 1563 | transport_class_unregister(&iscsi_session_class); |
1564 | unregister_conn_class: | 1564 | unregister_conn_class: |
@@ -1573,7 +1573,7 @@ unregister_transport_class: | |||
1573 | static void __exit iscsi_transport_exit(void) | 1573 | static void __exit iscsi_transport_exit(void) |
1574 | { | 1574 | { |
1575 | destroy_workqueue(iscsi_eh_timer_workq); | 1575 | destroy_workqueue(iscsi_eh_timer_workq); |
1576 | sock_release(nls->sk_socket); | 1576 | netlink_kernel_release(nls); |
1577 | transport_class_unregister(&iscsi_connection_class); | 1577 | transport_class_unregister(&iscsi_connection_class); |
1578 | transport_class_unregister(&iscsi_session_class); | 1578 | transport_class_unregister(&iscsi_session_class); |
1579 | transport_class_unregister(&iscsi_host_class); | 1579 | transport_class_unregister(&iscsi_host_class); |