aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-09-24 17:22:23 -0400
committerEric Van Hensbergen <ericvh@ericvh-desktop.austin.ibm.com>2008-09-24 17:22:23 -0400
commit206ca50de77033c6cc17d0e14fbb12d119a67b01 (patch)
tree4050082b15e880806fffadf50fadcb79ed106460 /net
parentec3c68f232f6d98b4596c05c1c7551b44c617c5f (diff)
9p-trans_fd: fix and clean up module init/exit paths
trans_fd leaked p9_mux_wq on module unload. Fix it. While at it, collapse p9_mux_global_init() into p9_trans_fd_init(). It's easier to follow this way and the global poll_tasks array is about to removed anyway. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net')
-rw-r--r--net/9p/trans_fd.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index f6d4af16cb19..0b4eb5f78356 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -238,22 +238,6 @@ static int p9_conn_rpcnb(struct p9_conn *m, struct p9_fcall *tc,
238 238
239static void p9_conn_cancel(struct p9_conn *m, int err); 239static void p9_conn_cancel(struct p9_conn *m, int err);
240 240
241static int p9_mux_global_init(void)
242{
243 int i;
244
245 for (i = 0; i < ARRAY_SIZE(p9_mux_poll_tasks); i++)
246 p9_mux_poll_tasks[i].task = NULL;
247
248 p9_mux_wq = create_workqueue("v9fs");
249 if (!p9_mux_wq) {
250 printk(KERN_WARNING "v9fs: mux: creating workqueue failed\n");
251 return -ENOMEM;
252 }
253
254 return 0;
255}
256
257static u16 p9_mux_get_tag(struct p9_conn *m) 241static u16 p9_mux_get_tag(struct p9_conn *m)
258{ 242{
259 int tag; 243 int tag;
@@ -1616,10 +1600,15 @@ static struct p9_trans_module p9_fd_trans = {
1616 1600
1617int p9_trans_fd_init(void) 1601int p9_trans_fd_init(void)
1618{ 1602{
1619 int ret = p9_mux_global_init(); 1603 int i;
1620 if (ret) { 1604
1621 printk(KERN_WARNING "9p: starting mux failed\n"); 1605 for (i = 0; i < ARRAY_SIZE(p9_mux_poll_tasks); i++)
1622 return ret; 1606 p9_mux_poll_tasks[i].task = NULL;
1607
1608 p9_mux_wq = create_workqueue("v9fs");
1609 if (!p9_mux_wq) {
1610 printk(KERN_WARNING "v9fs: mux: creating workqueue failed\n");
1611 return -ENOMEM;
1623 } 1612 }
1624 1613
1625 v9fs_register_trans(&p9_tcp_trans); 1614 v9fs_register_trans(&p9_tcp_trans);
@@ -1634,4 +1623,6 @@ void p9_trans_fd_exit(void)
1634 v9fs_unregister_trans(&p9_tcp_trans); 1623 v9fs_unregister_trans(&p9_tcp_trans);
1635 v9fs_unregister_trans(&p9_unix_trans); 1624 v9fs_unregister_trans(&p9_unix_trans);
1636 v9fs_unregister_trans(&p9_fd_trans); 1625 v9fs_unregister_trans(&p9_fd_trans);
1626
1627 destroy_workqueue(p9_mux_wq);
1637} 1628}