diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/lockd/clntproc.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'fs/lockd/clntproc.c')
-rw-r--r-- | fs/lockd/clntproc.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 7932c399fab4..e374050a911c 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -7,7 +7,6 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/smp_lock.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/types.h> | 11 | #include <linux/types.h> |
13 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
@@ -59,7 +58,7 @@ static void nlm_put_lockowner(struct nlm_lockowner *lockowner) | |||
59 | return; | 58 | return; |
60 | list_del(&lockowner->list); | 59 | list_del(&lockowner->list); |
61 | spin_unlock(&lockowner->host->h_lock); | 60 | spin_unlock(&lockowner->host->h_lock); |
62 | nlm_release_host(lockowner->host); | 61 | nlmclnt_release_host(lockowner->host); |
63 | kfree(lockowner); | 62 | kfree(lockowner); |
64 | } | 63 | } |
65 | 64 | ||
@@ -166,7 +165,6 @@ int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl) | |||
166 | /* Set up the argument struct */ | 165 | /* Set up the argument struct */ |
167 | nlmclnt_setlockargs(call, fl); | 166 | nlmclnt_setlockargs(call, fl); |
168 | 167 | ||
169 | lock_kernel(); | ||
170 | if (IS_SETLK(cmd) || IS_SETLKW(cmd)) { | 168 | if (IS_SETLK(cmd) || IS_SETLKW(cmd)) { |
171 | if (fl->fl_type != F_UNLCK) { | 169 | if (fl->fl_type != F_UNLCK) { |
172 | call->a_args.block = IS_SETLKW(cmd) ? 1 : 0; | 170 | call->a_args.block = IS_SETLKW(cmd) ? 1 : 0; |
@@ -177,10 +175,8 @@ int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl) | |||
177 | status = nlmclnt_test(call, fl); | 175 | status = nlmclnt_test(call, fl); |
178 | else | 176 | else |
179 | status = -EINVAL; | 177 | status = -EINVAL; |
180 | |||
181 | fl->fl_ops->fl_release_private(fl); | 178 | fl->fl_ops->fl_release_private(fl); |
182 | fl->fl_ops = NULL; | 179 | fl->fl_ops = NULL; |
183 | unlock_kernel(); | ||
184 | 180 | ||
185 | dprintk("lockd: clnt proc returns %d\n", status); | 181 | dprintk("lockd: clnt proc returns %d\n", status); |
186 | return status; | 182 | return status; |
@@ -211,24 +207,22 @@ struct nlm_rqst *nlm_alloc_call(struct nlm_host *host) | |||
211 | printk("nlm_alloc_call: failed, waiting for memory\n"); | 207 | printk("nlm_alloc_call: failed, waiting for memory\n"); |
212 | schedule_timeout_interruptible(5*HZ); | 208 | schedule_timeout_interruptible(5*HZ); |
213 | } | 209 | } |
214 | nlm_release_host(host); | 210 | nlmclnt_release_host(host); |
215 | return NULL; | 211 | return NULL; |
216 | } | 212 | } |
217 | 213 | ||
218 | void nlm_release_call(struct nlm_rqst *call) | 214 | void nlmclnt_release_call(struct nlm_rqst *call) |
219 | { | 215 | { |
220 | if (!atomic_dec_and_test(&call->a_count)) | 216 | if (!atomic_dec_and_test(&call->a_count)) |
221 | return; | 217 | return; |
222 | nlm_release_host(call->a_host); | 218 | nlmclnt_release_host(call->a_host); |
223 | nlmclnt_release_lockargs(call); | 219 | nlmclnt_release_lockargs(call); |
224 | kfree(call); | 220 | kfree(call); |
225 | } | 221 | } |
226 | 222 | ||
227 | static void nlmclnt_rpc_release(void *data) | 223 | static void nlmclnt_rpc_release(void *data) |
228 | { | 224 | { |
229 | lock_kernel(); | 225 | nlmclnt_release_call(data); |
230 | nlm_release_call(data); | ||
231 | unlock_kernel(); | ||
232 | } | 226 | } |
233 | 227 | ||
234 | static int nlm_wait_on_grace(wait_queue_head_t *queue) | 228 | static int nlm_wait_on_grace(wait_queue_head_t *queue) |
@@ -442,20 +436,24 @@ nlmclnt_test(struct nlm_rqst *req, struct file_lock *fl) | |||
442 | status = nlm_stat_to_errno(req->a_res.status); | 436 | status = nlm_stat_to_errno(req->a_res.status); |
443 | } | 437 | } |
444 | out: | 438 | out: |
445 | nlm_release_call(req); | 439 | nlmclnt_release_call(req); |
446 | return status; | 440 | return status; |
447 | } | 441 | } |
448 | 442 | ||
449 | static void nlmclnt_locks_copy_lock(struct file_lock *new, struct file_lock *fl) | 443 | static void nlmclnt_locks_copy_lock(struct file_lock *new, struct file_lock *fl) |
450 | { | 444 | { |
445 | spin_lock(&fl->fl_u.nfs_fl.owner->host->h_lock); | ||
451 | new->fl_u.nfs_fl.state = fl->fl_u.nfs_fl.state; | 446 | 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); | 447 | 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); | 448 | list_add_tail(&new->fl_u.nfs_fl.list, &fl->fl_u.nfs_fl.owner->host->h_granted); |
449 | spin_unlock(&fl->fl_u.nfs_fl.owner->host->h_lock); | ||
454 | } | 450 | } |
455 | 451 | ||
456 | static void nlmclnt_locks_release_private(struct file_lock *fl) | 452 | static void nlmclnt_locks_release_private(struct file_lock *fl) |
457 | { | 453 | { |
454 | spin_lock(&fl->fl_u.nfs_fl.owner->host->h_lock); | ||
458 | list_del(&fl->fl_u.nfs_fl.list); | 455 | list_del(&fl->fl_u.nfs_fl.list); |
456 | spin_unlock(&fl->fl_u.nfs_fl.owner->host->h_lock); | ||
459 | nlm_put_lockowner(fl->fl_u.nfs_fl.owner); | 457 | nlm_put_lockowner(fl->fl_u.nfs_fl.owner); |
460 | } | 458 | } |
461 | 459 | ||
@@ -595,7 +593,7 @@ again: | |||
595 | out_unblock: | 593 | out_unblock: |
596 | nlmclnt_finish_block(block); | 594 | nlmclnt_finish_block(block); |
597 | out: | 595 | out: |
598 | nlm_release_call(req); | 596 | nlmclnt_release_call(req); |
599 | return status; | 597 | return status; |
600 | out_unlock: | 598 | out_unlock: |
601 | /* Fatal error: ensure that we remove the lock altogether */ | 599 | /* Fatal error: ensure that we remove the lock altogether */ |
@@ -696,7 +694,7 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl) | |||
696 | /* What to do now? I'm out of my depth... */ | 694 | /* What to do now? I'm out of my depth... */ |
697 | status = -ENOLCK; | 695 | status = -ENOLCK; |
698 | out: | 696 | out: |
699 | nlm_release_call(req); | 697 | nlmclnt_release_call(req); |
700 | return status; | 698 | return status; |
701 | } | 699 | } |
702 | 700 | ||
@@ -710,7 +708,13 @@ static void nlmclnt_unlock_callback(struct rpc_task *task, void *data) | |||
710 | 708 | ||
711 | if (task->tk_status < 0) { | 709 | if (task->tk_status < 0) { |
712 | dprintk("lockd: unlock failed (err = %d)\n", -task->tk_status); | 710 | dprintk("lockd: unlock failed (err = %d)\n", -task->tk_status); |
713 | goto retry_rebind; | 711 | switch (task->tk_status) { |
712 | case -EACCES: | ||
713 | case -EIO: | ||
714 | goto die; | ||
715 | default: | ||
716 | goto retry_rebind; | ||
717 | } | ||
714 | } | 718 | } |
715 | if (status == NLM_LCK_DENIED_GRACE_PERIOD) { | 719 | if (status == NLM_LCK_DENIED_GRACE_PERIOD) { |
716 | rpc_delay(task, NLMCLNT_GRACE_WAIT); | 720 | rpc_delay(task, NLMCLNT_GRACE_WAIT); |
@@ -721,9 +725,7 @@ static void nlmclnt_unlock_callback(struct rpc_task *task, void *data) | |||
721 | die: | 725 | die: |
722 | return; | 726 | return; |
723 | retry_rebind: | 727 | retry_rebind: |
724 | lock_kernel(); | ||
725 | nlm_rebind_host(req->a_host); | 728 | nlm_rebind_host(req->a_host); |
726 | unlock_kernel(); | ||
727 | retry_unlock: | 729 | retry_unlock: |
728 | rpc_restart_call(task); | 730 | rpc_restart_call(task); |
729 | } | 731 | } |
@@ -759,7 +761,7 @@ static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl | |||
759 | NLMPROC_CANCEL, &nlmclnt_cancel_ops); | 761 | NLMPROC_CANCEL, &nlmclnt_cancel_ops); |
760 | if (status == 0 && req->a_res.status == nlm_lck_denied) | 762 | if (status == 0 && req->a_res.status == nlm_lck_denied) |
761 | status = -ENOLCK; | 763 | status = -ENOLCK; |
762 | nlm_release_call(req); | 764 | nlmclnt_release_call(req); |
763 | return status; | 765 | return status; |
764 | } | 766 | } |
765 | 767 | ||
@@ -801,9 +803,7 @@ retry_cancel: | |||
801 | /* Don't ever retry more than 3 times */ | 803 | /* Don't ever retry more than 3 times */ |
802 | if (req->a_retries++ >= NLMCLNT_MAX_RETRIES) | 804 | if (req->a_retries++ >= NLMCLNT_MAX_RETRIES) |
803 | goto die; | 805 | goto die; |
804 | lock_kernel(); | ||
805 | nlm_rebind_host(req->a_host); | 806 | nlm_rebind_host(req->a_host); |
806 | unlock_kernel(); | ||
807 | rpc_restart_call(task); | 807 | rpc_restart_call(task); |
808 | rpc_delay(task, 30 * HZ); | 808 | rpc_delay(task, 30 * HZ); |
809 | } | 809 | } |