diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-26 20:19:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-26 20:19:30 -0500 |
commit | 4cbd55188fe01f22783815cbb6d4f55a0ebf5969 (patch) | |
tree | cbefb228c717bc53542452b44d5349c3665845ee /fs | |
parent | b305956abc3c50c52598bbf39b7a5f4850058ba8 (diff) | |
parent | b6fa8796b2da0390e9f4115e8789a01004fc1c9b (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: use bastmode in debugfs output
dlm: Send lockspace name with uevents
dlm: send reply before bast
dlm: fix ordering of bast and cast
Diffstat (limited to 'fs')
-rw-r--r-- | fs/dlm/ast.c | 74 | ||||
-rw-r--r-- | fs/dlm/ast.h | 4 | ||||
-rw-r--r-- | fs/dlm/debug_fs.c | 2 | ||||
-rw-r--r-- | fs/dlm/dlm_internal.h | 10 | ||||
-rw-r--r-- | fs/dlm/lock.c | 120 | ||||
-rw-r--r-- | fs/dlm/lockspace.c | 14 | ||||
-rw-r--r-- | fs/dlm/user.c | 10 | ||||
-rw-r--r-- | fs/dlm/user.h | 4 |
8 files changed, 180 insertions, 58 deletions
diff --git a/fs/dlm/ast.c b/fs/dlm/ast.c index dc2ad6008b2d..4314f0d48d85 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-2008 Red Hat, Inc. All rights reserved. | 5 | ** Copyright (C) 2004-2010 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, int bastmode) | 36 | void dlm_add_ast(struct dlm_lkb *lkb, int type, int mode) |
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, bastmode); | 39 | dlm_user_add_ast(lkb, type, mode); |
40 | return; | 40 | return; |
41 | } | 41 | } |
42 | 42 | ||
@@ -44,10 +44,21 @@ void dlm_add_ast(struct dlm_lkb *lkb, int type, int bastmode) | |||
44 | if (!(lkb->lkb_ast_type & (AST_COMP | AST_BAST))) { | 44 | if (!(lkb->lkb_ast_type & (AST_COMP | AST_BAST))) { |
45 | kref_get(&lkb->lkb_ref); | 45 | kref_get(&lkb->lkb_ref); |
46 | list_add_tail(&lkb->lkb_astqueue, &ast_queue); | 46 | list_add_tail(&lkb->lkb_astqueue, &ast_queue); |
47 | lkb->lkb_ast_first = type; | ||
47 | } | 48 | } |
49 | |||
50 | /* sanity check, this should not happen */ | ||
51 | |||
52 | if ((type == AST_COMP) && (lkb->lkb_ast_type & AST_COMP)) | ||
53 | log_print("repeat cast %d castmode %d lock %x %s", | ||
54 | mode, lkb->lkb_castmode, | ||
55 | lkb->lkb_id, lkb->lkb_resource->res_name); | ||
56 | |||
48 | lkb->lkb_ast_type |= type; | 57 | lkb->lkb_ast_type |= type; |
49 | if (bastmode) | 58 | if (type == AST_BAST) |
50 | lkb->lkb_bastmode = bastmode; | 59 | lkb->lkb_bastmode = mode; |
60 | else | ||
61 | lkb->lkb_castmode = mode; | ||
51 | spin_unlock(&ast_queue_lock); | 62 | spin_unlock(&ast_queue_lock); |
52 | 63 | ||
53 | set_bit(WAKE_ASTS, &astd_wakeflags); | 64 | set_bit(WAKE_ASTS, &astd_wakeflags); |
@@ -59,9 +70,9 @@ static void process_asts(void) | |||
59 | struct dlm_ls *ls = NULL; | 70 | struct dlm_ls *ls = NULL; |
60 | struct dlm_rsb *r = NULL; | 71 | struct dlm_rsb *r = NULL; |
61 | struct dlm_lkb *lkb; | 72 | struct dlm_lkb *lkb; |
62 | void (*cast) (void *astparam); | 73 | void (*castfn) (void *astparam); |
63 | void (*bast) (void *astparam, int mode); | 74 | void (*bastfn) (void *astparam, int mode); |
64 | int type = 0, bastmode; | 75 | int type, first, bastmode, castmode, do_bast, do_cast, last_castmode; |
65 | 76 | ||
66 | repeat: | 77 | repeat: |
67 | spin_lock(&ast_queue_lock); | 78 | spin_lock(&ast_queue_lock); |
@@ -75,17 +86,48 @@ repeat: | |||
75 | list_del(&lkb->lkb_astqueue); | 86 | list_del(&lkb->lkb_astqueue); |
76 | type = lkb->lkb_ast_type; | 87 | type = lkb->lkb_ast_type; |
77 | lkb->lkb_ast_type = 0; | 88 | lkb->lkb_ast_type = 0; |
89 | first = lkb->lkb_ast_first; | ||
90 | lkb->lkb_ast_first = 0; | ||
78 | bastmode = lkb->lkb_bastmode; | 91 | bastmode = lkb->lkb_bastmode; |
79 | 92 | castmode = lkb->lkb_castmode; | |
93 | castfn = lkb->lkb_astfn; | ||
94 | bastfn = lkb->lkb_bastfn; | ||
80 | spin_unlock(&ast_queue_lock); | 95 | spin_unlock(&ast_queue_lock); |
81 | cast = lkb->lkb_astfn; | ||
82 | bast = lkb->lkb_bastfn; | ||
83 | |||
84 | if ((type & AST_COMP) && cast) | ||
85 | cast(lkb->lkb_astparam); | ||
86 | 96 | ||
87 | if ((type & AST_BAST) && bast) | 97 | do_cast = (type & AST_COMP) && castfn; |
88 | bast(lkb->lkb_astparam, bastmode); | 98 | do_bast = (type & AST_BAST) && bastfn; |
99 | |||
100 | /* Skip a bast if its blocking mode is compatible with the | ||
101 | granted mode of the preceding cast. */ | ||
102 | |||
103 | if (do_bast) { | ||
104 | if (first == AST_COMP) | ||
105 | last_castmode = castmode; | ||
106 | else | ||
107 | last_castmode = lkb->lkb_castmode_done; | ||
108 | if (dlm_modes_compat(bastmode, last_castmode)) | ||
109 | do_bast = 0; | ||
110 | } | ||
111 | |||
112 | if (first == AST_COMP) { | ||
113 | if (do_cast) | ||
114 | castfn(lkb->lkb_astparam); | ||
115 | if (do_bast) | ||
116 | bastfn(lkb->lkb_astparam, bastmode); | ||
117 | } else if (first == AST_BAST) { | ||
118 | if (do_bast) | ||
119 | bastfn(lkb->lkb_astparam, bastmode); | ||
120 | if (do_cast) | ||
121 | castfn(lkb->lkb_astparam); | ||
122 | } else { | ||
123 | log_error(ls, "bad ast_first %d ast_type %d", | ||
124 | first, type); | ||
125 | } | ||
126 | |||
127 | if (do_cast) | ||
128 | lkb->lkb_castmode_done = castmode; | ||
129 | if (do_bast) | ||
130 | lkb->lkb_bastmode_done = bastmode; | ||
89 | 131 | ||
90 | /* this removes the reference added by dlm_add_ast | 132 | /* this removes the reference added by dlm_add_ast |
91 | and may result in the lkb being freed */ | 133 | and may result in the lkb being freed */ |
diff --git a/fs/dlm/ast.h b/fs/dlm/ast.h index 1b5fc5f428fd..bcb1aaba519d 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-2008 Red Hat, Inc. All rights reserved. | 4 | ** Copyright (C) 2005-2010 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, int bastmode); | 16 | void dlm_add_ast(struct dlm_lkb *lkb, int type, int mode); |
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 375a2359b3bf..29d6139c35fc 100644 --- a/fs/dlm/debug_fs.c +++ b/fs/dlm/debug_fs.c | |||
@@ -256,7 +256,7 @@ static int print_format3_lock(struct seq_file *s, struct dlm_lkb *lkb, | |||
256 | lkb->lkb_status, | 256 | lkb->lkb_status, |
257 | lkb->lkb_grmode, | 257 | lkb->lkb_grmode, |
258 | lkb->lkb_rqmode, | 258 | lkb->lkb_rqmode, |
259 | lkb->lkb_highbast, | 259 | lkb->lkb_bastmode, |
260 | rsb_lookup, | 260 | rsb_lookup, |
261 | lkb->lkb_wait_type, | 261 | lkb->lkb_wait_type, |
262 | lkb->lkb_lvbseq, | 262 | lkb->lkb_lvbseq, |
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h index 826d3dc6e0ab..f632b58cd222 100644 --- a/fs/dlm/dlm_internal.h +++ b/fs/dlm/dlm_internal.h | |||
@@ -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-2008 Red Hat, Inc. All rights reserved. | 5 | ** Copyright (C) 2004-2010 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 |
@@ -232,11 +232,17 @@ struct dlm_lkb { | |||
232 | int8_t lkb_status; /* granted, waiting, convert */ | 232 | int8_t lkb_status; /* granted, waiting, convert */ |
233 | int8_t lkb_rqmode; /* requested lock mode */ | 233 | int8_t lkb_rqmode; /* requested lock mode */ |
234 | int8_t lkb_grmode; /* granted lock mode */ | 234 | int8_t lkb_grmode; /* granted lock mode */ |
235 | int8_t lkb_bastmode; /* requested mode */ | ||
236 | int8_t lkb_highbast; /* highest mode bast sent for */ | 235 | int8_t lkb_highbast; /* highest mode bast sent for */ |
236 | |||
237 | int8_t lkb_wait_type; /* type of reply waiting for */ | 237 | int8_t lkb_wait_type; /* type of reply waiting for */ |
238 | int8_t lkb_wait_count; | 238 | int8_t lkb_wait_count; |
239 | int8_t lkb_ast_type; /* type of ast queued for */ | 239 | int8_t lkb_ast_type; /* type of ast queued for */ |
240 | int8_t lkb_ast_first; /* type of first ast queued */ | ||
241 | |||
242 | int8_t lkb_bastmode; /* req mode of queued bast */ | ||
243 | int8_t lkb_castmode; /* gr mode of queued cast */ | ||
244 | int8_t lkb_bastmode_done; /* last delivered bastmode */ | ||
245 | int8_t lkb_castmode_done; /* last delivered castmode */ | ||
240 | 246 | ||
241 | struct list_head lkb_idtbl_list; /* lockspace lkbtbl */ | 247 | struct list_head lkb_idtbl_list; /* lockspace lkbtbl */ |
242 | struct list_head lkb_statequeue; /* rsb g/c/w list */ | 248 | struct list_head lkb_statequeue; /* rsb g/c/w list */ |
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 9c0c1db1e105..46ffd3eeaaf7 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | ******************************************************************************* | 2 | ******************************************************************************* |
3 | ** | 3 | ** |
4 | ** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. | 4 | ** Copyright (C) 2005-2010 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 |
@@ -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, 0); | 310 | dlm_add_ast(lkb, AST_COMP, lkb->lkb_grmode); |
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) |
@@ -320,10 +320,12 @@ static void queue_bast(struct dlm_rsb *r, struct dlm_lkb *lkb, int rqmode) | |||
320 | { | 320 | { |
321 | lkb->lkb_time_bast = ktime_get(); | 321 | lkb->lkb_time_bast = ktime_get(); |
322 | 322 | ||
323 | if (is_master_copy(lkb)) | 323 | if (is_master_copy(lkb)) { |
324 | lkb->lkb_bastmode = rqmode; /* printed by debugfs */ | ||
324 | send_bast(r, lkb, rqmode); | 325 | send_bast(r, lkb, rqmode); |
325 | else | 326 | } else { |
326 | dlm_add_ast(lkb, AST_BAST, rqmode); | 327 | dlm_add_ast(lkb, AST_BAST, rqmode); |
328 | } | ||
327 | } | 329 | } |
328 | 330 | ||
329 | /* | 331 | /* |
@@ -2280,20 +2282,30 @@ static int do_request(struct dlm_rsb *r, struct dlm_lkb *lkb) | |||
2280 | if (can_be_queued(lkb)) { | 2282 | if (can_be_queued(lkb)) { |
2281 | error = -EINPROGRESS; | 2283 | error = -EINPROGRESS; |
2282 | add_lkb(r, lkb, DLM_LKSTS_WAITING); | 2284 | add_lkb(r, lkb, DLM_LKSTS_WAITING); |
2283 | send_blocking_asts(r, lkb); | ||
2284 | add_timeout(lkb); | 2285 | add_timeout(lkb); |
2285 | goto out; | 2286 | goto out; |
2286 | } | 2287 | } |
2287 | 2288 | ||
2288 | error = -EAGAIN; | 2289 | error = -EAGAIN; |
2289 | if (force_blocking_asts(lkb)) | ||
2290 | send_blocking_asts_all(r, lkb); | ||
2291 | queue_cast(r, lkb, -EAGAIN); | 2290 | queue_cast(r, lkb, -EAGAIN); |
2292 | |||
2293 | out: | 2291 | out: |
2294 | return error; | 2292 | return error; |
2295 | } | 2293 | } |
2296 | 2294 | ||
2295 | static void do_request_effects(struct dlm_rsb *r, struct dlm_lkb *lkb, | ||
2296 | int error) | ||
2297 | { | ||
2298 | switch (error) { | ||
2299 | case -EAGAIN: | ||
2300 | if (force_blocking_asts(lkb)) | ||
2301 | send_blocking_asts_all(r, lkb); | ||
2302 | break; | ||
2303 | case -EINPROGRESS: | ||
2304 | send_blocking_asts(r, lkb); | ||
2305 | break; | ||
2306 | } | ||
2307 | } | ||
2308 | |||
2297 | static int do_convert(struct dlm_rsb *r, struct dlm_lkb *lkb) | 2309 | static int do_convert(struct dlm_rsb *r, struct dlm_lkb *lkb) |
2298 | { | 2310 | { |
2299 | int error = 0; | 2311 | int error = 0; |
@@ -2304,7 +2316,6 @@ static int do_convert(struct dlm_rsb *r, struct dlm_lkb *lkb) | |||
2304 | if (can_be_granted(r, lkb, 1, &deadlk)) { | 2316 | if (can_be_granted(r, lkb, 1, &deadlk)) { |
2305 | grant_lock(r, lkb); | 2317 | grant_lock(r, lkb); |
2306 | queue_cast(r, lkb, 0); | 2318 | queue_cast(r, lkb, 0); |
2307 | grant_pending_locks(r); | ||
2308 | goto out; | 2319 | goto out; |
2309 | } | 2320 | } |
2310 | 2321 | ||
@@ -2334,7 +2345,6 @@ static int do_convert(struct dlm_rsb *r, struct dlm_lkb *lkb) | |||
2334 | if (_can_be_granted(r, lkb, 1)) { | 2345 | if (_can_be_granted(r, lkb, 1)) { |
2335 | grant_lock(r, lkb); | 2346 | grant_lock(r, lkb); |
2336 | queue_cast(r, lkb, 0); | 2347 | queue_cast(r, lkb, 0); |
2337 | grant_pending_locks(r); | ||
2338 | goto out; | 2348 | goto out; |
2339 | } | 2349 | } |
2340 | /* else fall through and move to convert queue */ | 2350 | /* else fall through and move to convert queue */ |
@@ -2344,28 +2354,47 @@ static int do_convert(struct dlm_rsb *r, struct dlm_lkb *lkb) | |||
2344 | error = -EINPROGRESS; | 2354 | error = -EINPROGRESS; |
2345 | del_lkb(r, lkb); | 2355 | del_lkb(r, lkb); |
2346 | add_lkb(r, lkb, DLM_LKSTS_CONVERT); | 2356 | add_lkb(r, lkb, DLM_LKSTS_CONVERT); |
2347 | send_blocking_asts(r, lkb); | ||
2348 | add_timeout(lkb); | 2357 | add_timeout(lkb); |
2349 | goto out; | 2358 | goto out; |
2350 | } | 2359 | } |
2351 | 2360 | ||
2352 | error = -EAGAIN; | 2361 | error = -EAGAIN; |
2353 | if (force_blocking_asts(lkb)) | ||
2354 | send_blocking_asts_all(r, lkb); | ||
2355 | queue_cast(r, lkb, -EAGAIN); | 2362 | queue_cast(r, lkb, -EAGAIN); |
2356 | |||
2357 | out: | 2363 | out: |
2358 | return error; | 2364 | return error; |
2359 | } | 2365 | } |
2360 | 2366 | ||
2367 | static void do_convert_effects(struct dlm_rsb *r, struct dlm_lkb *lkb, | ||
2368 | int error) | ||
2369 | { | ||
2370 | switch (error) { | ||
2371 | case 0: | ||
2372 | grant_pending_locks(r); | ||
2373 | /* grant_pending_locks also sends basts */ | ||
2374 | break; | ||
2375 | case -EAGAIN: | ||
2376 | if (force_blocking_asts(lkb)) | ||
2377 | send_blocking_asts_all(r, lkb); | ||
2378 | break; | ||
2379 | case -EINPROGRESS: | ||
2380 | send_blocking_asts(r, lkb); | ||
2381 | break; | ||
2382 | } | ||
2383 | } | ||
2384 | |||
2361 | static int do_unlock(struct dlm_rsb *r, struct dlm_lkb *lkb) | 2385 | static int do_unlock(struct dlm_rsb *r, struct dlm_lkb *lkb) |
2362 | { | 2386 | { |
2363 | remove_lock(r, lkb); | 2387 | remove_lock(r, lkb); |
2364 | queue_cast(r, lkb, -DLM_EUNLOCK); | 2388 | queue_cast(r, lkb, -DLM_EUNLOCK); |
2365 | grant_pending_locks(r); | ||
2366 | return -DLM_EUNLOCK; | 2389 | return -DLM_EUNLOCK; |
2367 | } | 2390 | } |
2368 | 2391 | ||
2392 | static void do_unlock_effects(struct dlm_rsb *r, struct dlm_lkb *lkb, | ||
2393 | int error) | ||
2394 | { | ||
2395 | grant_pending_locks(r); | ||
2396 | } | ||
2397 | |||
2369 | /* returns: 0 did nothing, -DLM_ECANCEL canceled lock */ | 2398 | /* returns: 0 did nothing, -DLM_ECANCEL canceled lock */ |
2370 | 2399 | ||
2371 | static int do_cancel(struct dlm_rsb *r, struct dlm_lkb *lkb) | 2400 | static int do_cancel(struct dlm_rsb *r, struct dlm_lkb *lkb) |
@@ -2375,12 +2404,18 @@ static int do_cancel(struct dlm_rsb *r, struct dlm_lkb *lkb) | |||
2375 | error = revert_lock(r, lkb); | 2404 | error = revert_lock(r, lkb); |
2376 | if (error) { | 2405 | if (error) { |
2377 | queue_cast(r, lkb, -DLM_ECANCEL); | 2406 | queue_cast(r, lkb, -DLM_ECANCEL); |
2378 | grant_pending_locks(r); | ||
2379 | return -DLM_ECANCEL; | 2407 | return -DLM_ECANCEL; |
2380 | } | 2408 | } |
2381 | return 0; | 2409 | return 0; |
2382 | } | 2410 | } |
2383 | 2411 | ||
2412 | static void do_cancel_effects(struct dlm_rsb *r, struct dlm_lkb *lkb, | ||
2413 | int error) | ||
2414 | { | ||
2415 | if (error) | ||
2416 | grant_pending_locks(r); | ||
2417 | } | ||
2418 | |||
2384 | /* | 2419 | /* |
2385 | * Four stage 3 varieties: | 2420 | * Four stage 3 varieties: |
2386 | * _request_lock(), _convert_lock(), _unlock_lock(), _cancel_lock() | 2421 | * _request_lock(), _convert_lock(), _unlock_lock(), _cancel_lock() |
@@ -2402,11 +2437,15 @@ static int _request_lock(struct dlm_rsb *r, struct dlm_lkb *lkb) | |||
2402 | goto out; | 2437 | goto out; |
2403 | } | 2438 | } |
2404 | 2439 | ||
2405 | if (is_remote(r)) | 2440 | if (is_remote(r)) { |
2406 | /* receive_request() calls do_request() on remote node */ | 2441 | /* receive_request() calls do_request() on remote node */ |
2407 | error = send_request(r, lkb); | 2442 | error = send_request(r, lkb); |
2408 | else | 2443 | } else { |
2409 | error = do_request(r, lkb); | 2444 | error = do_request(r, lkb); |
2445 | /* for remote locks the request_reply is sent | ||
2446 | between do_request and do_request_effects */ | ||
2447 | do_request_effects(r, lkb, error); | ||
2448 | } | ||
2410 | out: | 2449 | out: |
2411 | return error; | 2450 | return error; |
2412 | } | 2451 | } |
@@ -2417,11 +2456,15 @@ static int _convert_lock(struct dlm_rsb *r, struct dlm_lkb *lkb) | |||
2417 | { | 2456 | { |
2418 | int error; | 2457 | int error; |
2419 | 2458 | ||
2420 | if (is_remote(r)) | 2459 | if (is_remote(r)) { |
2421 | /* receive_convert() calls do_convert() on remote node */ | 2460 | /* receive_convert() calls do_convert() on remote node */ |
2422 | error = send_convert(r, lkb); | 2461 | error = send_convert(r, lkb); |
2423 | else | 2462 | } else { |
2424 | error = do_convert(r, lkb); | 2463 | error = do_convert(r, lkb); |
2464 | /* for remote locks the convert_reply is sent | ||
2465 | between do_convert and do_convert_effects */ | ||
2466 | do_convert_effects(r, lkb, error); | ||
2467 | } | ||
2425 | 2468 | ||
2426 | return error; | 2469 | return error; |
2427 | } | 2470 | } |
@@ -2432,11 +2475,15 @@ static int _unlock_lock(struct dlm_rsb *r, struct dlm_lkb *lkb) | |||
2432 | { | 2475 | { |
2433 | int error; | 2476 | int error; |
2434 | 2477 | ||
2435 | if (is_remote(r)) | 2478 | if (is_remote(r)) { |
2436 | /* receive_unlock() calls do_unlock() on remote node */ | 2479 | /* receive_unlock() calls do_unlock() on remote node */ |
2437 | error = send_unlock(r, lkb); | 2480 | error = send_unlock(r, lkb); |
2438 | else | 2481 | } else { |
2439 | error = do_unlock(r, lkb); | 2482 | error = do_unlock(r, lkb); |
2483 | /* for remote locks the unlock_reply is sent | ||
2484 | between do_unlock and do_unlock_effects */ | ||
2485 | do_unlock_effects(r, lkb, error); | ||
2486 | } | ||
2440 | 2487 | ||
2441 | return error; | 2488 | return error; |
2442 | } | 2489 | } |
@@ -2447,11 +2494,15 @@ static int _cancel_lock(struct dlm_rsb *r, struct dlm_lkb *lkb) | |||
2447 | { | 2494 | { |
2448 | int error; | 2495 | int error; |
2449 | 2496 | ||
2450 | if (is_remote(r)) | 2497 | if (is_remote(r)) { |
2451 | /* receive_cancel() calls do_cancel() on remote node */ | 2498 | /* receive_cancel() calls do_cancel() on remote node */ |
2452 | error = send_cancel(r, lkb); | 2499 | error = send_cancel(r, lkb); |
2453 | else | 2500 | } else { |
2454 | error = do_cancel(r, lkb); | 2501 | error = do_cancel(r, lkb); |
2502 | /* for remote locks the cancel_reply is sent | ||
2503 | between do_cancel and do_cancel_effects */ | ||
2504 | do_cancel_effects(r, lkb, error); | ||
2505 | } | ||
2455 | 2506 | ||
2456 | return error; | 2507 | return error; |
2457 | } | 2508 | } |
@@ -3191,6 +3242,7 @@ static void receive_request(struct dlm_ls *ls, struct dlm_message *ms) | |||
3191 | attach_lkb(r, lkb); | 3242 | attach_lkb(r, lkb); |
3192 | error = do_request(r, lkb); | 3243 | error = do_request(r, lkb); |
3193 | send_request_reply(r, lkb, error); | 3244 | send_request_reply(r, lkb, error); |
3245 | do_request_effects(r, lkb, error); | ||
3194 | 3246 | ||
3195 | unlock_rsb(r); | 3247 | unlock_rsb(r); |
3196 | put_rsb(r); | 3248 | put_rsb(r); |
@@ -3226,15 +3278,19 @@ static void receive_convert(struct dlm_ls *ls, struct dlm_message *ms) | |||
3226 | goto out; | 3278 | goto out; |
3227 | 3279 | ||
3228 | receive_flags(lkb, ms); | 3280 | receive_flags(lkb, ms); |
3281 | |||
3229 | error = receive_convert_args(ls, lkb, ms); | 3282 | error = receive_convert_args(ls, lkb, ms); |
3230 | if (error) | 3283 | if (error) { |
3231 | goto out_reply; | 3284 | send_convert_reply(r, lkb, error); |
3285 | goto out; | ||
3286 | } | ||
3287 | |||
3232 | reply = !down_conversion(lkb); | 3288 | reply = !down_conversion(lkb); |
3233 | 3289 | ||
3234 | error = do_convert(r, lkb); | 3290 | error = do_convert(r, lkb); |
3235 | out_reply: | ||
3236 | if (reply) | 3291 | if (reply) |
3237 | send_convert_reply(r, lkb, error); | 3292 | send_convert_reply(r, lkb, error); |
3293 | do_convert_effects(r, lkb, error); | ||
3238 | out: | 3294 | out: |
3239 | unlock_rsb(r); | 3295 | unlock_rsb(r); |
3240 | put_rsb(r); | 3296 | put_rsb(r); |
@@ -3266,13 +3322,16 @@ static void receive_unlock(struct dlm_ls *ls, struct dlm_message *ms) | |||
3266 | goto out; | 3322 | goto out; |
3267 | 3323 | ||
3268 | receive_flags(lkb, ms); | 3324 | receive_flags(lkb, ms); |
3325 | |||
3269 | error = receive_unlock_args(ls, lkb, ms); | 3326 | error = receive_unlock_args(ls, lkb, ms); |
3270 | if (error) | 3327 | if (error) { |
3271 | goto out_reply; | 3328 | send_unlock_reply(r, lkb, error); |
3329 | goto out; | ||
3330 | } | ||
3272 | 3331 | ||
3273 | error = do_unlock(r, lkb); | 3332 | error = do_unlock(r, lkb); |
3274 | out_reply: | ||
3275 | send_unlock_reply(r, lkb, error); | 3333 | send_unlock_reply(r, lkb, error); |
3334 | do_unlock_effects(r, lkb, error); | ||
3276 | out: | 3335 | out: |
3277 | unlock_rsb(r); | 3336 | unlock_rsb(r); |
3278 | put_rsb(r); | 3337 | put_rsb(r); |
@@ -3307,6 +3366,7 @@ static void receive_cancel(struct dlm_ls *ls, struct dlm_message *ms) | |||
3307 | 3366 | ||
3308 | error = do_cancel(r, lkb); | 3367 | error = do_cancel(r, lkb); |
3309 | send_cancel_reply(r, lkb, error); | 3368 | send_cancel_reply(r, lkb, error); |
3369 | do_cancel_effects(r, lkb, error); | ||
3310 | out: | 3370 | out: |
3311 | unlock_rsb(r); | 3371 | unlock_rsb(r); |
3312 | put_rsb(r); | 3372 | put_rsb(r); |
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index c010ecfc0d29..26a8bd40400a 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -191,6 +191,18 @@ static int do_uevent(struct dlm_ls *ls, int in) | |||
191 | return error; | 191 | return error; |
192 | } | 192 | } |
193 | 193 | ||
194 | static int dlm_uevent(struct kset *kset, struct kobject *kobj, | ||
195 | struct kobj_uevent_env *env) | ||
196 | { | ||
197 | struct dlm_ls *ls = container_of(kobj, struct dlm_ls, ls_kobj); | ||
198 | |||
199 | add_uevent_var(env, "LOCKSPACE=%s", ls->ls_name); | ||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | static struct kset_uevent_ops dlm_uevent_ops = { | ||
204 | .uevent = dlm_uevent, | ||
205 | }; | ||
194 | 206 | ||
195 | int __init dlm_lockspace_init(void) | 207 | int __init dlm_lockspace_init(void) |
196 | { | 208 | { |
@@ -199,7 +211,7 @@ int __init dlm_lockspace_init(void) | |||
199 | INIT_LIST_HEAD(&lslist); | 211 | INIT_LIST_HEAD(&lslist); |
200 | spin_lock_init(&lslist_lock); | 212 | spin_lock_init(&lslist_lock); |
201 | 213 | ||
202 | dlm_kset = kset_create_and_add("dlm", NULL, kernel_kobj); | 214 | dlm_kset = kset_create_and_add("dlm", &dlm_uevent_ops, kernel_kobj); |
203 | if (!dlm_kset) { | 215 | if (!dlm_kset) { |
204 | printk(KERN_WARNING "%s: can not create kset\n", __func__); | 216 | printk(KERN_WARNING "%s: can not create kset\n", __func__); |
205 | return -ENOMEM; | 217 | return -ENOMEM; |
diff --git a/fs/dlm/user.c b/fs/dlm/user.c index e73a4bb572aa..a4bfd31ac45b 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2006-2009 Red Hat, Inc. All rights reserved. | 2 | * Copyright (C) 2006-2010 Red Hat, Inc. All rights reserved. |
3 | * | 3 | * |
4 | * This copyrighted material is made available to anyone wishing to use, | 4 | * This copyrighted material is made available to anyone wishing to use, |
5 | * modify, copy, or redistribute it subject to the terms and conditions | 5 | * modify, copy, or redistribute it subject to the terms and conditions |
@@ -173,7 +173,7 @@ static int lkb_is_endoflife(struct dlm_lkb *lkb, int sb_status, int type) | |||
173 | /* we could possibly check if the cancel of an orphan has resulted in the lkb | 173 | /* we could possibly check if the cancel of an orphan has resulted in the lkb |
174 | being removed and then remove that lkb from the orphans list and free it */ | 174 | being removed and then remove that lkb from the orphans list and free it */ |
175 | 175 | ||
176 | void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int bastmode) | 176 | void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int mode) |
177 | { | 177 | { |
178 | struct dlm_ls *ls; | 178 | struct dlm_ls *ls; |
179 | struct dlm_user_args *ua; | 179 | struct dlm_user_args *ua; |
@@ -206,8 +206,10 @@ void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int bastmode) | |||
206 | 206 | ||
207 | ast_type = lkb->lkb_ast_type; | 207 | ast_type = lkb->lkb_ast_type; |
208 | lkb->lkb_ast_type |= type; | 208 | lkb->lkb_ast_type |= type; |
209 | if (bastmode) | 209 | if (type == AST_BAST) |
210 | lkb->lkb_bastmode = bastmode; | 210 | lkb->lkb_bastmode = mode; |
211 | else | ||
212 | lkb->lkb_castmode = mode; | ||
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 1c9686492286..f196091dd7ff 100644 --- a/fs/dlm/user.h +++ b/fs/dlm/user.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2006-2008 Red Hat, Inc. All rights reserved. | 2 | * Copyright (C) 2006-2010 Red Hat, Inc. All rights reserved. |
3 | * | 3 | * |
4 | * This copyrighted material is made available to anyone wishing to use, | 4 | * This copyrighted material is made available to anyone wishing to use, |
5 | * modify, copy, or redistribute it subject to the terms and conditions | 5 | * modify, copy, or redistribute it subject to the terms and conditions |
@@ -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, int bastmode); | 12 | void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int mode); |
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); |