diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-06-22 13:16:31 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-06-22 16:07:41 -0400 |
commit | 4f15e2b1f4f3a56e46201714b39436c32218d547 (patch) | |
tree | db694827826cc80b27958f8b6eda99be44953a2c | |
parent | 80fec4c62e2cf544ac26e53f3e0d2f73df6820b9 (diff) |
[PATCH] NLM: cleanup for blocked locks.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/lockd/clntlock.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index ef7103b8c5bd..44adb84183b6 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c | |||
@@ -31,7 +31,7 @@ static int reclaimer(void *ptr); | |||
31 | * This is the representation of a blocked client lock. | 31 | * This is the representation of a blocked client lock. |
32 | */ | 32 | */ |
33 | struct nlm_wait { | 33 | struct nlm_wait { |
34 | struct nlm_wait * b_next; /* linked list */ | 34 | struct list_head b_list; /* linked list */ |
35 | wait_queue_head_t b_wait; /* where to wait on */ | 35 | wait_queue_head_t b_wait; /* where to wait on */ |
36 | struct nlm_host * b_host; | 36 | struct nlm_host * b_host; |
37 | struct file_lock * b_lock; /* local file lock */ | 37 | struct file_lock * b_lock; /* local file lock */ |
@@ -39,7 +39,7 @@ struct nlm_wait { | |||
39 | u32 b_status; /* grant callback status */ | 39 | u32 b_status; /* grant callback status */ |
40 | }; | 40 | }; |
41 | 41 | ||
42 | static struct nlm_wait * nlm_blocked; | 42 | static LIST_HEAD(nlm_blocked); |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * Block on a lock | 45 | * Block on a lock |
@@ -55,8 +55,7 @@ nlmclnt_block(struct nlm_host *host, struct file_lock *fl, u32 *statp) | |||
55 | block.b_lock = fl; | 55 | block.b_lock = fl; |
56 | init_waitqueue_head(&block.b_wait); | 56 | init_waitqueue_head(&block.b_wait); |
57 | block.b_status = NLM_LCK_BLOCKED; | 57 | block.b_status = NLM_LCK_BLOCKED; |
58 | block.b_next = nlm_blocked; | 58 | list_add(&block.b_list, &nlm_blocked); |
59 | nlm_blocked = █ | ||
60 | 59 | ||
61 | /* Remember pseudo nsm state */ | 60 | /* Remember pseudo nsm state */ |
62 | pstate = host->h_state; | 61 | pstate = host->h_state; |
@@ -71,12 +70,7 @@ nlmclnt_block(struct nlm_host *host, struct file_lock *fl, u32 *statp) | |||
71 | */ | 70 | */ |
72 | sleep_on_timeout(&block.b_wait, 30*HZ); | 71 | sleep_on_timeout(&block.b_wait, 30*HZ); |
73 | 72 | ||
74 | for (head = &nlm_blocked; *head; head = &(*head)->b_next) { | 73 | list_del(&block.b_list); |
75 | if (*head == &block) { | ||
76 | *head = block.b_next; | ||
77 | break; | ||
78 | } | ||
79 | } | ||
80 | 74 | ||
81 | if (!signalled()) { | 75 | if (!signalled()) { |
82 | *statp = block.b_status; | 76 | *statp = block.b_status; |
@@ -105,7 +99,7 @@ nlmclnt_grant(struct nlm_lock *lock) | |||
105 | * Look up blocked request based on arguments. | 99 | * Look up blocked request based on arguments. |
106 | * Warning: must not use cookie to match it! | 100 | * Warning: must not use cookie to match it! |
107 | */ | 101 | */ |
108 | for (block = nlm_blocked; block; block = block->b_next) { | 102 | list_for_each_entry(block, &nlm_blocked, b_list) { |
109 | if (nlm_compare_locks(block->b_lock, &lock->fl)) | 103 | if (nlm_compare_locks(block->b_lock, &lock->fl)) |
110 | break; | 104 | break; |
111 | } | 105 | } |
@@ -230,7 +224,7 @@ restart: | |||
230 | host->h_reclaiming = 0; | 224 | host->h_reclaiming = 0; |
231 | 225 | ||
232 | /* Now, wake up all processes that sleep on a blocked lock */ | 226 | /* Now, wake up all processes that sleep on a blocked lock */ |
233 | for (block = nlm_blocked; block; block = block->b_next) { | 227 | list_for_each_entry(block, &nlm_blocked, b_list) { |
234 | if (block->b_host == host) { | 228 | if (block->b_host == host) { |
235 | block->b_status = NLM_LCK_DENIED_GRACE_PERIOD; | 229 | block->b_status = NLM_LCK_DENIED_GRACE_PERIOD; |
236 | wake_up(&block->b_wait); | 230 | wake_up(&block->b_wait); |