diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2010-09-22 09:50:35 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-09-22 09:50:35 -0400 |
commit | 63185942c5f138c62de16b4cbc7eee494a58fea8 (patch) | |
tree | 279f1dd93cc8d7805ef52a6ebb496d71d9cc3785 /fs | |
parent | b4687da7fc5f741af7fee9b0248a2cf2ad9c4478 (diff) |
lockd: Remove BKL from the client
This patch removes all calls to lock_kernel() from the client. This patch
should be applied after the "fs/lock.c prepare for BKL removal" patch submitted
by Arnd Bergmann on September 18.
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/lockd/clntlock.c | 15 | ||||
-rw-r--r-- | fs/lockd/clntproc.c | 13 |
2 files changed, 14 insertions, 14 deletions
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index 64fd427c993c..d5bb86866e6c 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c | |||
@@ -42,6 +42,7 @@ struct nlm_wait { | |||
42 | }; | 42 | }; |
43 | 43 | ||
44 | static LIST_HEAD(nlm_blocked); | 44 | static LIST_HEAD(nlm_blocked); |
45 | static DEFINE_SPINLOCK(nlm_blocked_lock); | ||
45 | 46 | ||
46 | /** | 47 | /** |
47 | * nlmclnt_init - Set up per-NFS mount point lockd data structures | 48 | * nlmclnt_init - Set up per-NFS mount point lockd data structures |
@@ -97,7 +98,10 @@ struct nlm_wait *nlmclnt_prepare_block(struct nlm_host *host, struct file_lock * | |||
97 | block->b_lock = fl; | 98 | block->b_lock = fl; |
98 | init_waitqueue_head(&block->b_wait); | 99 | init_waitqueue_head(&block->b_wait); |
99 | block->b_status = nlm_lck_blocked; | 100 | block->b_status = nlm_lck_blocked; |
101 | |||
102 | spin_lock(&nlm_blocked_lock); | ||
100 | list_add(&block->b_list, &nlm_blocked); | 103 | list_add(&block->b_list, &nlm_blocked); |
104 | spin_unlock(&nlm_blocked_lock); | ||
101 | } | 105 | } |
102 | return block; | 106 | return block; |
103 | } | 107 | } |
@@ -106,7 +110,9 @@ void nlmclnt_finish_block(struct nlm_wait *block) | |||
106 | { | 110 | { |
107 | if (block == NULL) | 111 | if (block == NULL) |
108 | return; | 112 | return; |
113 | spin_lock(&nlm_blocked_lock); | ||
109 | list_del(&block->b_list); | 114 | list_del(&block->b_list); |
115 | spin_unlock(&nlm_blocked_lock); | ||
110 | kfree(block); | 116 | kfree(block); |
111 | } | 117 | } |
112 | 118 | ||
@@ -154,6 +160,7 @@ __be32 nlmclnt_grant(const struct sockaddr *addr, const struct nlm_lock *lock) | |||
154 | * Look up blocked request based on arguments. | 160 | * Look up blocked request based on arguments. |
155 | * Warning: must not use cookie to match it! | 161 | * Warning: must not use cookie to match it! |
156 | */ | 162 | */ |
163 | spin_lock(&nlm_blocked_lock); | ||
157 | list_for_each_entry(block, &nlm_blocked, b_list) { | 164 | list_for_each_entry(block, &nlm_blocked, b_list) { |
158 | struct file_lock *fl_blocked = block->b_lock; | 165 | struct file_lock *fl_blocked = block->b_lock; |
159 | 166 | ||
@@ -178,6 +185,7 @@ __be32 nlmclnt_grant(const struct sockaddr *addr, const struct nlm_lock *lock) | |||
178 | wake_up(&block->b_wait); | 185 | wake_up(&block->b_wait); |
179 | res = nlm_granted; | 186 | res = nlm_granted; |
180 | } | 187 | } |
188 | spin_unlock(&nlm_blocked_lock); | ||
181 | return res; | 189 | return res; |
182 | } | 190 | } |
183 | 191 | ||
@@ -216,10 +224,6 @@ reclaimer(void *ptr) | |||
216 | allow_signal(SIGKILL); | 224 | allow_signal(SIGKILL); |
217 | 225 | ||
218 | down_write(&host->h_rwsem); | 226 | down_write(&host->h_rwsem); |
219 | |||
220 | /* This one ensures that our parent doesn't terminate while the | ||
221 | * reclaim is in progress */ | ||
222 | lock_kernel(); | ||
223 | lockd_up(); /* note: this cannot fail as lockd is already running */ | 227 | lockd_up(); /* note: this cannot fail as lockd is already running */ |
224 | 228 | ||
225 | dprintk("lockd: reclaiming locks for host %s\n", host->h_name); | 229 | dprintk("lockd: reclaiming locks for host %s\n", host->h_name); |
@@ -260,16 +264,17 @@ restart: | |||
260 | dprintk("NLM: done reclaiming locks for host %s\n", host->h_name); | 264 | dprintk("NLM: done reclaiming locks for host %s\n", host->h_name); |
261 | 265 | ||
262 | /* Now, wake up all processes that sleep on a blocked lock */ | 266 | /* Now, wake up all processes that sleep on a blocked lock */ |
267 | spin_lock(&nlm_blocked_lock); | ||
263 | list_for_each_entry(block, &nlm_blocked, b_list) { | 268 | list_for_each_entry(block, &nlm_blocked, b_list) { |
264 | if (block->b_host == host) { | 269 | if (block->b_host == host) { |
265 | block->b_status = nlm_lck_denied_grace_period; | 270 | block->b_status = nlm_lck_denied_grace_period; |
266 | wake_up(&block->b_wait); | 271 | wake_up(&block->b_wait); |
267 | } | 272 | } |
268 | } | 273 | } |
274 | spin_unlock(&nlm_blocked_lock); | ||
269 | 275 | ||
270 | /* Release host handle after use */ | 276 | /* Release host handle after use */ |
271 | nlm_release_host(host); | 277 | nlm_release_host(host); |
272 | lockd_down(); | 278 | lockd_down(); |
273 | unlock_kernel(); | ||
274 | return 0; | 279 | return 0; |
275 | } | 280 | } |
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 7932c399fab4..47ea1e1925b8 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -166,7 +166,6 @@ int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl) | |||
166 | /* Set up the argument struct */ | 166 | /* Set up the argument struct */ |
167 | nlmclnt_setlockargs(call, fl); | 167 | nlmclnt_setlockargs(call, fl); |
168 | 168 | ||
169 | lock_kernel(); | ||
170 | if (IS_SETLK(cmd) || IS_SETLKW(cmd)) { | 169 | if (IS_SETLK(cmd) || IS_SETLKW(cmd)) { |
171 | if (fl->fl_type != F_UNLCK) { | 170 | if (fl->fl_type != F_UNLCK) { |
172 | call->a_args.block = IS_SETLKW(cmd) ? 1 : 0; | 171 | call->a_args.block = IS_SETLKW(cmd) ? 1 : 0; |
@@ -177,10 +176,8 @@ int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl) | |||
177 | status = nlmclnt_test(call, fl); | 176 | status = nlmclnt_test(call, fl); |
178 | else | 177 | else |
179 | status = -EINVAL; | 178 | status = -EINVAL; |
180 | |||
181 | fl->fl_ops->fl_release_private(fl); | 179 | fl->fl_ops->fl_release_private(fl); |
182 | fl->fl_ops = NULL; | 180 | fl->fl_ops = NULL; |
183 | unlock_kernel(); | ||
184 | 181 | ||
185 | dprintk("lockd: clnt proc returns %d\n", status); | 182 | dprintk("lockd: clnt proc returns %d\n", status); |
186 | return status; | 183 | return status; |
@@ -226,9 +223,7 @@ void nlm_release_call(struct nlm_rqst *call) | |||
226 | 223 | ||
227 | static void nlmclnt_rpc_release(void *data) | 224 | static void nlmclnt_rpc_release(void *data) |
228 | { | 225 | { |
229 | lock_kernel(); | ||
230 | nlm_release_call(data); | 226 | nlm_release_call(data); |
231 | unlock_kernel(); | ||
232 | } | 227 | } |
233 | 228 | ||
234 | static int nlm_wait_on_grace(wait_queue_head_t *queue) | 229 | static int nlm_wait_on_grace(wait_queue_head_t *queue) |
@@ -448,14 +443,18 @@ out: | |||
448 | 443 | ||
449 | static void nlmclnt_locks_copy_lock(struct file_lock *new, struct file_lock *fl) | 444 | static void nlmclnt_locks_copy_lock(struct file_lock *new, struct file_lock *fl) |
450 | { | 445 | { |
446 | spin_lock(&fl->fl_u.nfs_fl.owner->host->h_lock); | ||
451 | new->fl_u.nfs_fl.state = fl->fl_u.nfs_fl.state; | 447 | new->fl_u.nfs_fl.state = fl->fl_u.nfs_fl.state; |
452 | new->fl_u.nfs_fl.owner = nlm_get_lockowner(fl->fl_u.nfs_fl.owner); | 448 | new->fl_u.nfs_fl.owner = nlm_get_lockowner(fl->fl_u.nfs_fl.owner); |
453 | list_add_tail(&new->fl_u.nfs_fl.list, &fl->fl_u.nfs_fl.owner->host->h_granted); | 449 | list_add_tail(&new->fl_u.nfs_fl.list, &fl->fl_u.nfs_fl.owner->host->h_granted); |
450 | spin_unlock(&fl->fl_u.nfs_fl.owner->host->h_lock); | ||
454 | } | 451 | } |
455 | 452 | ||
456 | static void nlmclnt_locks_release_private(struct file_lock *fl) | 453 | static void nlmclnt_locks_release_private(struct file_lock *fl) |
457 | { | 454 | { |
455 | spin_lock(&fl->fl_u.nfs_fl.owner->host->h_lock); | ||
458 | list_del(&fl->fl_u.nfs_fl.list); | 456 | list_del(&fl->fl_u.nfs_fl.list); |
457 | spin_unlock(&fl->fl_u.nfs_fl.owner->host->h_lock); | ||
459 | nlm_put_lockowner(fl->fl_u.nfs_fl.owner); | 458 | nlm_put_lockowner(fl->fl_u.nfs_fl.owner); |
460 | } | 459 | } |
461 | 460 | ||
@@ -721,9 +720,7 @@ static void nlmclnt_unlock_callback(struct rpc_task *task, void *data) | |||
721 | die: | 720 | die: |
722 | return; | 721 | return; |
723 | retry_rebind: | 722 | retry_rebind: |
724 | lock_kernel(); | ||
725 | nlm_rebind_host(req->a_host); | 723 | nlm_rebind_host(req->a_host); |
726 | unlock_kernel(); | ||
727 | retry_unlock: | 724 | retry_unlock: |
728 | rpc_restart_call(task); | 725 | rpc_restart_call(task); |
729 | } | 726 | } |
@@ -801,9 +798,7 @@ retry_cancel: | |||
801 | /* Don't ever retry more than 3 times */ | 798 | /* Don't ever retry more than 3 times */ |
802 | if (req->a_retries++ >= NLMCLNT_MAX_RETRIES) | 799 | if (req->a_retries++ >= NLMCLNT_MAX_RETRIES) |
803 | goto die; | 800 | goto die; |
804 | lock_kernel(); | ||
805 | nlm_rebind_host(req->a_host); | 801 | nlm_rebind_host(req->a_host); |
806 | unlock_kernel(); | ||
807 | rpc_restart_call(task); | 802 | rpc_restart_call(task); |
808 | rpc_delay(task, 30 * HZ); | 803 | rpc_delay(task, 30 * HZ); |
809 | } | 804 | } |