diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-05 22:02:09 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-05 22:02:09 -0500 |
commit | 7d8a804c594b61a05c698126165b5dc417d94a0f (patch) | |
tree | 5718ed900d1a8aa7d85eaa02dc27fda8230a688e /fs/dlm | |
parent | c58bd34d00e04df9a0691732086cf8102b20d907 (diff) | |
parent | 722d74219ea21223c74e5e894b0afcc5e4ca75a7 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm:
dlm: fs/dlm/ast.c: fix warning
dlm: add new debugfs entry
dlm: add time stamp of blocking callback
dlm: change lock time stamping
dlm: improve how bast mode handling
dlm: remove extra blocking callback check
dlm: replace schedule with cond_resched
dlm: remove kmap/kunmap
dlm: trivial annotation of be16 value
dlm: fix up memory allocation flags
Diffstat (limited to 'fs/dlm')
-rw-r--r-- | fs/dlm/ast.c | 56 | ||||
-rw-r--r-- | fs/dlm/ast.h | 4 | ||||
-rw-r--r-- | fs/dlm/debug_fs.c | 310 | ||||
-rw-r--r-- | fs/dlm/dir.c | 18 | ||||
-rw-r--r-- | fs/dlm/dlm_internal.h | 4 | ||||
-rw-r--r-- | fs/dlm/lock.c | 31 | ||||
-rw-r--r-- | fs/dlm/lowcomms.c | 8 | ||||
-rw-r--r-- | fs/dlm/memory.c | 6 | ||||
-rw-r--r-- | fs/dlm/midcomms.c | 2 | ||||
-rw-r--r-- | fs/dlm/netlink.c | 1 | ||||
-rw-r--r-- | fs/dlm/user.c | 4 | ||||
-rw-r--r-- | fs/dlm/user.h | 2 |
12 files changed, 316 insertions, 130 deletions
diff --git a/fs/dlm/ast.c b/fs/dlm/ast.c index 8bf31e3fbf01..dc2ad6008b2d 100644 --- a/fs/dlm/ast.c +++ b/fs/dlm/ast.c | |||
@@ -2,7 +2,7 @@ | |||
2 | ******************************************************************************* | 2 | ******************************************************************************* |
3 | ** | 3 | ** |
4 | ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | 4 | ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
5 | ** Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. | 5 | ** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. |
6 | ** | 6 | ** |
7 | ** This copyrighted material is made available to anyone wishing to use, | 7 | ** This copyrighted material is made available to anyone wishing to use, |
8 | ** modify, copy, or redistribute it subject to the terms and conditions | 8 | ** modify, copy, or redistribute it subject to the terms and conditions |
@@ -33,10 +33,10 @@ void dlm_del_ast(struct dlm_lkb *lkb) | |||
33 | spin_unlock(&ast_queue_lock); | 33 | spin_unlock(&ast_queue_lock); |
34 | } | 34 | } |
35 | 35 | ||
36 | void dlm_add_ast(struct dlm_lkb *lkb, int type) | 36 | void dlm_add_ast(struct dlm_lkb *lkb, int type, int bastmode) |
37 | { | 37 | { |
38 | if (lkb->lkb_flags & DLM_IFL_USER) { | 38 | if (lkb->lkb_flags & DLM_IFL_USER) { |
39 | dlm_user_add_ast(lkb, type); | 39 | dlm_user_add_ast(lkb, type, bastmode); |
40 | return; | 40 | return; |
41 | } | 41 | } |
42 | 42 | ||
@@ -46,6 +46,8 @@ void dlm_add_ast(struct dlm_lkb *lkb, int type) | |||
46 | list_add_tail(&lkb->lkb_astqueue, &ast_queue); | 46 | list_add_tail(&lkb->lkb_astqueue, &ast_queue); |
47 | } | 47 | } |
48 | lkb->lkb_ast_type |= type; | 48 | lkb->lkb_ast_type |= type; |
49 | if (bastmode) | ||
50 | lkb->lkb_bastmode = bastmode; | ||
49 | spin_unlock(&ast_queue_lock); | 51 | spin_unlock(&ast_queue_lock); |
50 | 52 | ||
51 | set_bit(WAKE_ASTS, &astd_wakeflags); | 53 | set_bit(WAKE_ASTS, &astd_wakeflags); |
@@ -59,50 +61,40 @@ static void process_asts(void) | |||
59 | struct dlm_lkb *lkb; | 61 | struct dlm_lkb *lkb; |
60 | void (*cast) (void *astparam); | 62 | void (*cast) (void *astparam); |
61 | void (*bast) (void *astparam, int mode); | 63 | void (*bast) (void *astparam, int mode); |
62 | int type = 0, found, bmode; | 64 | int type = 0, bastmode; |
63 | 65 | ||
64 | for (;;) { | 66 | repeat: |
65 | found = 0; | 67 | spin_lock(&ast_queue_lock); |
66 | spin_lock(&ast_queue_lock); | 68 | list_for_each_entry(lkb, &ast_queue, lkb_astqueue) { |
67 | list_for_each_entry(lkb, &ast_queue, lkb_astqueue) { | 69 | r = lkb->lkb_resource; |
68 | r = lkb->lkb_resource; | 70 | ls = r->res_ls; |
69 | ls = r->res_ls; | 71 | |
70 | 72 | if (dlm_locking_stopped(ls)) | |
71 | if (dlm_locking_stopped(ls)) | 73 | continue; |
72 | continue; | ||
73 | |||
74 | list_del(&lkb->lkb_astqueue); | ||
75 | type = lkb->lkb_ast_type; | ||
76 | lkb->lkb_ast_type = 0; | ||
77 | found = 1; | ||
78 | break; | ||
79 | } | ||
80 | spin_unlock(&ast_queue_lock); | ||
81 | 74 | ||
82 | if (!found) | 75 | list_del(&lkb->lkb_astqueue); |
83 | break; | 76 | type = lkb->lkb_ast_type; |
77 | lkb->lkb_ast_type = 0; | ||
78 | bastmode = lkb->lkb_bastmode; | ||
84 | 79 | ||
80 | spin_unlock(&ast_queue_lock); | ||
85 | cast = lkb->lkb_astfn; | 81 | cast = lkb->lkb_astfn; |
86 | bast = lkb->lkb_bastfn; | 82 | bast = lkb->lkb_bastfn; |
87 | bmode = lkb->lkb_bastmode; | ||
88 | 83 | ||
89 | if ((type & AST_COMP) && cast) | 84 | if ((type & AST_COMP) && cast) |
90 | cast(lkb->lkb_astparam); | 85 | cast(lkb->lkb_astparam); |
91 | 86 | ||
92 | /* FIXME: Is it safe to look at lkb_grmode here | ||
93 | without doing a lock_rsb() ? | ||
94 | Look at other checks in v1 to avoid basts. */ | ||
95 | |||
96 | if ((type & AST_BAST) && bast) | 87 | if ((type & AST_BAST) && bast) |
97 | if (!dlm_modes_compat(lkb->lkb_grmode, bmode)) | 88 | bast(lkb->lkb_astparam, bastmode); |
98 | bast(lkb->lkb_astparam, bmode); | ||
99 | 89 | ||
100 | /* this removes the reference added by dlm_add_ast | 90 | /* this removes the reference added by dlm_add_ast |
101 | and may result in the lkb being freed */ | 91 | and may result in the lkb being freed */ |
102 | dlm_put_lkb(lkb); | 92 | dlm_put_lkb(lkb); |
103 | 93 | ||
104 | schedule(); | 94 | cond_resched(); |
95 | goto repeat; | ||
105 | } | 96 | } |
97 | spin_unlock(&ast_queue_lock); | ||
106 | } | 98 | } |
107 | 99 | ||
108 | static inline int no_asts(void) | 100 | static inline int no_asts(void) |
diff --git a/fs/dlm/ast.h b/fs/dlm/ast.h index 6ee276c74c52..1b5fc5f428fd 100644 --- a/fs/dlm/ast.h +++ b/fs/dlm/ast.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | ******************************************************************************* | 2 | ******************************************************************************* |
3 | ** | 3 | ** |
4 | ** Copyright (C) 2005 Red Hat, Inc. All rights reserved. | 4 | ** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. |
5 | ** | 5 | ** |
6 | ** This copyrighted material is made available to anyone wishing to use, | 6 | ** This copyrighted material is made available to anyone wishing to use, |
7 | ** modify, copy, or redistribute it subject to the terms and conditions | 7 | ** modify, copy, or redistribute it subject to the terms and conditions |
@@ -13,7 +13,7 @@ | |||
13 | #ifndef __ASTD_DOT_H__ | 13 | #ifndef __ASTD_DOT_H__ |
14 | #define __ASTD_DOT_H__ | 14 | #define __ASTD_DOT_H__ |
15 | 15 | ||
16 | void dlm_add_ast(struct dlm_lkb *lkb, int type); | 16 | void dlm_add_ast(struct dlm_lkb *lkb, int type, int bastmode); |
17 | void dlm_del_ast(struct dlm_lkb *lkb); | 17 | void dlm_del_ast(struct dlm_lkb *lkb); |
18 | 18 | ||
19 | void dlm_astd_wake(void); | 19 | void dlm_astd_wake(void); |
diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c index 8fc24f4507a3..2f107d1a6a45 100644 --- a/fs/dlm/debug_fs.c +++ b/fs/dlm/debug_fs.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | ******************************************************************************* | 2 | ******************************************************************************* |
3 | ** | 3 | ** |
4 | ** Copyright (C) 2005 Red Hat, Inc. All rights reserved. | 4 | ** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. |
5 | ** | 5 | ** |
6 | ** This copyrighted material is made available to anyone wishing to use, | 6 | ** This copyrighted material is made available to anyone wishing to use, |
7 | ** modify, copy, or redistribute it subject to the terms and conditions | 7 | ** modify, copy, or redistribute it subject to the terms and conditions |
@@ -27,7 +27,7 @@ static struct dentry *dlm_root; | |||
27 | 27 | ||
28 | struct rsb_iter { | 28 | struct rsb_iter { |
29 | int entry; | 29 | int entry; |
30 | int locks; | 30 | int format; |
31 | int header; | 31 | int header; |
32 | struct dlm_ls *ls; | 32 | struct dlm_ls *ls; |
33 | struct list_head *next; | 33 | struct list_head *next; |
@@ -60,8 +60,8 @@ static char *print_lockmode(int mode) | |||
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | static void print_resource_lock(struct seq_file *s, struct dlm_lkb *lkb, | 63 | static void print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb, |
64 | struct dlm_rsb *res) | 64 | struct dlm_rsb *res) |
65 | { | 65 | { |
66 | seq_printf(s, "%08x %s", lkb->lkb_id, print_lockmode(lkb->lkb_grmode)); | 66 | seq_printf(s, "%08x %s", lkb->lkb_id, print_lockmode(lkb->lkb_grmode)); |
67 | 67 | ||
@@ -83,7 +83,7 @@ static void print_resource_lock(struct seq_file *s, struct dlm_lkb *lkb, | |||
83 | seq_printf(s, "\n"); | 83 | seq_printf(s, "\n"); |
84 | } | 84 | } |
85 | 85 | ||
86 | static int print_resource(struct dlm_rsb *res, struct seq_file *s) | 86 | static int print_format1(struct dlm_rsb *res, struct seq_file *s) |
87 | { | 87 | { |
88 | struct dlm_lkb *lkb; | 88 | struct dlm_lkb *lkb; |
89 | int i, lvblen = res->res_ls->ls_lvblen, recover_list, root_list; | 89 | int i, lvblen = res->res_ls->ls_lvblen, recover_list, root_list; |
@@ -134,15 +134,15 @@ static int print_resource(struct dlm_rsb *res, struct seq_file *s) | |||
134 | /* Print the locks attached to this resource */ | 134 | /* Print the locks attached to this resource */ |
135 | seq_printf(s, "Granted Queue\n"); | 135 | seq_printf(s, "Granted Queue\n"); |
136 | list_for_each_entry(lkb, &res->res_grantqueue, lkb_statequeue) | 136 | list_for_each_entry(lkb, &res->res_grantqueue, lkb_statequeue) |
137 | print_resource_lock(s, lkb, res); | 137 | print_format1_lock(s, lkb, res); |
138 | 138 | ||
139 | seq_printf(s, "Conversion Queue\n"); | 139 | seq_printf(s, "Conversion Queue\n"); |
140 | list_for_each_entry(lkb, &res->res_convertqueue, lkb_statequeue) | 140 | list_for_each_entry(lkb, &res->res_convertqueue, lkb_statequeue) |
141 | print_resource_lock(s, lkb, res); | 141 | print_format1_lock(s, lkb, res); |
142 | 142 | ||
143 | seq_printf(s, "Waiting Queue\n"); | 143 | seq_printf(s, "Waiting Queue\n"); |
144 | list_for_each_entry(lkb, &res->res_waitqueue, lkb_statequeue) | 144 | list_for_each_entry(lkb, &res->res_waitqueue, lkb_statequeue) |
145 | print_resource_lock(s, lkb, res); | 145 | print_format1_lock(s, lkb, res); |
146 | 146 | ||
147 | if (list_empty(&res->res_lookup)) | 147 | if (list_empty(&res->res_lookup)) |
148 | goto out; | 148 | goto out; |
@@ -160,23 +160,24 @@ static int print_resource(struct dlm_rsb *res, struct seq_file *s) | |||
160 | return 0; | 160 | return 0; |
161 | } | 161 | } |
162 | 162 | ||
163 | static void print_lock(struct seq_file *s, struct dlm_lkb *lkb, struct dlm_rsb *r) | 163 | static void print_format2_lock(struct seq_file *s, struct dlm_lkb *lkb, |
164 | struct dlm_rsb *r) | ||
164 | { | 165 | { |
165 | unsigned int waiting = 0; | 166 | u64 xid = 0; |
166 | uint64_t xid = 0; | 167 | u64 us; |
167 | 168 | ||
168 | if (lkb->lkb_flags & DLM_IFL_USER) { | 169 | if (lkb->lkb_flags & DLM_IFL_USER) { |
169 | if (lkb->lkb_ua) | 170 | if (lkb->lkb_ua) |
170 | xid = lkb->lkb_ua->xid; | 171 | xid = lkb->lkb_ua->xid; |
171 | } | 172 | } |
172 | 173 | ||
173 | if (lkb->lkb_timestamp) | 174 | /* microseconds since lkb was added to current queue */ |
174 | waiting = jiffies_to_msecs(jiffies - lkb->lkb_timestamp); | 175 | us = ktime_to_us(ktime_sub(ktime_get(), lkb->lkb_timestamp)); |
175 | 176 | ||
176 | /* id nodeid remid pid xid exflags flags sts grmode rqmode time_ms | 177 | /* id nodeid remid pid xid exflags flags sts grmode rqmode time_us |
177 | r_nodeid r_len r_name */ | 178 | r_nodeid r_len r_name */ |
178 | 179 | ||
179 | seq_printf(s, "%x %d %x %u %llu %x %x %d %d %d %u %u %d \"%s\"\n", | 180 | seq_printf(s, "%x %d %x %u %llu %x %x %d %d %d %llu %u %d \"%s\"\n", |
180 | lkb->lkb_id, | 181 | lkb->lkb_id, |
181 | lkb->lkb_nodeid, | 182 | lkb->lkb_nodeid, |
182 | lkb->lkb_remid, | 183 | lkb->lkb_remid, |
@@ -187,26 +188,114 @@ static void print_lock(struct seq_file *s, struct dlm_lkb *lkb, struct dlm_rsb * | |||
187 | lkb->lkb_status, | 188 | lkb->lkb_status, |
188 | lkb->lkb_grmode, | 189 | lkb->lkb_grmode, |
189 | lkb->lkb_rqmode, | 190 | lkb->lkb_rqmode, |
190 | waiting, | 191 | (unsigned long long)us, |
191 | r->res_nodeid, | 192 | r->res_nodeid, |
192 | r->res_length, | 193 | r->res_length, |
193 | r->res_name); | 194 | r->res_name); |
194 | } | 195 | } |
195 | 196 | ||
196 | static int print_locks(struct dlm_rsb *r, struct seq_file *s) | 197 | static int print_format2(struct dlm_rsb *r, struct seq_file *s) |
197 | { | 198 | { |
198 | struct dlm_lkb *lkb; | 199 | struct dlm_lkb *lkb; |
199 | 200 | ||
200 | lock_rsb(r); | 201 | lock_rsb(r); |
201 | 202 | ||
202 | list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) | 203 | list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) |
203 | print_lock(s, lkb, r); | 204 | print_format2_lock(s, lkb, r); |
204 | 205 | ||
205 | list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) | 206 | list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) |
206 | print_lock(s, lkb, r); | 207 | print_format2_lock(s, lkb, r); |
207 | 208 | ||
208 | list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) | 209 | list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) |
209 | print_lock(s, lkb, r); | 210 | print_format2_lock(s, lkb, r); |
211 | |||
212 | unlock_rsb(r); | ||
213 | return 0; | ||
214 | } | ||
215 | |||
216 | static void print_format3_lock(struct seq_file *s, struct dlm_lkb *lkb, | ||
217 | int rsb_lookup) | ||
218 | { | ||
219 | u64 xid = 0; | ||
220 | |||
221 | if (lkb->lkb_flags & DLM_IFL_USER) { | ||
222 | if (lkb->lkb_ua) | ||
223 | xid = lkb->lkb_ua->xid; | ||
224 | } | ||
225 | |||
226 | seq_printf(s, "lkb %x %d %x %u %llu %x %x %d %d %d %d %d %d %u %llu %llu\n", | ||
227 | lkb->lkb_id, | ||
228 | lkb->lkb_nodeid, | ||
229 | lkb->lkb_remid, | ||
230 | lkb->lkb_ownpid, | ||
231 | (unsigned long long)xid, | ||
232 | lkb->lkb_exflags, | ||
233 | lkb->lkb_flags, | ||
234 | lkb->lkb_status, | ||
235 | lkb->lkb_grmode, | ||
236 | lkb->lkb_rqmode, | ||
237 | lkb->lkb_highbast, | ||
238 | rsb_lookup, | ||
239 | lkb->lkb_wait_type, | ||
240 | lkb->lkb_lvbseq, | ||
241 | (unsigned long long)ktime_to_ns(lkb->lkb_timestamp), | ||
242 | (unsigned long long)ktime_to_ns(lkb->lkb_time_bast)); | ||
243 | } | ||
244 | |||
245 | static int print_format3(struct dlm_rsb *r, struct seq_file *s) | ||
246 | { | ||
247 | struct dlm_lkb *lkb; | ||
248 | int i, lvblen = r->res_ls->ls_lvblen; | ||
249 | int print_name = 1; | ||
250 | |||
251 | lock_rsb(r); | ||
252 | |||
253 | seq_printf(s, "rsb %p %d %x %lx %d %d %u %d ", | ||
254 | r, | ||
255 | r->res_nodeid, | ||
256 | r->res_first_lkid, | ||
257 | r->res_flags, | ||
258 | !list_empty(&r->res_root_list), | ||
259 | !list_empty(&r->res_recover_list), | ||
260 | r->res_recover_locks_count, | ||
261 | r->res_length); | ||
262 | |||
263 | for (i = 0; i < r->res_length; i++) { | ||
264 | if (!isascii(r->res_name[i]) || !isprint(r->res_name[i])) | ||
265 | print_name = 0; | ||
266 | } | ||
267 | |||
268 | seq_printf(s, "%s", print_name ? "str " : "hex"); | ||
269 | |||
270 | for (i = 0; i < r->res_length; i++) { | ||
271 | if (print_name) | ||
272 | seq_printf(s, "%c", r->res_name[i]); | ||
273 | else | ||
274 | seq_printf(s, " %02x", (unsigned char)r->res_name[i]); | ||
275 | } | ||
276 | seq_printf(s, "\n"); | ||
277 | |||
278 | if (!r->res_lvbptr) | ||
279 | goto do_locks; | ||
280 | |||
281 | seq_printf(s, "lvb %u %d", r->res_lvbseq, lvblen); | ||
282 | |||
283 | for (i = 0; i < lvblen; i++) | ||
284 | seq_printf(s, " %02x", (unsigned char)r->res_lvbptr[i]); | ||
285 | seq_printf(s, "\n"); | ||
286 | |||
287 | do_locks: | ||
288 | list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) | ||
289 | print_format3_lock(s, lkb, 0); | ||
290 | |||
291 | list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) | ||
292 | print_format3_lock(s, lkb, 0); | ||
293 | |||
294 | list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) | ||
295 | print_format3_lock(s, lkb, 0); | ||
296 | |||
297 | list_for_each_entry(lkb, &r->res_lookup, lkb_rsb_lookup) | ||
298 | print_format3_lock(s, lkb, 1); | ||
210 | 299 | ||
211 | unlock_rsb(r); | 300 | unlock_rsb(r); |
212 | return 0; | 301 | return 0; |
@@ -231,7 +320,7 @@ static int rsb_iter_next(struct rsb_iter *ri) | |||
231 | break; | 320 | break; |
232 | } | 321 | } |
233 | read_unlock(&ls->ls_rsbtbl[i].lock); | 322 | read_unlock(&ls->ls_rsbtbl[i].lock); |
234 | } | 323 | } |
235 | ri->entry = i; | 324 | ri->entry = i; |
236 | 325 | ||
237 | if (ri->entry >= ls->ls_rsbtbl_size) | 326 | if (ri->entry >= ls->ls_rsbtbl_size) |
@@ -248,7 +337,7 @@ static int rsb_iter_next(struct rsb_iter *ri) | |||
248 | read_unlock(&ls->ls_rsbtbl[i].lock); | 337 | read_unlock(&ls->ls_rsbtbl[i].lock); |
249 | dlm_put_rsb(old); | 338 | dlm_put_rsb(old); |
250 | goto top; | 339 | goto top; |
251 | } | 340 | } |
252 | ri->rsb = list_entry(ri->next, struct dlm_rsb, res_hashchain); | 341 | ri->rsb = list_entry(ri->next, struct dlm_rsb, res_hashchain); |
253 | dlm_hold_rsb(ri->rsb); | 342 | dlm_hold_rsb(ri->rsb); |
254 | read_unlock(&ls->ls_rsbtbl[i].lock); | 343 | read_unlock(&ls->ls_rsbtbl[i].lock); |
@@ -274,6 +363,7 @@ static struct rsb_iter *rsb_iter_init(struct dlm_ls *ls) | |||
274 | ri->ls = ls; | 363 | ri->ls = ls; |
275 | ri->entry = 0; | 364 | ri->entry = 0; |
276 | ri->next = NULL; | 365 | ri->next = NULL; |
366 | ri->format = 1; | ||
277 | 367 | ||
278 | if (rsb_iter_next(ri)) { | 368 | if (rsb_iter_next(ri)) { |
279 | rsb_iter_free(ri); | 369 | rsb_iter_free(ri); |
@@ -325,16 +415,26 @@ static int rsb_seq_show(struct seq_file *file, void *iter_ptr) | |||
325 | { | 415 | { |
326 | struct rsb_iter *ri = iter_ptr; | 416 | struct rsb_iter *ri = iter_ptr; |
327 | 417 | ||
328 | if (ri->locks) { | 418 | switch (ri->format) { |
419 | case 1: | ||
420 | print_format1(ri->rsb, file); | ||
421 | break; | ||
422 | case 2: | ||
329 | if (ri->header) { | 423 | if (ri->header) { |
330 | seq_printf(file, "id nodeid remid pid xid exflags flags " | 424 | seq_printf(file, "id nodeid remid pid xid exflags " |
331 | "sts grmode rqmode time_ms r_nodeid " | 425 | "flags sts grmode rqmode time_ms " |
332 | "r_len r_name\n"); | 426 | "r_nodeid r_len r_name\n"); |
333 | ri->header = 0; | 427 | ri->header = 0; |
334 | } | 428 | } |
335 | print_locks(ri->rsb, file); | 429 | print_format2(ri->rsb, file); |
336 | } else { | 430 | break; |
337 | print_resource(ri->rsb, file); | 431 | case 3: |
432 | if (ri->header) { | ||
433 | seq_printf(file, "version rsb 1.1 lvb 1.1 lkb 1.1\n"); | ||
434 | ri->header = 0; | ||
435 | } | ||
436 | print_format3(ri->rsb, file); | ||
437 | break; | ||
338 | } | 438 | } |
339 | 439 | ||
340 | return 0; | 440 | return 0; |
@@ -385,7 +485,7 @@ static struct rsb_iter *locks_iter_init(struct dlm_ls *ls, loff_t *pos) | |||
385 | ri->ls = ls; | 485 | ri->ls = ls; |
386 | ri->entry = 0; | 486 | ri->entry = 0; |
387 | ri->next = NULL; | 487 | ri->next = NULL; |
388 | ri->locks = 1; | 488 | ri->format = 2; |
389 | 489 | ||
390 | if (*pos == 0) | 490 | if (*pos == 0) |
391 | ri->header = 1; | 491 | ri->header = 1; |
@@ -448,6 +548,84 @@ static const struct file_operations locks_fops = { | |||
448 | }; | 548 | }; |
449 | 549 | ||
450 | /* | 550 | /* |
551 | * Dump all rsb/lvb/lkb state in compact listing, more complete than _locks | ||
552 | * This can replace both formats 1 and 2 eventually. | ||
553 | */ | ||
554 | |||
555 | static struct rsb_iter *all_iter_init(struct dlm_ls *ls, loff_t *pos) | ||
556 | { | ||
557 | struct rsb_iter *ri; | ||
558 | |||
559 | ri = kzalloc(sizeof *ri, GFP_KERNEL); | ||
560 | if (!ri) | ||
561 | return NULL; | ||
562 | |||
563 | ri->ls = ls; | ||
564 | ri->entry = 0; | ||
565 | ri->next = NULL; | ||
566 | ri->format = 3; | ||
567 | |||
568 | if (*pos == 0) | ||
569 | ri->header = 1; | ||
570 | |||
571 | if (rsb_iter_next(ri)) { | ||
572 | rsb_iter_free(ri); | ||
573 | return NULL; | ||
574 | } | ||
575 | |||
576 | return ri; | ||
577 | } | ||
578 | |||
579 | static void *all_seq_start(struct seq_file *file, loff_t *pos) | ||
580 | { | ||
581 | struct rsb_iter *ri; | ||
582 | loff_t n = *pos; | ||
583 | |||
584 | ri = all_iter_init(file->private, pos); | ||
585 | if (!ri) | ||
586 | return NULL; | ||
587 | |||
588 | while (n--) { | ||
589 | if (rsb_iter_next(ri)) { | ||
590 | rsb_iter_free(ri); | ||
591 | return NULL; | ||
592 | } | ||
593 | } | ||
594 | |||
595 | return ri; | ||
596 | } | ||
597 | |||
598 | static struct seq_operations all_seq_ops = { | ||
599 | .start = all_seq_start, | ||
600 | .next = rsb_seq_next, | ||
601 | .stop = rsb_seq_stop, | ||
602 | .show = rsb_seq_show, | ||
603 | }; | ||
604 | |||
605 | static int all_open(struct inode *inode, struct file *file) | ||
606 | { | ||
607 | struct seq_file *seq; | ||
608 | int ret; | ||
609 | |||
610 | ret = seq_open(file, &all_seq_ops); | ||
611 | if (ret) | ||
612 | return ret; | ||
613 | |||
614 | seq = file->private_data; | ||
615 | seq->private = inode->i_private; | ||
616 | |||
617 | return 0; | ||
618 | } | ||
619 | |||
620 | static const struct file_operations all_fops = { | ||
621 | .owner = THIS_MODULE, | ||
622 | .open = all_open, | ||
623 | .read = seq_read, | ||
624 | .llseek = seq_lseek, | ||
625 | .release = seq_release | ||
626 | }; | ||
627 | |||
628 | /* | ||
451 | * dump lkb's on the ls_waiters list | 629 | * dump lkb's on the ls_waiters list |
452 | */ | 630 | */ |
453 | 631 | ||
@@ -489,30 +667,33 @@ static const struct file_operations waiters_fops = { | |||
489 | .read = waiters_read | 667 | .read = waiters_read |
490 | }; | 668 | }; |
491 | 669 | ||
670 | void dlm_delete_debug_file(struct dlm_ls *ls) | ||
671 | { | ||
672 | if (ls->ls_debug_rsb_dentry) | ||
673 | debugfs_remove(ls->ls_debug_rsb_dentry); | ||
674 | if (ls->ls_debug_waiters_dentry) | ||
675 | debugfs_remove(ls->ls_debug_waiters_dentry); | ||
676 | if (ls->ls_debug_locks_dentry) | ||
677 | debugfs_remove(ls->ls_debug_locks_dentry); | ||
678 | if (ls->ls_debug_all_dentry) | ||
679 | debugfs_remove(ls->ls_debug_all_dentry); | ||
680 | } | ||
681 | |||
492 | int dlm_create_debug_file(struct dlm_ls *ls) | 682 | int dlm_create_debug_file(struct dlm_ls *ls) |
493 | { | 683 | { |
494 | char name[DLM_LOCKSPACE_LEN+8]; | 684 | char name[DLM_LOCKSPACE_LEN+8]; |
495 | 685 | ||
686 | /* format 1 */ | ||
687 | |||
496 | ls->ls_debug_rsb_dentry = debugfs_create_file(ls->ls_name, | 688 | ls->ls_debug_rsb_dentry = debugfs_create_file(ls->ls_name, |
497 | S_IFREG | S_IRUGO, | 689 | S_IFREG | S_IRUGO, |
498 | dlm_root, | 690 | dlm_root, |
499 | ls, | 691 | ls, |
500 | &rsb_fops); | 692 | &rsb_fops); |
501 | if (!ls->ls_debug_rsb_dentry) | 693 | if (!ls->ls_debug_rsb_dentry) |
502 | return -ENOMEM; | 694 | goto fail; |
503 | 695 | ||
504 | memset(name, 0, sizeof(name)); | 696 | /* format 2 */ |
505 | snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_waiters", ls->ls_name); | ||
506 | |||
507 | ls->ls_debug_waiters_dentry = debugfs_create_file(name, | ||
508 | S_IFREG | S_IRUGO, | ||
509 | dlm_root, | ||
510 | ls, | ||
511 | &waiters_fops); | ||
512 | if (!ls->ls_debug_waiters_dentry) { | ||
513 | debugfs_remove(ls->ls_debug_rsb_dentry); | ||
514 | return -ENOMEM; | ||
515 | } | ||
516 | 697 | ||
517 | memset(name, 0, sizeof(name)); | 698 | memset(name, 0, sizeof(name)); |
518 | snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_locks", ls->ls_name); | 699 | snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_locks", ls->ls_name); |
@@ -522,23 +703,38 @@ int dlm_create_debug_file(struct dlm_ls *ls) | |||
522 | dlm_root, | 703 | dlm_root, |
523 | ls, | 704 | ls, |
524 | &locks_fops); | 705 | &locks_fops); |
525 | if (!ls->ls_debug_locks_dentry) { | 706 | if (!ls->ls_debug_locks_dentry) |
526 | debugfs_remove(ls->ls_debug_waiters_dentry); | 707 | goto fail; |
527 | debugfs_remove(ls->ls_debug_rsb_dentry); | 708 | |
528 | return -ENOMEM; | 709 | /* format 3 */ |
529 | } | 710 | |
711 | memset(name, 0, sizeof(name)); | ||
712 | snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_all", ls->ls_name); | ||
713 | |||
714 | ls->ls_debug_all_dentry = debugfs_create_file(name, | ||
715 | S_IFREG | S_IRUGO, | ||
716 | dlm_root, | ||
717 | ls, | ||
718 | &all_fops); | ||
719 | if (!ls->ls_debug_all_dentry) | ||
720 | goto fail; | ||
721 | |||
722 | memset(name, 0, sizeof(name)); | ||
723 | snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_waiters", ls->ls_name); | ||
724 | |||
725 | ls->ls_debug_waiters_dentry = debugfs_create_file(name, | ||
726 | S_IFREG | S_IRUGO, | ||
727 | dlm_root, | ||
728 | ls, | ||
729 | &waiters_fops); | ||
730 | if (!ls->ls_debug_waiters_dentry) | ||
731 | goto fail; | ||
530 | 732 | ||
531 | return 0; | 733 | return 0; |
532 | } | ||
533 | 734 | ||
534 | void dlm_delete_debug_file(struct dlm_ls *ls) | 735 | fail: |
535 | { | 736 | dlm_delete_debug_file(ls); |
536 | if (ls->ls_debug_rsb_dentry) | 737 | return -ENOMEM; |
537 | debugfs_remove(ls->ls_debug_rsb_dentry); | ||
538 | if (ls->ls_debug_waiters_dentry) | ||
539 | debugfs_remove(ls->ls_debug_waiters_dentry); | ||
540 | if (ls->ls_debug_locks_dentry) | ||
541 | debugfs_remove(ls->ls_debug_locks_dentry); | ||
542 | } | 738 | } |
543 | 739 | ||
544 | int __init dlm_register_debugfs(void) | 740 | int __init dlm_register_debugfs(void) |
diff --git a/fs/dlm/dir.c b/fs/dlm/dir.c index 85defeb64df4..92969f879a17 100644 --- a/fs/dlm/dir.c +++ b/fs/dlm/dir.c | |||
@@ -374,7 +374,7 @@ void dlm_copy_master_names(struct dlm_ls *ls, char *inbuf, int inlen, | |||
374 | struct list_head *list; | 374 | struct list_head *list; |
375 | struct dlm_rsb *r; | 375 | struct dlm_rsb *r; |
376 | int offset = 0, dir_nodeid; | 376 | int offset = 0, dir_nodeid; |
377 | uint16_t be_namelen; | 377 | __be16 be_namelen; |
378 | 378 | ||
379 | down_read(&ls->ls_root_sem); | 379 | down_read(&ls->ls_root_sem); |
380 | 380 | ||
@@ -410,15 +410,15 @@ void dlm_copy_master_names(struct dlm_ls *ls, char *inbuf, int inlen, | |||
410 | 410 | ||
411 | if (offset + sizeof(uint16_t)*2 + r->res_length > outlen) { | 411 | if (offset + sizeof(uint16_t)*2 + r->res_length > outlen) { |
412 | /* Write end-of-block record */ | 412 | /* Write end-of-block record */ |
413 | be_namelen = 0; | 413 | be_namelen = cpu_to_be16(0); |
414 | memcpy(outbuf + offset, &be_namelen, sizeof(uint16_t)); | 414 | memcpy(outbuf + offset, &be_namelen, sizeof(__be16)); |
415 | offset += sizeof(uint16_t); | 415 | offset += sizeof(__be16); |
416 | goto out; | 416 | goto out; |
417 | } | 417 | } |
418 | 418 | ||
419 | be_namelen = cpu_to_be16(r->res_length); | 419 | be_namelen = cpu_to_be16(r->res_length); |
420 | memcpy(outbuf + offset, &be_namelen, sizeof(uint16_t)); | 420 | memcpy(outbuf + offset, &be_namelen, sizeof(__be16)); |
421 | offset += sizeof(uint16_t); | 421 | offset += sizeof(__be16); |
422 | memcpy(outbuf + offset, r->res_name, r->res_length); | 422 | memcpy(outbuf + offset, r->res_name, r->res_length); |
423 | offset += r->res_length; | 423 | offset += r->res_length; |
424 | } | 424 | } |
@@ -430,9 +430,9 @@ void dlm_copy_master_names(struct dlm_ls *ls, char *inbuf, int inlen, | |||
430 | 430 | ||
431 | if ((list == &ls->ls_root_list) && | 431 | if ((list == &ls->ls_root_list) && |
432 | (offset + sizeof(uint16_t) <= outlen)) { | 432 | (offset + sizeof(uint16_t) <= outlen)) { |
433 | be_namelen = 0xFFFF; | 433 | be_namelen = cpu_to_be16(0xFFFF); |
434 | memcpy(outbuf + offset, &be_namelen, sizeof(uint16_t)); | 434 | memcpy(outbuf + offset, &be_namelen, sizeof(__be16)); |
435 | offset += sizeof(uint16_t); | 435 | offset += sizeof(__be16); |
436 | } | 436 | } |
437 | 437 | ||
438 | out: | 438 | out: |
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h index 868e4c9ef127..ef2f1e353966 100644 --- a/fs/dlm/dlm_internal.h +++ b/fs/dlm/dlm_internal.h | |||
@@ -245,7 +245,8 @@ struct dlm_lkb { | |||
245 | struct list_head lkb_astqueue; /* need ast to be sent */ | 245 | struct list_head lkb_astqueue; /* need ast to be sent */ |
246 | struct list_head lkb_ownqueue; /* list of locks for a process */ | 246 | struct list_head lkb_ownqueue; /* list of locks for a process */ |
247 | struct list_head lkb_time_list; | 247 | struct list_head lkb_time_list; |
248 | unsigned long lkb_timestamp; | 248 | ktime_t lkb_time_bast; /* for debugging */ |
249 | ktime_t lkb_timestamp; | ||
249 | unsigned long lkb_timeout_cs; | 250 | unsigned long lkb_timeout_cs; |
250 | 251 | ||
251 | char *lkb_lvbptr; | 252 | char *lkb_lvbptr; |
@@ -481,6 +482,7 @@ struct dlm_ls { | |||
481 | struct dentry *ls_debug_rsb_dentry; /* debugfs */ | 482 | struct dentry *ls_debug_rsb_dentry; /* debugfs */ |
482 | struct dentry *ls_debug_waiters_dentry; /* debugfs */ | 483 | struct dentry *ls_debug_waiters_dentry; /* debugfs */ |
483 | struct dentry *ls_debug_locks_dentry; /* debugfs */ | 484 | struct dentry *ls_debug_locks_dentry; /* debugfs */ |
485 | struct dentry *ls_debug_all_dentry; /* debugfs */ | ||
484 | 486 | ||
485 | wait_queue_head_t ls_uevent_wait; /* user part of join/leave */ | 487 | wait_queue_head_t ls_uevent_wait; /* user part of join/leave */ |
486 | int ls_uevent_result; | 488 | int ls_uevent_result; |
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 724ddac91538..6cfe65bbf4a2 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
@@ -307,7 +307,7 @@ static void queue_cast(struct dlm_rsb *r, struct dlm_lkb *lkb, int rv) | |||
307 | lkb->lkb_lksb->sb_status = rv; | 307 | lkb->lkb_lksb->sb_status = rv; |
308 | lkb->lkb_lksb->sb_flags = lkb->lkb_sbflags; | 308 | lkb->lkb_lksb->sb_flags = lkb->lkb_sbflags; |
309 | 309 | ||
310 | dlm_add_ast(lkb, AST_COMP); | 310 | dlm_add_ast(lkb, AST_COMP, 0); |
311 | } | 311 | } |
312 | 312 | ||
313 | static inline void queue_cast_overlap(struct dlm_rsb *r, struct dlm_lkb *lkb) | 313 | static inline void queue_cast_overlap(struct dlm_rsb *r, struct dlm_lkb *lkb) |
@@ -318,12 +318,12 @@ static inline void queue_cast_overlap(struct dlm_rsb *r, struct dlm_lkb *lkb) | |||
318 | 318 | ||
319 | static void queue_bast(struct dlm_rsb *r, struct dlm_lkb *lkb, int rqmode) | 319 | static void queue_bast(struct dlm_rsb *r, struct dlm_lkb *lkb, int rqmode) |
320 | { | 320 | { |
321 | lkb->lkb_time_bast = ktime_get(); | ||
322 | |||
321 | if (is_master_copy(lkb)) | 323 | if (is_master_copy(lkb)) |
322 | send_bast(r, lkb, rqmode); | 324 | send_bast(r, lkb, rqmode); |
323 | else { | 325 | else |
324 | lkb->lkb_bastmode = rqmode; | 326 | dlm_add_ast(lkb, AST_BAST, rqmode); |
325 | dlm_add_ast(lkb, AST_BAST); | ||
326 | } | ||
327 | } | 327 | } |
328 | 328 | ||
329 | /* | 329 | /* |
@@ -744,6 +744,8 @@ static void add_lkb(struct dlm_rsb *r, struct dlm_lkb *lkb, int status) | |||
744 | 744 | ||
745 | DLM_ASSERT(!lkb->lkb_status, dlm_print_lkb(lkb);); | 745 | DLM_ASSERT(!lkb->lkb_status, dlm_print_lkb(lkb);); |
746 | 746 | ||
747 | lkb->lkb_timestamp = ktime_get(); | ||
748 | |||
747 | lkb->lkb_status = status; | 749 | lkb->lkb_status = status; |
748 | 750 | ||
749 | switch (status) { | 751 | switch (status) { |
@@ -1013,10 +1015,8 @@ static void add_timeout(struct dlm_lkb *lkb) | |||
1013 | { | 1015 | { |
1014 | struct dlm_ls *ls = lkb->lkb_resource->res_ls; | 1016 | struct dlm_ls *ls = lkb->lkb_resource->res_ls; |
1015 | 1017 | ||
1016 | if (is_master_copy(lkb)) { | 1018 | if (is_master_copy(lkb)) |
1017 | lkb->lkb_timestamp = jiffies; | ||
1018 | return; | 1019 | return; |
1019 | } | ||
1020 | 1020 | ||
1021 | if (test_bit(LSFL_TIMEWARN, &ls->ls_flags) && | 1021 | if (test_bit(LSFL_TIMEWARN, &ls->ls_flags) && |
1022 | !(lkb->lkb_exflags & DLM_LKF_NODLCKWT)) { | 1022 | !(lkb->lkb_exflags & DLM_LKF_NODLCKWT)) { |
@@ -1031,7 +1031,6 @@ static void add_timeout(struct dlm_lkb *lkb) | |||
1031 | DLM_ASSERT(list_empty(&lkb->lkb_time_list), dlm_print_lkb(lkb);); | 1031 | DLM_ASSERT(list_empty(&lkb->lkb_time_list), dlm_print_lkb(lkb);); |
1032 | mutex_lock(&ls->ls_timeout_mutex); | 1032 | mutex_lock(&ls->ls_timeout_mutex); |
1033 | hold_lkb(lkb); | 1033 | hold_lkb(lkb); |
1034 | lkb->lkb_timestamp = jiffies; | ||
1035 | list_add_tail(&lkb->lkb_time_list, &ls->ls_timeout); | 1034 | list_add_tail(&lkb->lkb_time_list, &ls->ls_timeout); |
1036 | mutex_unlock(&ls->ls_timeout_mutex); | 1035 | mutex_unlock(&ls->ls_timeout_mutex); |
1037 | } | 1036 | } |
@@ -1059,6 +1058,7 @@ void dlm_scan_timeout(struct dlm_ls *ls) | |||
1059 | struct dlm_rsb *r; | 1058 | struct dlm_rsb *r; |
1060 | struct dlm_lkb *lkb; | 1059 | struct dlm_lkb *lkb; |
1061 | int do_cancel, do_warn; | 1060 | int do_cancel, do_warn; |
1061 | s64 wait_us; | ||
1062 | 1062 | ||
1063 | for (;;) { | 1063 | for (;;) { |
1064 | if (dlm_locking_stopped(ls)) | 1064 | if (dlm_locking_stopped(ls)) |
@@ -1069,14 +1069,15 @@ void dlm_scan_timeout(struct dlm_ls *ls) | |||
1069 | mutex_lock(&ls->ls_timeout_mutex); | 1069 | mutex_lock(&ls->ls_timeout_mutex); |
1070 | list_for_each_entry(lkb, &ls->ls_timeout, lkb_time_list) { | 1070 | list_for_each_entry(lkb, &ls->ls_timeout, lkb_time_list) { |
1071 | 1071 | ||
1072 | wait_us = ktime_to_us(ktime_sub(ktime_get(), | ||
1073 | lkb->lkb_timestamp)); | ||
1074 | |||
1072 | if ((lkb->lkb_exflags & DLM_LKF_TIMEOUT) && | 1075 | if ((lkb->lkb_exflags & DLM_LKF_TIMEOUT) && |
1073 | time_after_eq(jiffies, lkb->lkb_timestamp + | 1076 | wait_us >= (lkb->lkb_timeout_cs * 10000)) |
1074 | lkb->lkb_timeout_cs * HZ/100)) | ||
1075 | do_cancel = 1; | 1077 | do_cancel = 1; |
1076 | 1078 | ||
1077 | if ((lkb->lkb_flags & DLM_IFL_WATCH_TIMEWARN) && | 1079 | if ((lkb->lkb_flags & DLM_IFL_WATCH_TIMEWARN) && |
1078 | time_after_eq(jiffies, lkb->lkb_timestamp + | 1080 | wait_us >= dlm_config.ci_timewarn_cs * 10000) |
1079 | dlm_config.ci_timewarn_cs * HZ/100)) | ||
1080 | do_warn = 1; | 1081 | do_warn = 1; |
1081 | 1082 | ||
1082 | if (!do_cancel && !do_warn) | 1083 | if (!do_cancel && !do_warn) |
@@ -1122,12 +1123,12 @@ void dlm_scan_timeout(struct dlm_ls *ls) | |||
1122 | void dlm_adjust_timeouts(struct dlm_ls *ls) | 1123 | void dlm_adjust_timeouts(struct dlm_ls *ls) |
1123 | { | 1124 | { |
1124 | struct dlm_lkb *lkb; | 1125 | struct dlm_lkb *lkb; |
1125 | long adj = jiffies - ls->ls_recover_begin; | 1126 | u64 adj_us = jiffies_to_usecs(jiffies - ls->ls_recover_begin); |
1126 | 1127 | ||
1127 | ls->ls_recover_begin = 0; | 1128 | ls->ls_recover_begin = 0; |
1128 | mutex_lock(&ls->ls_timeout_mutex); | 1129 | mutex_lock(&ls->ls_timeout_mutex); |
1129 | list_for_each_entry(lkb, &ls->ls_timeout, lkb_time_list) | 1130 | list_for_each_entry(lkb, &ls->ls_timeout, lkb_time_list) |
1130 | lkb->lkb_timestamp += adj; | 1131 | lkb->lkb_timestamp = ktime_add_us(lkb->lkb_timestamp, adj_us); |
1131 | mutex_unlock(&ls->ls_timeout_mutex); | 1132 | mutex_unlock(&ls->ls_timeout_mutex); |
1132 | } | 1133 | } |
1133 | 1134 | ||
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 3962262f991a..103a5ebd1371 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -295,6 +295,7 @@ static int add_sock(struct socket *sock, struct connection *con) | |||
295 | con->sock->sk->sk_write_space = lowcomms_write_space; | 295 | con->sock->sk->sk_write_space = lowcomms_write_space; |
296 | con->sock->sk->sk_state_change = lowcomms_state_change; | 296 | con->sock->sk->sk_state_change = lowcomms_state_change; |
297 | con->sock->sk->sk_user_data = con; | 297 | con->sock->sk->sk_user_data = con; |
298 | con->sock->sk->sk_allocation = GFP_NOFS; | ||
298 | return 0; | 299 | return 0; |
299 | } | 300 | } |
300 | 301 | ||
@@ -823,7 +824,6 @@ static void sctp_init_assoc(struct connection *con) | |||
823 | len = e->len; | 824 | len = e->len; |
824 | offset = e->offset; | 825 | offset = e->offset; |
825 | spin_unlock(&con->writequeue_lock); | 826 | spin_unlock(&con->writequeue_lock); |
826 | kmap(e->page); | ||
827 | 827 | ||
828 | /* Send the first block off the write queue */ | 828 | /* Send the first block off the write queue */ |
829 | iov[0].iov_base = page_address(e->page)+offset; | 829 | iov[0].iov_base = page_address(e->page)+offset; |
@@ -854,7 +854,6 @@ static void sctp_init_assoc(struct connection *con) | |||
854 | 854 | ||
855 | if (e->len == 0 && e->users == 0) { | 855 | if (e->len == 0 && e->users == 0) { |
856 | list_del(&e->list); | 856 | list_del(&e->list); |
857 | kunmap(e->page); | ||
858 | free_entry(e); | 857 | free_entry(e); |
859 | } | 858 | } |
860 | spin_unlock(&con->writequeue_lock); | 859 | spin_unlock(&con->writequeue_lock); |
@@ -1203,8 +1202,6 @@ void *dlm_lowcomms_get_buffer(int nodeid, int len, gfp_t allocation, char **ppc) | |||
1203 | 1202 | ||
1204 | if (e) { | 1203 | if (e) { |
1205 | got_one: | 1204 | got_one: |
1206 | if (users == 0) | ||
1207 | kmap(e->page); | ||
1208 | *ppc = page_address(e->page) + offset; | 1205 | *ppc = page_address(e->page) + offset; |
1209 | return e; | 1206 | return e; |
1210 | } | 1207 | } |
@@ -1233,7 +1230,6 @@ void dlm_lowcomms_commit_buffer(void *mh) | |||
1233 | if (users) | 1230 | if (users) |
1234 | goto out; | 1231 | goto out; |
1235 | e->len = e->end - e->offset; | 1232 | e->len = e->end - e->offset; |
1236 | kunmap(e->page); | ||
1237 | spin_unlock(&con->writequeue_lock); | 1233 | spin_unlock(&con->writequeue_lock); |
1238 | 1234 | ||
1239 | if (!test_and_set_bit(CF_WRITE_PENDING, &con->flags)) { | 1235 | if (!test_and_set_bit(CF_WRITE_PENDING, &con->flags)) { |
@@ -1272,7 +1268,6 @@ static void send_to_sock(struct connection *con) | |||
1272 | offset = e->offset; | 1268 | offset = e->offset; |
1273 | BUG_ON(len == 0 && e->users == 0); | 1269 | BUG_ON(len == 0 && e->users == 0); |
1274 | spin_unlock(&con->writequeue_lock); | 1270 | spin_unlock(&con->writequeue_lock); |
1275 | kmap(e->page); | ||
1276 | 1271 | ||
1277 | ret = 0; | 1272 | ret = 0; |
1278 | if (len) { | 1273 | if (len) { |
@@ -1294,7 +1289,6 @@ static void send_to_sock(struct connection *con) | |||
1294 | 1289 | ||
1295 | if (e->len == 0 && e->users == 0) { | 1290 | if (e->len == 0 && e->users == 0) { |
1296 | list_del(&e->list); | 1291 | list_del(&e->list); |
1297 | kunmap(e->page); | ||
1298 | free_entry(e); | 1292 | free_entry(e); |
1299 | continue; | 1293 | continue; |
1300 | } | 1294 | } |
diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c index 54c14c6d06cb..c1775b84ebab 100644 --- a/fs/dlm/memory.c +++ b/fs/dlm/memory.c | |||
@@ -39,7 +39,7 @@ char *dlm_allocate_lvb(struct dlm_ls *ls) | |||
39 | { | 39 | { |
40 | char *p; | 40 | char *p; |
41 | 41 | ||
42 | p = kzalloc(ls->ls_lvblen, GFP_KERNEL); | 42 | p = kzalloc(ls->ls_lvblen, ls->ls_allocation); |
43 | return p; | 43 | return p; |
44 | } | 44 | } |
45 | 45 | ||
@@ -57,7 +57,7 @@ struct dlm_rsb *dlm_allocate_rsb(struct dlm_ls *ls, int namelen) | |||
57 | 57 | ||
58 | DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,); | 58 | DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,); |
59 | 59 | ||
60 | r = kzalloc(sizeof(*r) + namelen, GFP_KERNEL); | 60 | r = kzalloc(sizeof(*r) + namelen, ls->ls_allocation); |
61 | return r; | 61 | return r; |
62 | } | 62 | } |
63 | 63 | ||
@@ -72,7 +72,7 @@ struct dlm_lkb *dlm_allocate_lkb(struct dlm_ls *ls) | |||
72 | { | 72 | { |
73 | struct dlm_lkb *lkb; | 73 | struct dlm_lkb *lkb; |
74 | 74 | ||
75 | lkb = kmem_cache_zalloc(lkb_cache, GFP_KERNEL); | 75 | lkb = kmem_cache_zalloc(lkb_cache, ls->ls_allocation); |
76 | return lkb; | 76 | return lkb; |
77 | } | 77 | } |
78 | 78 | ||
diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c index 07ac709f3ed7..f3396c622aec 100644 --- a/fs/dlm/midcomms.c +++ b/fs/dlm/midcomms.c | |||
@@ -112,7 +112,7 @@ int dlm_process_incoming_buffer(int nodeid, const void *base, | |||
112 | ordinary messages). */ | 112 | ordinary messages). */ |
113 | 113 | ||
114 | if (msglen > sizeof(__tmp) && p == &__tmp.p) { | 114 | if (msglen > sizeof(__tmp) && p == &__tmp.p) { |
115 | p = kmalloc(dlm_config.ci_buffer_size, GFP_KERNEL); | 115 | p = kmalloc(dlm_config.ci_buffer_size, GFP_NOFS); |
116 | if (p == NULL) | 116 | if (p == NULL) |
117 | return ret; | 117 | return ret; |
118 | } | 118 | } |
diff --git a/fs/dlm/netlink.c b/fs/dlm/netlink.c index aa2a5775a027..ccc9d62c462d 100644 --- a/fs/dlm/netlink.c +++ b/fs/dlm/netlink.c | |||
@@ -115,7 +115,6 @@ static void fill_data(struct dlm_lock_data *data, struct dlm_lkb *lkb) | |||
115 | data->status = lkb->lkb_status; | 115 | data->status = lkb->lkb_status; |
116 | data->grmode = lkb->lkb_grmode; | 116 | data->grmode = lkb->lkb_grmode; |
117 | data->rqmode = lkb->lkb_rqmode; | 117 | data->rqmode = lkb->lkb_rqmode; |
118 | data->timestamp = lkb->lkb_timestamp; | ||
119 | if (lkb->lkb_ua) | 118 | if (lkb->lkb_ua) |
120 | data->xid = lkb->lkb_ua->xid; | 119 | data->xid = lkb->lkb_ua->xid; |
121 | if (r) { | 120 | if (r) { |
diff --git a/fs/dlm/user.c b/fs/dlm/user.c index b3832c67194a..065149e84f42 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c | |||
@@ -175,7 +175,7 @@ static int lkb_is_endoflife(struct dlm_lkb *lkb, int sb_status, int type) | |||
175 | /* we could possibly check if the cancel of an orphan has resulted in the lkb | 175 | /* we could possibly check if the cancel of an orphan has resulted in the lkb |
176 | being removed and then remove that lkb from the orphans list and free it */ | 176 | being removed and then remove that lkb from the orphans list and free it */ |
177 | 177 | ||
178 | void dlm_user_add_ast(struct dlm_lkb *lkb, int type) | 178 | void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int bastmode) |
179 | { | 179 | { |
180 | struct dlm_ls *ls; | 180 | struct dlm_ls *ls; |
181 | struct dlm_user_args *ua; | 181 | struct dlm_user_args *ua; |
@@ -208,6 +208,8 @@ void dlm_user_add_ast(struct dlm_lkb *lkb, int type) | |||
208 | 208 | ||
209 | ast_type = lkb->lkb_ast_type; | 209 | ast_type = lkb->lkb_ast_type; |
210 | lkb->lkb_ast_type |= type; | 210 | lkb->lkb_ast_type |= type; |
211 | if (bastmode) | ||
212 | lkb->lkb_bastmode = bastmode; | ||
211 | 213 | ||
212 | if (!ast_type) { | 214 | if (!ast_type) { |
213 | kref_get(&lkb->lkb_ref); | 215 | kref_get(&lkb->lkb_ref); |
diff --git a/fs/dlm/user.h b/fs/dlm/user.h index 35eb6a13d616..1c9686492286 100644 --- a/fs/dlm/user.h +++ b/fs/dlm/user.h | |||
@@ -9,7 +9,7 @@ | |||
9 | #ifndef __USER_DOT_H__ | 9 | #ifndef __USER_DOT_H__ |
10 | #define __USER_DOT_H__ | 10 | #define __USER_DOT_H__ |
11 | 11 | ||
12 | void dlm_user_add_ast(struct dlm_lkb *lkb, int type); | 12 | void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int bastmode); |
13 | int dlm_user_init(void); | 13 | int dlm_user_init(void); |
14 | void dlm_user_exit(void); | 14 | void dlm_user_exit(void); |
15 | int dlm_device_deregister(struct dlm_ls *ls); | 15 | int dlm_device_deregister(struct dlm_ls *ls); |