diff options
author | Tejun Heo <tj@kernel.org> | 2008-09-24 17:22:23 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@ericvh-desktop.austin.ibm.com> | 2008-09-24 17:22:23 -0400 |
commit | 72029fe85d8d060b3f966f2dbc36b3c75b5a6532 (patch) | |
tree | ef8948240b0aff2a366136a8303afc70e6c84da8 /net/9p/trans_virtio.c | |
parent | 72d31053f62c4bc464c2783974926969614a8649 (diff) |
9p: implement proper trans module refcounting and unregistration
9p trans modules aren't refcounted nor were they unregistered
properly. Fix it.
* Add 9p_trans_module->owner and reference the module on each trans
instance creation and put it on destruction.
* Protect v9fs_trans_list with a spinlock. This isn't strictly
necessary as the list is manipulated only during module loading /
unloading but it's a good idea to make the API safe.
* Unregister trans modules when the corresponding module is being
unloaded.
* While at it, kill unnecessary EXPORT_SYMBOL on p9_trans_fd_init().
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p/trans_virtio.c')
-rw-r--r-- | net/9p/trans_virtio.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 42adc052b149..94912e077a55 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
@@ -528,6 +528,7 @@ static struct p9_trans_module p9_virtio_trans = { | |||
528 | .create = p9_virtio_create, | 528 | .create = p9_virtio_create, |
529 | .maxsize = PAGE_SIZE*16, | 529 | .maxsize = PAGE_SIZE*16, |
530 | .def = 0, | 530 | .def = 0, |
531 | .owner = THIS_MODULE, | ||
531 | }; | 532 | }; |
532 | 533 | ||
533 | /* The standard init function */ | 534 | /* The standard init function */ |
@@ -545,6 +546,7 @@ static int __init p9_virtio_init(void) | |||
545 | static void __exit p9_virtio_cleanup(void) | 546 | static void __exit p9_virtio_cleanup(void) |
546 | { | 547 | { |
547 | unregister_virtio_driver(&p9_virtio_drv); | 548 | unregister_virtio_driver(&p9_virtio_drv); |
549 | v9fs_unregister_trans(&p9_virtio_trans); | ||
548 | } | 550 | } |
549 | 551 | ||
550 | module_init(p9_virtio_init); | 552 | module_init(p9_virtio_init); |