diff options
author | Tejun Heo <tj@kernel.org> | 2011-01-14 10:56:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-14 12:25:11 -0500 |
commit | 0ad53eeefcbb2620b6a71ffdaad4add20b450b8b (patch) | |
tree | 6f24c2d7b0a7554842544e51bd8e52159086669e /fs/afs/main.c | |
parent | e1fcc7e2a719d139322fab3f47cfbd4340cf3d82 (diff) |
afs: add afs_wq and use it instead of the system workqueue
flush_scheduled_work() is going away. afs needs to make sure all the
works it has queued have finished before being unloaded and there can
be arbitrary number of pending works. Add afs_wq and use it as the
flush domain instead of the system workqueue.
Also, convert cancel_delayed_work() + flush_scheduled_work() to
cancel_delayed_work_sync() in afs_mntpt_kill_timer().
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Cc: linux-afs@lists.infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/afs/main.c')
-rw-r--r-- | fs/afs/main.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/afs/main.c b/fs/afs/main.c index cfd1cbe25b22..42dd2e499ed8 100644 --- a/fs/afs/main.c +++ b/fs/afs/main.c | |||
@@ -30,6 +30,7 @@ module_param(rootcell, charp, 0); | |||
30 | MODULE_PARM_DESC(rootcell, "root AFS cell name and VL server IP addr list"); | 30 | MODULE_PARM_DESC(rootcell, "root AFS cell name and VL server IP addr list"); |
31 | 31 | ||
32 | struct afs_uuid afs_uuid; | 32 | struct afs_uuid afs_uuid; |
33 | struct workqueue_struct *afs_wq; | ||
33 | 34 | ||
34 | /* | 35 | /* |
35 | * get a client UUID | 36 | * get a client UUID |
@@ -87,10 +88,16 @@ static int __init afs_init(void) | |||
87 | if (ret < 0) | 88 | if (ret < 0) |
88 | return ret; | 89 | return ret; |
89 | 90 | ||
91 | /* create workqueue */ | ||
92 | ret = -ENOMEM; | ||
93 | afs_wq = alloc_workqueue("afs", 0, 0); | ||
94 | if (!afs_wq) | ||
95 | return ret; | ||
96 | |||
90 | /* register the /proc stuff */ | 97 | /* register the /proc stuff */ |
91 | ret = afs_proc_init(); | 98 | ret = afs_proc_init(); |
92 | if (ret < 0) | 99 | if (ret < 0) |
93 | return ret; | 100 | goto error_proc; |
94 | 101 | ||
95 | #ifdef CONFIG_AFS_FSCACHE | 102 | #ifdef CONFIG_AFS_FSCACHE |
96 | /* we want to be able to cache */ | 103 | /* we want to be able to cache */ |
@@ -140,6 +147,8 @@ error_cell_init: | |||
140 | error_cache: | 147 | error_cache: |
141 | #endif | 148 | #endif |
142 | afs_proc_cleanup(); | 149 | afs_proc_cleanup(); |
150 | error_proc: | ||
151 | destroy_workqueue(afs_wq); | ||
143 | rcu_barrier(); | 152 | rcu_barrier(); |
144 | printk(KERN_ERR "kAFS: failed to register: %d\n", ret); | 153 | printk(KERN_ERR "kAFS: failed to register: %d\n", ret); |
145 | return ret; | 154 | return ret; |
@@ -163,7 +172,7 @@ static void __exit afs_exit(void) | |||
163 | afs_purge_servers(); | 172 | afs_purge_servers(); |
164 | afs_callback_update_kill(); | 173 | afs_callback_update_kill(); |
165 | afs_vlocation_purge(); | 174 | afs_vlocation_purge(); |
166 | flush_scheduled_work(); | 175 | destroy_workqueue(afs_wq); |
167 | afs_cell_purge(); | 176 | afs_cell_purge(); |
168 | #ifdef CONFIG_AFS_FSCACHE | 177 | #ifdef CONFIG_AFS_FSCACHE |
169 | fscache_unregister_netfs(&afs_cache_netfs); | 178 | fscache_unregister_netfs(&afs_cache_netfs); |