summaryrefslogtreecommitdiffstats
path: root/net/9p/trans_virtio.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-09-24 23:22:23 +0200
committerEric Van Hensbergen <ericvh@ericvh-desktop.austin.ibm.com>2008-09-24 23:22:23 +0200
commit72029fe85d8d060b3f966f2dbc36b3c75b5a6532 (patch)
treeef8948240b0aff2a366136a8303afc70e6c84da8 /net/9p/trans_virtio.c
parentLinux 2.6.27-rc7 (diff)
downloadlinux-72029fe85d8d060b3f966f2dbc36b3c75b5a6532.tar.xz
linux-72029fe85d8d060b3f966f2dbc36b3c75b5a6532.zip
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.c2
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 = {
.create = p9_virtio_create,
.maxsize = PAGE_SIZE*16,
.def = 0,
+ .owner = THIS_MODULE,
};
/* The standard init function */
@@ -545,6 +546,7 @@ static int __init p9_virtio_init(void)
static void __exit p9_virtio_cleanup(void)
{
unregister_virtio_driver(&p9_virtio_drv);
+ v9fs_unregister_trans(&p9_virtio_trans);
}
module_init(p9_virtio_init);