diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-11 14:28:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-11 14:28:34 -0500 |
commit | 498f7f505dc79934c878c7667840c50c64f232fc (patch) | |
tree | 67eca6dcb6fe76ec3d2bdef5e3102591fe957776 /fs/ocfs2/dlm | |
parent | 0969d11e201b82d30a158ccdb3aca67a7b845613 (diff) | |
parent | d6351db2073315ddebac72cc1935e912f60f86e0 (diff) |
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2: (22 commits)
MAINTAINERS: Update Joel Becker's email address
ocfs2: Remove unused truncate function from alloc.c
ocfs2/cluster: dereferencing before checking in nst_seq_show()
ocfs2: fix build for OCFS2_FS_STATS not enabled
ocfs2/cluster: Show o2net timing statistics
ocfs2/cluster: Track process message timing stats for each socket
ocfs2/cluster: Track send message timing stats for each socket
ocfs2/cluster: Use ktime instead of timeval in struct o2net_sock_container
ocfs2/cluster: Replace timeval with ktime in struct o2net_send_tracking
ocfs2: Add DEBUG_FS dependency
ocfs2/dlm: Hard code the values for enums
ocfs2/dlm: Minor cleanup
ocfs2/dlm: Cleanup dlmdebug.c
ocfs2: Release buffer_head in case of error in ocfs2_double_lock.
ocfs2/cluster: Pin the local node when o2hb thread starts
ocfs2/cluster: Show pin state for each o2hb region
ocfs2/cluster: Pin/unpin o2hb regions
ocfs2/cluster: Remove dropped region from o2hb quorum region bitmap
ocfs2/cluster: Pin the remote node item in configfs
ocfs2/dlm: make existing convertion precedent over new lock
...
Diffstat (limited to 'fs/ocfs2/dlm')
-rw-r--r-- | fs/ocfs2/dlm/dlmast.c | 76 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmcommon.h | 86 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmdebug.c | 200 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmdebug.h | 5 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmdomain.c | 10 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmlock.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmthread.c | 132 |
7 files changed, 244 insertions, 268 deletions
diff --git a/fs/ocfs2/dlm/dlmast.c b/fs/ocfs2/dlm/dlmast.c index f44999156839..3a3ed4bb794b 100644 --- a/fs/ocfs2/dlm/dlmast.c +++ b/fs/ocfs2/dlm/dlmast.c | |||
@@ -90,19 +90,29 @@ static int dlm_should_cancel_bast(struct dlm_ctxt *dlm, struct dlm_lock *lock) | |||
90 | 90 | ||
91 | void __dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock) | 91 | void __dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock) |
92 | { | 92 | { |
93 | mlog_entry_void(); | 93 | struct dlm_lock_resource *res; |
94 | 94 | ||
95 | BUG_ON(!dlm); | 95 | BUG_ON(!dlm); |
96 | BUG_ON(!lock); | 96 | BUG_ON(!lock); |
97 | 97 | ||
98 | res = lock->lockres; | ||
99 | |||
98 | assert_spin_locked(&dlm->ast_lock); | 100 | assert_spin_locked(&dlm->ast_lock); |
101 | |||
99 | if (!list_empty(&lock->ast_list)) { | 102 | if (!list_empty(&lock->ast_list)) { |
100 | mlog(ML_ERROR, "ast list not empty!! pending=%d, newlevel=%d\n", | 103 | mlog(ML_ERROR, "%s: res %.*s, lock %u:%llu, " |
104 | "AST list not empty, pending %d, newlevel %d\n", | ||
105 | dlm->name, res->lockname.len, res->lockname.name, | ||
106 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), | ||
107 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), | ||
101 | lock->ast_pending, lock->ml.type); | 108 | lock->ast_pending, lock->ml.type); |
102 | BUG(); | 109 | BUG(); |
103 | } | 110 | } |
104 | if (lock->ast_pending) | 111 | if (lock->ast_pending) |
105 | mlog(0, "lock has an ast getting flushed right now\n"); | 112 | mlog(0, "%s: res %.*s, lock %u:%llu, AST getting flushed\n", |
113 | dlm->name, res->lockname.len, res->lockname.name, | ||
114 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), | ||
115 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie))); | ||
106 | 116 | ||
107 | /* putting lock on list, add a ref */ | 117 | /* putting lock on list, add a ref */ |
108 | dlm_lock_get(lock); | 118 | dlm_lock_get(lock); |
@@ -110,9 +120,10 @@ void __dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock) | |||
110 | 120 | ||
111 | /* check to see if this ast obsoletes the bast */ | 121 | /* check to see if this ast obsoletes the bast */ |
112 | if (dlm_should_cancel_bast(dlm, lock)) { | 122 | if (dlm_should_cancel_bast(dlm, lock)) { |
113 | struct dlm_lock_resource *res = lock->lockres; | 123 | mlog(0, "%s: res %.*s, lock %u:%llu, Cancelling BAST\n", |
114 | mlog(0, "%s: cancelling bast for %.*s\n", | 124 | dlm->name, res->lockname.len, res->lockname.name, |
115 | dlm->name, res->lockname.len, res->lockname.name); | 125 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), |
126 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie))); | ||
116 | lock->bast_pending = 0; | 127 | lock->bast_pending = 0; |
117 | list_del_init(&lock->bast_list); | 128 | list_del_init(&lock->bast_list); |
118 | lock->ml.highest_blocked = LKM_IVMODE; | 129 | lock->ml.highest_blocked = LKM_IVMODE; |
@@ -134,8 +145,6 @@ void __dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock) | |||
134 | 145 | ||
135 | void dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock) | 146 | void dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock) |
136 | { | 147 | { |
137 | mlog_entry_void(); | ||
138 | |||
139 | BUG_ON(!dlm); | 148 | BUG_ON(!dlm); |
140 | BUG_ON(!lock); | 149 | BUG_ON(!lock); |
141 | 150 | ||
@@ -147,15 +156,21 @@ void dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock) | |||
147 | 156 | ||
148 | void __dlm_queue_bast(struct dlm_ctxt *dlm, struct dlm_lock *lock) | 157 | void __dlm_queue_bast(struct dlm_ctxt *dlm, struct dlm_lock *lock) |
149 | { | 158 | { |
150 | mlog_entry_void(); | 159 | struct dlm_lock_resource *res; |
151 | 160 | ||
152 | BUG_ON(!dlm); | 161 | BUG_ON(!dlm); |
153 | BUG_ON(!lock); | 162 | BUG_ON(!lock); |
163 | |||
154 | assert_spin_locked(&dlm->ast_lock); | 164 | assert_spin_locked(&dlm->ast_lock); |
155 | 165 | ||
166 | res = lock->lockres; | ||
167 | |||
156 | BUG_ON(!list_empty(&lock->bast_list)); | 168 | BUG_ON(!list_empty(&lock->bast_list)); |
157 | if (lock->bast_pending) | 169 | if (lock->bast_pending) |
158 | mlog(0, "lock has a bast getting flushed right now\n"); | 170 | mlog(0, "%s: res %.*s, lock %u:%llu, BAST getting flushed\n", |
171 | dlm->name, res->lockname.len, res->lockname.name, | ||
172 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), | ||
173 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie))); | ||
159 | 174 | ||
160 | /* putting lock on list, add a ref */ | 175 | /* putting lock on list, add a ref */ |
161 | dlm_lock_get(lock); | 176 | dlm_lock_get(lock); |
@@ -167,8 +182,6 @@ void __dlm_queue_bast(struct dlm_ctxt *dlm, struct dlm_lock *lock) | |||
167 | 182 | ||
168 | void dlm_queue_bast(struct dlm_ctxt *dlm, struct dlm_lock *lock) | 183 | void dlm_queue_bast(struct dlm_ctxt *dlm, struct dlm_lock *lock) |
169 | { | 184 | { |
170 | mlog_entry_void(); | ||
171 | |||
172 | BUG_ON(!dlm); | 185 | BUG_ON(!dlm); |
173 | BUG_ON(!lock); | 186 | BUG_ON(!lock); |
174 | 187 | ||
@@ -213,7 +226,10 @@ void dlm_do_local_ast(struct dlm_ctxt *dlm, struct dlm_lock_resource *res, | |||
213 | dlm_astlockfunc_t *fn; | 226 | dlm_astlockfunc_t *fn; |
214 | struct dlm_lockstatus *lksb; | 227 | struct dlm_lockstatus *lksb; |
215 | 228 | ||
216 | mlog_entry_void(); | 229 | mlog(0, "%s: res %.*s, lock %u:%llu, Local AST\n", dlm->name, |
230 | res->lockname.len, res->lockname.name, | ||
231 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), | ||
232 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie))); | ||
217 | 233 | ||
218 | lksb = lock->lksb; | 234 | lksb = lock->lksb; |
219 | fn = lock->ast; | 235 | fn = lock->ast; |
@@ -231,7 +247,10 @@ int dlm_do_remote_ast(struct dlm_ctxt *dlm, struct dlm_lock_resource *res, | |||
231 | struct dlm_lockstatus *lksb; | 247 | struct dlm_lockstatus *lksb; |
232 | int lksbflags; | 248 | int lksbflags; |
233 | 249 | ||
234 | mlog_entry_void(); | 250 | mlog(0, "%s: res %.*s, lock %u:%llu, Remote AST\n", dlm->name, |
251 | res->lockname.len, res->lockname.name, | ||
252 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), | ||
253 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie))); | ||
235 | 254 | ||
236 | lksb = lock->lksb; | 255 | lksb = lock->lksb; |
237 | BUG_ON(lock->ml.node == dlm->node_num); | 256 | BUG_ON(lock->ml.node == dlm->node_num); |
@@ -250,9 +269,14 @@ void dlm_do_local_bast(struct dlm_ctxt *dlm, struct dlm_lock_resource *res, | |||
250 | { | 269 | { |
251 | dlm_bastlockfunc_t *fn = lock->bast; | 270 | dlm_bastlockfunc_t *fn = lock->bast; |
252 | 271 | ||
253 | mlog_entry_void(); | ||
254 | BUG_ON(lock->ml.node != dlm->node_num); | 272 | BUG_ON(lock->ml.node != dlm->node_num); |
255 | 273 | ||
274 | mlog(0, "%s: res %.*s, lock %u:%llu, Local BAST, blocked %d\n", | ||
275 | dlm->name, res->lockname.len, res->lockname.name, | ||
276 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), | ||
277 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), | ||
278 | blocked_type); | ||
279 | |||
256 | (*fn)(lock->astdata, blocked_type); | 280 | (*fn)(lock->astdata, blocked_type); |
257 | } | 281 | } |
258 | 282 | ||
@@ -332,7 +356,8 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data, | |||
332 | /* cannot get a proxy ast message if this node owns it */ | 356 | /* cannot get a proxy ast message if this node owns it */ |
333 | BUG_ON(res->owner == dlm->node_num); | 357 | BUG_ON(res->owner == dlm->node_num); |
334 | 358 | ||
335 | mlog(0, "lockres %.*s\n", res->lockname.len, res->lockname.name); | 359 | mlog(0, "%s: res %.*s\n", dlm->name, res->lockname.len, |
360 | res->lockname.name); | ||
336 | 361 | ||
337 | spin_lock(&res->spinlock); | 362 | spin_lock(&res->spinlock); |
338 | if (res->state & DLM_LOCK_RES_RECOVERING) { | 363 | if (res->state & DLM_LOCK_RES_RECOVERING) { |
@@ -382,8 +407,12 @@ do_ast: | |||
382 | if (past->type == DLM_AST) { | 407 | if (past->type == DLM_AST) { |
383 | /* do not alter lock refcount. switching lists. */ | 408 | /* do not alter lock refcount. switching lists. */ |
384 | list_move_tail(&lock->list, &res->granted); | 409 | list_move_tail(&lock->list, &res->granted); |
385 | mlog(0, "ast: Adding to granted list... type=%d, " | 410 | mlog(0, "%s: res %.*s, lock %u:%llu, Granted type %d => %d\n", |
386 | "convert_type=%d\n", lock->ml.type, lock->ml.convert_type); | 411 | dlm->name, res->lockname.len, res->lockname.name, |
412 | dlm_get_lock_cookie_node(be64_to_cpu(cookie)), | ||
413 | dlm_get_lock_cookie_seq(be64_to_cpu(cookie)), | ||
414 | lock->ml.type, lock->ml.convert_type); | ||
415 | |||
387 | if (lock->ml.convert_type != LKM_IVMODE) { | 416 | if (lock->ml.convert_type != LKM_IVMODE) { |
388 | lock->ml.type = lock->ml.convert_type; | 417 | lock->ml.type = lock->ml.convert_type; |
389 | lock->ml.convert_type = LKM_IVMODE; | 418 | lock->ml.convert_type = LKM_IVMODE; |
@@ -426,9 +455,9 @@ int dlm_send_proxy_ast_msg(struct dlm_ctxt *dlm, struct dlm_lock_resource *res, | |||
426 | size_t veclen = 1; | 455 | size_t veclen = 1; |
427 | int status; | 456 | int status; |
428 | 457 | ||
429 | mlog_entry("res %.*s, to=%u, type=%d, blocked_type=%d\n", | 458 | mlog(0, "%s: res %.*s, to %u, type %d, blocked_type %d\n", dlm->name, |
430 | res->lockname.len, res->lockname.name, lock->ml.node, | 459 | res->lockname.len, res->lockname.name, lock->ml.node, msg_type, |
431 | msg_type, blocked_type); | 460 | blocked_type); |
432 | 461 | ||
433 | memset(&past, 0, sizeof(struct dlm_proxy_ast)); | 462 | memset(&past, 0, sizeof(struct dlm_proxy_ast)); |
434 | past.node_idx = dlm->node_num; | 463 | past.node_idx = dlm->node_num; |
@@ -441,7 +470,6 @@ int dlm_send_proxy_ast_msg(struct dlm_ctxt *dlm, struct dlm_lock_resource *res, | |||
441 | vec[0].iov_len = sizeof(struct dlm_proxy_ast); | 470 | vec[0].iov_len = sizeof(struct dlm_proxy_ast); |
442 | vec[0].iov_base = &past; | 471 | vec[0].iov_base = &past; |
443 | if (flags & DLM_LKSB_GET_LVB) { | 472 | if (flags & DLM_LKSB_GET_LVB) { |
444 | mlog(0, "returning requested LVB data\n"); | ||
445 | be32_add_cpu(&past.flags, LKM_GET_LVB); | 473 | be32_add_cpu(&past.flags, LKM_GET_LVB); |
446 | vec[1].iov_len = DLM_LVB_LEN; | 474 | vec[1].iov_len = DLM_LVB_LEN; |
447 | vec[1].iov_base = lock->lksb->lvb; | 475 | vec[1].iov_base = lock->lksb->lvb; |
@@ -451,8 +479,8 @@ int dlm_send_proxy_ast_msg(struct dlm_ctxt *dlm, struct dlm_lock_resource *res, | |||
451 | ret = o2net_send_message_vec(DLM_PROXY_AST_MSG, dlm->key, vec, veclen, | 479 | ret = o2net_send_message_vec(DLM_PROXY_AST_MSG, dlm->key, vec, veclen, |
452 | lock->ml.node, &status); | 480 | lock->ml.node, &status); |
453 | if (ret < 0) | 481 | if (ret < 0) |
454 | mlog(ML_ERROR, "Error %d when sending message %u (key 0x%x) to " | 482 | mlog(ML_ERROR, "%s: res %.*s, error %d send AST to node %u\n", |
455 | "node %u\n", ret, DLM_PROXY_AST_MSG, dlm->key, | 483 | dlm->name, res->lockname.len, res->lockname.name, ret, |
456 | lock->ml.node); | 484 | lock->ml.node); |
457 | else { | 485 | else { |
458 | if (status == DLM_RECOVERING) { | 486 | if (status == DLM_RECOVERING) { |
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index b36d0bf77a5a..4bdf7baee344 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h | |||
@@ -50,10 +50,10 @@ | |||
50 | #define dlm_lockid_hash(_n, _l) full_name_hash(_n, _l) | 50 | #define dlm_lockid_hash(_n, _l) full_name_hash(_n, _l) |
51 | 51 | ||
52 | enum dlm_mle_type { | 52 | enum dlm_mle_type { |
53 | DLM_MLE_BLOCK, | 53 | DLM_MLE_BLOCK = 0, |
54 | DLM_MLE_MASTER, | 54 | DLM_MLE_MASTER = 1, |
55 | DLM_MLE_MIGRATION, | 55 | DLM_MLE_MIGRATION = 2, |
56 | DLM_MLE_NUM_TYPES | 56 | DLM_MLE_NUM_TYPES = 3, |
57 | }; | 57 | }; |
58 | 58 | ||
59 | struct dlm_master_list_entry { | 59 | struct dlm_master_list_entry { |
@@ -82,8 +82,8 @@ struct dlm_master_list_entry { | |||
82 | 82 | ||
83 | enum dlm_ast_type { | 83 | enum dlm_ast_type { |
84 | DLM_AST = 0, | 84 | DLM_AST = 0, |
85 | DLM_BAST, | 85 | DLM_BAST = 1, |
86 | DLM_ASTUNLOCK | 86 | DLM_ASTUNLOCK = 2, |
87 | }; | 87 | }; |
88 | 88 | ||
89 | 89 | ||
@@ -119,9 +119,9 @@ struct dlm_recovery_ctxt | |||
119 | 119 | ||
120 | enum dlm_ctxt_state { | 120 | enum dlm_ctxt_state { |
121 | DLM_CTXT_NEW = 0, | 121 | DLM_CTXT_NEW = 0, |
122 | DLM_CTXT_JOINED, | 122 | DLM_CTXT_JOINED = 1, |
123 | DLM_CTXT_IN_SHUTDOWN, | 123 | DLM_CTXT_IN_SHUTDOWN = 2, |
124 | DLM_CTXT_LEAVING, | 124 | DLM_CTXT_LEAVING = 3, |
125 | }; | 125 | }; |
126 | 126 | ||
127 | struct dlm_ctxt | 127 | struct dlm_ctxt |
@@ -388,8 +388,8 @@ struct dlm_lock | |||
388 | 388 | ||
389 | enum dlm_lockres_list { | 389 | enum dlm_lockres_list { |
390 | DLM_GRANTED_LIST = 0, | 390 | DLM_GRANTED_LIST = 0, |
391 | DLM_CONVERTING_LIST, | 391 | DLM_CONVERTING_LIST = 1, |
392 | DLM_BLOCKED_LIST | 392 | DLM_BLOCKED_LIST = 2, |
393 | }; | 393 | }; |
394 | 394 | ||
395 | static inline int dlm_lvb_is_empty(char *lvb) | 395 | static inline int dlm_lvb_is_empty(char *lvb) |
@@ -427,27 +427,27 @@ struct dlm_node_iter | |||
427 | 427 | ||
428 | 428 | ||
429 | enum { | 429 | enum { |
430 | DLM_MASTER_REQUEST_MSG = 500, | 430 | DLM_MASTER_REQUEST_MSG = 500, |
431 | DLM_UNUSED_MSG1, /* 501 */ | 431 | DLM_UNUSED_MSG1 = 501, |
432 | DLM_ASSERT_MASTER_MSG, /* 502 */ | 432 | DLM_ASSERT_MASTER_MSG = 502, |
433 | DLM_CREATE_LOCK_MSG, /* 503 */ | 433 | DLM_CREATE_LOCK_MSG = 503, |
434 | DLM_CONVERT_LOCK_MSG, /* 504 */ | 434 | DLM_CONVERT_LOCK_MSG = 504, |
435 | DLM_PROXY_AST_MSG, /* 505 */ | 435 | DLM_PROXY_AST_MSG = 505, |
436 | DLM_UNLOCK_LOCK_MSG, /* 506 */ | 436 | DLM_UNLOCK_LOCK_MSG = 506, |
437 | DLM_DEREF_LOCKRES_MSG, /* 507 */ | 437 | DLM_DEREF_LOCKRES_MSG = 507, |
438 | DLM_MIGRATE_REQUEST_MSG, /* 508 */ | 438 | DLM_MIGRATE_REQUEST_MSG = 508, |
439 | DLM_MIG_LOCKRES_MSG, /* 509 */ | 439 | DLM_MIG_LOCKRES_MSG = 509, |
440 | DLM_QUERY_JOIN_MSG, /* 510 */ | 440 | DLM_QUERY_JOIN_MSG = 510, |
441 | DLM_ASSERT_JOINED_MSG, /* 511 */ | 441 | DLM_ASSERT_JOINED_MSG = 511, |
442 | DLM_CANCEL_JOIN_MSG, /* 512 */ | 442 | DLM_CANCEL_JOIN_MSG = 512, |
443 | DLM_EXIT_DOMAIN_MSG, /* 513 */ | 443 | DLM_EXIT_DOMAIN_MSG = 513, |
444 | DLM_MASTER_REQUERY_MSG, /* 514 */ | 444 | DLM_MASTER_REQUERY_MSG = 514, |
445 | DLM_LOCK_REQUEST_MSG, /* 515 */ | 445 | DLM_LOCK_REQUEST_MSG = 515, |
446 | DLM_RECO_DATA_DONE_MSG, /* 516 */ | 446 | DLM_RECO_DATA_DONE_MSG = 516, |
447 | DLM_BEGIN_RECO_MSG, /* 517 */ | 447 | DLM_BEGIN_RECO_MSG = 517, |
448 | DLM_FINALIZE_RECO_MSG, /* 518 */ | 448 | DLM_FINALIZE_RECO_MSG = 518, |
449 | DLM_QUERY_REGION, /* 519 */ | 449 | DLM_QUERY_REGION = 519, |
450 | DLM_QUERY_NODEINFO, /* 520 */ | 450 | DLM_QUERY_NODEINFO = 520, |
451 | }; | 451 | }; |
452 | 452 | ||
453 | struct dlm_reco_node_data | 453 | struct dlm_reco_node_data |
@@ -460,19 +460,19 @@ struct dlm_reco_node_data | |||
460 | enum { | 460 | enum { |
461 | DLM_RECO_NODE_DATA_DEAD = -1, | 461 | DLM_RECO_NODE_DATA_DEAD = -1, |
462 | DLM_RECO_NODE_DATA_INIT = 0, | 462 | DLM_RECO_NODE_DATA_INIT = 0, |
463 | DLM_RECO_NODE_DATA_REQUESTING, | 463 | DLM_RECO_NODE_DATA_REQUESTING = 1, |
464 | DLM_RECO_NODE_DATA_REQUESTED, | 464 | DLM_RECO_NODE_DATA_REQUESTED = 2, |
465 | DLM_RECO_NODE_DATA_RECEIVING, | 465 | DLM_RECO_NODE_DATA_RECEIVING = 3, |
466 | DLM_RECO_NODE_DATA_DONE, | 466 | DLM_RECO_NODE_DATA_DONE = 4, |
467 | DLM_RECO_NODE_DATA_FINALIZE_SENT, | 467 | DLM_RECO_NODE_DATA_FINALIZE_SENT = 5, |
468 | }; | 468 | }; |
469 | 469 | ||
470 | 470 | ||
471 | enum { | 471 | enum { |
472 | DLM_MASTER_RESP_NO = 0, | 472 | DLM_MASTER_RESP_NO = 0, |
473 | DLM_MASTER_RESP_YES, | 473 | DLM_MASTER_RESP_YES = 1, |
474 | DLM_MASTER_RESP_MAYBE, | 474 | DLM_MASTER_RESP_MAYBE = 2, |
475 | DLM_MASTER_RESP_ERROR | 475 | DLM_MASTER_RESP_ERROR = 3, |
476 | }; | 476 | }; |
477 | 477 | ||
478 | 478 | ||
@@ -649,9 +649,9 @@ struct dlm_proxy_ast | |||
649 | #define DLM_MOD_KEY (0x666c6172) | 649 | #define DLM_MOD_KEY (0x666c6172) |
650 | enum dlm_query_join_response_code { | 650 | enum dlm_query_join_response_code { |
651 | JOIN_DISALLOW = 0, | 651 | JOIN_DISALLOW = 0, |
652 | JOIN_OK, | 652 | JOIN_OK = 1, |
653 | JOIN_OK_NO_MAP, | 653 | JOIN_OK_NO_MAP = 2, |
654 | JOIN_PROTOCOL_MISMATCH, | 654 | JOIN_PROTOCOL_MISMATCH = 3, |
655 | }; | 655 | }; |
656 | 656 | ||
657 | struct dlm_query_join_packet { | 657 | struct dlm_query_join_packet { |
diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c index 272ec8631a51..04a32be0aeb9 100644 --- a/fs/ocfs2/dlm/dlmdebug.c +++ b/fs/ocfs2/dlm/dlmdebug.c | |||
@@ -370,92 +370,46 @@ static void dlm_debug_get(struct dlm_debug_ctxt *dc) | |||
370 | kref_get(&dc->debug_refcnt); | 370 | kref_get(&dc->debug_refcnt); |
371 | } | 371 | } |
372 | 372 | ||
373 | static struct debug_buffer *debug_buffer_allocate(void) | 373 | static int debug_release(struct inode *inode, struct file *file) |
374 | { | 374 | { |
375 | struct debug_buffer *db = NULL; | 375 | free_page((unsigned long)file->private_data); |
376 | 376 | return 0; | |
377 | db = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL); | ||
378 | if (!db) | ||
379 | goto bail; | ||
380 | |||
381 | db->len = PAGE_SIZE; | ||
382 | db->buf = kmalloc(db->len, GFP_KERNEL); | ||
383 | if (!db->buf) | ||
384 | goto bail; | ||
385 | |||
386 | return db; | ||
387 | bail: | ||
388 | kfree(db); | ||
389 | return NULL; | ||
390 | } | ||
391 | |||
392 | static ssize_t debug_buffer_read(struct file *file, char __user *buf, | ||
393 | size_t nbytes, loff_t *ppos) | ||
394 | { | ||
395 | struct debug_buffer *db = file->private_data; | ||
396 | |||
397 | return simple_read_from_buffer(buf, nbytes, ppos, db->buf, db->len); | ||
398 | } | ||
399 | |||
400 | static loff_t debug_buffer_llseek(struct file *file, loff_t off, int whence) | ||
401 | { | ||
402 | struct debug_buffer *db = file->private_data; | ||
403 | loff_t new = -1; | ||
404 | |||
405 | switch (whence) { | ||
406 | case 0: | ||
407 | new = off; | ||
408 | break; | ||
409 | case 1: | ||
410 | new = file->f_pos + off; | ||
411 | break; | ||
412 | } | ||
413 | |||
414 | if (new < 0 || new > db->len) | ||
415 | return -EINVAL; | ||
416 | |||
417 | return (file->f_pos = new); | ||
418 | } | 377 | } |
419 | 378 | ||
420 | static int debug_buffer_release(struct inode *inode, struct file *file) | 379 | static ssize_t debug_read(struct file *file, char __user *buf, |
380 | size_t nbytes, loff_t *ppos) | ||
421 | { | 381 | { |
422 | struct debug_buffer *db = file->private_data; | 382 | return simple_read_from_buffer(buf, nbytes, ppos, file->private_data, |
423 | 383 | i_size_read(file->f_mapping->host)); | |
424 | if (db) | ||
425 | kfree(db->buf); | ||
426 | kfree(db); | ||
427 | |||
428 | return 0; | ||
429 | } | 384 | } |
430 | /* end - util funcs */ | 385 | /* end - util funcs */ |
431 | 386 | ||
432 | /* begin - purge list funcs */ | 387 | /* begin - purge list funcs */ |
433 | static int debug_purgelist_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | 388 | static int debug_purgelist_print(struct dlm_ctxt *dlm, char *buf, int len) |
434 | { | 389 | { |
435 | struct dlm_lock_resource *res; | 390 | struct dlm_lock_resource *res; |
436 | int out = 0; | 391 | int out = 0; |
437 | unsigned long total = 0; | 392 | unsigned long total = 0; |
438 | 393 | ||
439 | out += snprintf(db->buf + out, db->len - out, | 394 | out += snprintf(buf + out, len - out, |
440 | "Dumping Purgelist for Domain: %s\n", dlm->name); | 395 | "Dumping Purgelist for Domain: %s\n", dlm->name); |
441 | 396 | ||
442 | spin_lock(&dlm->spinlock); | 397 | spin_lock(&dlm->spinlock); |
443 | list_for_each_entry(res, &dlm->purge_list, purge) { | 398 | list_for_each_entry(res, &dlm->purge_list, purge) { |
444 | ++total; | 399 | ++total; |
445 | if (db->len - out < 100) | 400 | if (len - out < 100) |
446 | continue; | 401 | continue; |
447 | spin_lock(&res->spinlock); | 402 | spin_lock(&res->spinlock); |
448 | out += stringify_lockname(res->lockname.name, | 403 | out += stringify_lockname(res->lockname.name, |
449 | res->lockname.len, | 404 | res->lockname.len, |
450 | db->buf + out, db->len - out); | 405 | buf + out, len - out); |
451 | out += snprintf(db->buf + out, db->len - out, "\t%ld\n", | 406 | out += snprintf(buf + out, len - out, "\t%ld\n", |
452 | (jiffies - res->last_used)/HZ); | 407 | (jiffies - res->last_used)/HZ); |
453 | spin_unlock(&res->spinlock); | 408 | spin_unlock(&res->spinlock); |
454 | } | 409 | } |
455 | spin_unlock(&dlm->spinlock); | 410 | spin_unlock(&dlm->spinlock); |
456 | 411 | ||
457 | out += snprintf(db->buf + out, db->len - out, | 412 | out += snprintf(buf + out, len - out, "Total on list: %ld\n", total); |
458 | "Total on list: %ld\n", total); | ||
459 | 413 | ||
460 | return out; | 414 | return out; |
461 | } | 415 | } |
@@ -463,15 +417,15 @@ static int debug_purgelist_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | |||
463 | static int debug_purgelist_open(struct inode *inode, struct file *file) | 417 | static int debug_purgelist_open(struct inode *inode, struct file *file) |
464 | { | 418 | { |
465 | struct dlm_ctxt *dlm = inode->i_private; | 419 | struct dlm_ctxt *dlm = inode->i_private; |
466 | struct debug_buffer *db; | 420 | char *buf = NULL; |
467 | 421 | ||
468 | db = debug_buffer_allocate(); | 422 | buf = (char *) get_zeroed_page(GFP_NOFS); |
469 | if (!db) | 423 | if (!buf) |
470 | goto bail; | 424 | goto bail; |
471 | 425 | ||
472 | db->len = debug_purgelist_print(dlm, db); | 426 | i_size_write(inode, debug_purgelist_print(dlm, buf, PAGE_SIZE - 1)); |
473 | 427 | ||
474 | file->private_data = db; | 428 | file->private_data = buf; |
475 | 429 | ||
476 | return 0; | 430 | return 0; |
477 | bail: | 431 | bail: |
@@ -480,14 +434,14 @@ bail: | |||
480 | 434 | ||
481 | static const struct file_operations debug_purgelist_fops = { | 435 | static const struct file_operations debug_purgelist_fops = { |
482 | .open = debug_purgelist_open, | 436 | .open = debug_purgelist_open, |
483 | .release = debug_buffer_release, | 437 | .release = debug_release, |
484 | .read = debug_buffer_read, | 438 | .read = debug_read, |
485 | .llseek = debug_buffer_llseek, | 439 | .llseek = generic_file_llseek, |
486 | }; | 440 | }; |
487 | /* end - purge list funcs */ | 441 | /* end - purge list funcs */ |
488 | 442 | ||
489 | /* begin - debug mle funcs */ | 443 | /* begin - debug mle funcs */ |
490 | static int debug_mle_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | 444 | static int debug_mle_print(struct dlm_ctxt *dlm, char *buf, int len) |
491 | { | 445 | { |
492 | struct dlm_master_list_entry *mle; | 446 | struct dlm_master_list_entry *mle; |
493 | struct hlist_head *bucket; | 447 | struct hlist_head *bucket; |
@@ -495,7 +449,7 @@ static int debug_mle_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | |||
495 | int i, out = 0; | 449 | int i, out = 0; |
496 | unsigned long total = 0, longest = 0, bucket_count = 0; | 450 | unsigned long total = 0, longest = 0, bucket_count = 0; |
497 | 451 | ||
498 | out += snprintf(db->buf + out, db->len - out, | 452 | out += snprintf(buf + out, len - out, |
499 | "Dumping MLEs for Domain: %s\n", dlm->name); | 453 | "Dumping MLEs for Domain: %s\n", dlm->name); |
500 | 454 | ||
501 | spin_lock(&dlm->master_lock); | 455 | spin_lock(&dlm->master_lock); |
@@ -506,16 +460,16 @@ static int debug_mle_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | |||
506 | master_hash_node); | 460 | master_hash_node); |
507 | ++total; | 461 | ++total; |
508 | ++bucket_count; | 462 | ++bucket_count; |
509 | if (db->len - out < 200) | 463 | if (len - out < 200) |
510 | continue; | 464 | continue; |
511 | out += dump_mle(mle, db->buf + out, db->len - out); | 465 | out += dump_mle(mle, buf + out, len - out); |
512 | } | 466 | } |
513 | longest = max(longest, bucket_count); | 467 | longest = max(longest, bucket_count); |
514 | bucket_count = 0; | 468 | bucket_count = 0; |
515 | } | 469 | } |
516 | spin_unlock(&dlm->master_lock); | 470 | spin_unlock(&dlm->master_lock); |
517 | 471 | ||
518 | out += snprintf(db->buf + out, db->len - out, | 472 | out += snprintf(buf + out, len - out, |
519 | "Total: %ld, Longest: %ld\n", total, longest); | 473 | "Total: %ld, Longest: %ld\n", total, longest); |
520 | return out; | 474 | return out; |
521 | } | 475 | } |
@@ -523,15 +477,15 @@ static int debug_mle_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | |||
523 | static int debug_mle_open(struct inode *inode, struct file *file) | 477 | static int debug_mle_open(struct inode *inode, struct file *file) |
524 | { | 478 | { |
525 | struct dlm_ctxt *dlm = inode->i_private; | 479 | struct dlm_ctxt *dlm = inode->i_private; |
526 | struct debug_buffer *db; | 480 | char *buf = NULL; |
527 | 481 | ||
528 | db = debug_buffer_allocate(); | 482 | buf = (char *) get_zeroed_page(GFP_NOFS); |
529 | if (!db) | 483 | if (!buf) |
530 | goto bail; | 484 | goto bail; |
531 | 485 | ||
532 | db->len = debug_mle_print(dlm, db); | 486 | i_size_write(inode, debug_mle_print(dlm, buf, PAGE_SIZE - 1)); |
533 | 487 | ||
534 | file->private_data = db; | 488 | file->private_data = buf; |
535 | 489 | ||
536 | return 0; | 490 | return 0; |
537 | bail: | 491 | bail: |
@@ -540,9 +494,9 @@ bail: | |||
540 | 494 | ||
541 | static const struct file_operations debug_mle_fops = { | 495 | static const struct file_operations debug_mle_fops = { |
542 | .open = debug_mle_open, | 496 | .open = debug_mle_open, |
543 | .release = debug_buffer_release, | 497 | .release = debug_release, |
544 | .read = debug_buffer_read, | 498 | .read = debug_read, |
545 | .llseek = debug_buffer_llseek, | 499 | .llseek = generic_file_llseek, |
546 | }; | 500 | }; |
547 | 501 | ||
548 | /* end - debug mle funcs */ | 502 | /* end - debug mle funcs */ |
@@ -757,7 +711,7 @@ static const struct file_operations debug_lockres_fops = { | |||
757 | /* end - debug lockres funcs */ | 711 | /* end - debug lockres funcs */ |
758 | 712 | ||
759 | /* begin - debug state funcs */ | 713 | /* begin - debug state funcs */ |
760 | static int debug_state_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | 714 | static int debug_state_print(struct dlm_ctxt *dlm, char *buf, int len) |
761 | { | 715 | { |
762 | int out = 0; | 716 | int out = 0; |
763 | struct dlm_reco_node_data *node; | 717 | struct dlm_reco_node_data *node; |
@@ -781,35 +735,35 @@ static int debug_state_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | |||
781 | } | 735 | } |
782 | 736 | ||
783 | /* Domain: xxxxxxxxxx Key: 0xdfbac769 */ | 737 | /* Domain: xxxxxxxxxx Key: 0xdfbac769 */ |
784 | out += snprintf(db->buf + out, db->len - out, | 738 | out += snprintf(buf + out, len - out, |
785 | "Domain: %s Key: 0x%08x Protocol: %d.%d\n", | 739 | "Domain: %s Key: 0x%08x Protocol: %d.%d\n", |
786 | dlm->name, dlm->key, dlm->dlm_locking_proto.pv_major, | 740 | dlm->name, dlm->key, dlm->dlm_locking_proto.pv_major, |
787 | dlm->dlm_locking_proto.pv_minor); | 741 | dlm->dlm_locking_proto.pv_minor); |
788 | 742 | ||
789 | /* Thread Pid: xxx Node: xxx State: xxxxx */ | 743 | /* Thread Pid: xxx Node: xxx State: xxxxx */ |
790 | out += snprintf(db->buf + out, db->len - out, | 744 | out += snprintf(buf + out, len - out, |
791 | "Thread Pid: %d Node: %d State: %s\n", | 745 | "Thread Pid: %d Node: %d State: %s\n", |
792 | dlm->dlm_thread_task->pid, dlm->node_num, state); | 746 | task_pid_nr(dlm->dlm_thread_task), dlm->node_num, state); |
793 | 747 | ||
794 | /* Number of Joins: xxx Joining Node: xxx */ | 748 | /* Number of Joins: xxx Joining Node: xxx */ |
795 | out += snprintf(db->buf + out, db->len - out, | 749 | out += snprintf(buf + out, len - out, |
796 | "Number of Joins: %d Joining Node: %d\n", | 750 | "Number of Joins: %d Joining Node: %d\n", |
797 | dlm->num_joins, dlm->joining_node); | 751 | dlm->num_joins, dlm->joining_node); |
798 | 752 | ||
799 | /* Domain Map: xx xx xx */ | 753 | /* Domain Map: xx xx xx */ |
800 | out += snprintf(db->buf + out, db->len - out, "Domain Map: "); | 754 | out += snprintf(buf + out, len - out, "Domain Map: "); |
801 | out += stringify_nodemap(dlm->domain_map, O2NM_MAX_NODES, | 755 | out += stringify_nodemap(dlm->domain_map, O2NM_MAX_NODES, |
802 | db->buf + out, db->len - out); | 756 | buf + out, len - out); |
803 | out += snprintf(db->buf + out, db->len - out, "\n"); | 757 | out += snprintf(buf + out, len - out, "\n"); |
804 | 758 | ||
805 | /* Live Map: xx xx xx */ | 759 | /* Live Map: xx xx xx */ |
806 | out += snprintf(db->buf + out, db->len - out, "Live Map: "); | 760 | out += snprintf(buf + out, len - out, "Live Map: "); |
807 | out += stringify_nodemap(dlm->live_nodes_map, O2NM_MAX_NODES, | 761 | out += stringify_nodemap(dlm->live_nodes_map, O2NM_MAX_NODES, |
808 | db->buf + out, db->len - out); | 762 | buf + out, len - out); |
809 | out += snprintf(db->buf + out, db->len - out, "\n"); | 763 | out += snprintf(buf + out, len - out, "\n"); |
810 | 764 | ||
811 | /* Lock Resources: xxx (xxx) */ | 765 | /* Lock Resources: xxx (xxx) */ |
812 | out += snprintf(db->buf + out, db->len - out, | 766 | out += snprintf(buf + out, len - out, |
813 | "Lock Resources: %d (%d)\n", | 767 | "Lock Resources: %d (%d)\n", |
814 | atomic_read(&dlm->res_cur_count), | 768 | atomic_read(&dlm->res_cur_count), |
815 | atomic_read(&dlm->res_tot_count)); | 769 | atomic_read(&dlm->res_tot_count)); |
@@ -821,29 +775,29 @@ static int debug_state_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | |||
821 | cur_mles += atomic_read(&dlm->mle_cur_count[i]); | 775 | cur_mles += atomic_read(&dlm->mle_cur_count[i]); |
822 | 776 | ||
823 | /* MLEs: xxx (xxx) */ | 777 | /* MLEs: xxx (xxx) */ |
824 | out += snprintf(db->buf + out, db->len - out, | 778 | out += snprintf(buf + out, len - out, |
825 | "MLEs: %d (%d)\n", cur_mles, tot_mles); | 779 | "MLEs: %d (%d)\n", cur_mles, tot_mles); |
826 | 780 | ||
827 | /* Blocking: xxx (xxx) */ | 781 | /* Blocking: xxx (xxx) */ |
828 | out += snprintf(db->buf + out, db->len - out, | 782 | out += snprintf(buf + out, len - out, |
829 | " Blocking: %d (%d)\n", | 783 | " Blocking: %d (%d)\n", |
830 | atomic_read(&dlm->mle_cur_count[DLM_MLE_BLOCK]), | 784 | atomic_read(&dlm->mle_cur_count[DLM_MLE_BLOCK]), |
831 | atomic_read(&dlm->mle_tot_count[DLM_MLE_BLOCK])); | 785 | atomic_read(&dlm->mle_tot_count[DLM_MLE_BLOCK])); |
832 | 786 | ||
833 | /* Mastery: xxx (xxx) */ | 787 | /* Mastery: xxx (xxx) */ |
834 | out += snprintf(db->buf + out, db->len - out, | 788 | out += snprintf(buf + out, len - out, |
835 | " Mastery: %d (%d)\n", | 789 | " Mastery: %d (%d)\n", |
836 | atomic_read(&dlm->mle_cur_count[DLM_MLE_MASTER]), | 790 | atomic_read(&dlm->mle_cur_count[DLM_MLE_MASTER]), |
837 | atomic_read(&dlm->mle_tot_count[DLM_MLE_MASTER])); | 791 | atomic_read(&dlm->mle_tot_count[DLM_MLE_MASTER])); |
838 | 792 | ||
839 | /* Migration: xxx (xxx) */ | 793 | /* Migration: xxx (xxx) */ |
840 | out += snprintf(db->buf + out, db->len - out, | 794 | out += snprintf(buf + out, len - out, |
841 | " Migration: %d (%d)\n", | 795 | " Migration: %d (%d)\n", |
842 | atomic_read(&dlm->mle_cur_count[DLM_MLE_MIGRATION]), | 796 | atomic_read(&dlm->mle_cur_count[DLM_MLE_MIGRATION]), |
843 | atomic_read(&dlm->mle_tot_count[DLM_MLE_MIGRATION])); | 797 | atomic_read(&dlm->mle_tot_count[DLM_MLE_MIGRATION])); |
844 | 798 | ||
845 | /* Lists: Dirty=Empty Purge=InUse PendingASTs=Empty ... */ | 799 | /* Lists: Dirty=Empty Purge=InUse PendingASTs=Empty ... */ |
846 | out += snprintf(db->buf + out, db->len - out, | 800 | out += snprintf(buf + out, len - out, |
847 | "Lists: Dirty=%s Purge=%s PendingASTs=%s " | 801 | "Lists: Dirty=%s Purge=%s PendingASTs=%s " |
848 | "PendingBASTs=%s\n", | 802 | "PendingBASTs=%s\n", |
849 | (list_empty(&dlm->dirty_list) ? "Empty" : "InUse"), | 803 | (list_empty(&dlm->dirty_list) ? "Empty" : "InUse"), |
@@ -852,12 +806,12 @@ static int debug_state_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | |||
852 | (list_empty(&dlm->pending_basts) ? "Empty" : "InUse")); | 806 | (list_empty(&dlm->pending_basts) ? "Empty" : "InUse")); |
853 | 807 | ||
854 | /* Purge Count: xxx Refs: xxx */ | 808 | /* Purge Count: xxx Refs: xxx */ |
855 | out += snprintf(db->buf + out, db->len - out, | 809 | out += snprintf(buf + out, len - out, |
856 | "Purge Count: %d Refs: %d\n", dlm->purge_count, | 810 | "Purge Count: %d Refs: %d\n", dlm->purge_count, |
857 | atomic_read(&dlm->dlm_refs.refcount)); | 811 | atomic_read(&dlm->dlm_refs.refcount)); |
858 | 812 | ||
859 | /* Dead Node: xxx */ | 813 | /* Dead Node: xxx */ |
860 | out += snprintf(db->buf + out, db->len - out, | 814 | out += snprintf(buf + out, len - out, |
861 | "Dead Node: %d\n", dlm->reco.dead_node); | 815 | "Dead Node: %d\n", dlm->reco.dead_node); |
862 | 816 | ||
863 | /* What about DLM_RECO_STATE_FINALIZE? */ | 817 | /* What about DLM_RECO_STATE_FINALIZE? */ |
@@ -867,19 +821,19 @@ static int debug_state_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | |||
867 | state = "INACTIVE"; | 821 | state = "INACTIVE"; |
868 | 822 | ||
869 | /* Recovery Pid: xxxx Master: xxx State: xxxx */ | 823 | /* Recovery Pid: xxxx Master: xxx State: xxxx */ |
870 | out += snprintf(db->buf + out, db->len - out, | 824 | out += snprintf(buf + out, len - out, |
871 | "Recovery Pid: %d Master: %d State: %s\n", | 825 | "Recovery Pid: %d Master: %d State: %s\n", |
872 | dlm->dlm_reco_thread_task->pid, | 826 | task_pid_nr(dlm->dlm_reco_thread_task), |
873 | dlm->reco.new_master, state); | 827 | dlm->reco.new_master, state); |
874 | 828 | ||
875 | /* Recovery Map: xx xx */ | 829 | /* Recovery Map: xx xx */ |
876 | out += snprintf(db->buf + out, db->len - out, "Recovery Map: "); | 830 | out += snprintf(buf + out, len - out, "Recovery Map: "); |
877 | out += stringify_nodemap(dlm->recovery_map, O2NM_MAX_NODES, | 831 | out += stringify_nodemap(dlm->recovery_map, O2NM_MAX_NODES, |
878 | db->buf + out, db->len - out); | 832 | buf + out, len - out); |
879 | out += snprintf(db->buf + out, db->len - out, "\n"); | 833 | out += snprintf(buf + out, len - out, "\n"); |
880 | 834 | ||
881 | /* Recovery Node State: */ | 835 | /* Recovery Node State: */ |
882 | out += snprintf(db->buf + out, db->len - out, "Recovery Node State:\n"); | 836 | out += snprintf(buf + out, len - out, "Recovery Node State:\n"); |
883 | list_for_each_entry(node, &dlm->reco.node_data, list) { | 837 | list_for_each_entry(node, &dlm->reco.node_data, list) { |
884 | switch (node->state) { | 838 | switch (node->state) { |
885 | case DLM_RECO_NODE_DATA_INIT: | 839 | case DLM_RECO_NODE_DATA_INIT: |
@@ -907,7 +861,7 @@ static int debug_state_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | |||
907 | state = "BAD"; | 861 | state = "BAD"; |
908 | break; | 862 | break; |
909 | } | 863 | } |
910 | out += snprintf(db->buf + out, db->len - out, "\t%u - %s\n", | 864 | out += snprintf(buf + out, len - out, "\t%u - %s\n", |
911 | node->node_num, state); | 865 | node->node_num, state); |
912 | } | 866 | } |
913 | 867 | ||
@@ -919,15 +873,15 @@ static int debug_state_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | |||
919 | static int debug_state_open(struct inode *inode, struct file *file) | 873 | static int debug_state_open(struct inode *inode, struct file *file) |
920 | { | 874 | { |
921 | struct dlm_ctxt *dlm = inode->i_private; | 875 | struct dlm_ctxt *dlm = inode->i_private; |
922 | struct debug_buffer *db = NULL; | 876 | char *buf = NULL; |
923 | 877 | ||
924 | db = debug_buffer_allocate(); | 878 | buf = (char *) get_zeroed_page(GFP_NOFS); |
925 | if (!db) | 879 | if (!buf) |
926 | goto bail; | 880 | goto bail; |
927 | 881 | ||
928 | db->len = debug_state_print(dlm, db); | 882 | i_size_write(inode, debug_state_print(dlm, buf, PAGE_SIZE - 1)); |
929 | 883 | ||
930 | file->private_data = db; | 884 | file->private_data = buf; |
931 | 885 | ||
932 | return 0; | 886 | return 0; |
933 | bail: | 887 | bail: |
@@ -936,9 +890,9 @@ bail: | |||
936 | 890 | ||
937 | static const struct file_operations debug_state_fops = { | 891 | static const struct file_operations debug_state_fops = { |
938 | .open = debug_state_open, | 892 | .open = debug_state_open, |
939 | .release = debug_buffer_release, | 893 | .release = debug_release, |
940 | .read = debug_buffer_read, | 894 | .read = debug_read, |
941 | .llseek = debug_buffer_llseek, | 895 | .llseek = generic_file_llseek, |
942 | }; | 896 | }; |
943 | /* end - debug state funcs */ | 897 | /* end - debug state funcs */ |
944 | 898 | ||
@@ -1002,14 +956,10 @@ void dlm_debug_shutdown(struct dlm_ctxt *dlm) | |||
1002 | struct dlm_debug_ctxt *dc = dlm->dlm_debug_ctxt; | 956 | struct dlm_debug_ctxt *dc = dlm->dlm_debug_ctxt; |
1003 | 957 | ||
1004 | if (dc) { | 958 | if (dc) { |
1005 | if (dc->debug_purgelist_dentry) | 959 | debugfs_remove(dc->debug_purgelist_dentry); |
1006 | debugfs_remove(dc->debug_purgelist_dentry); | 960 | debugfs_remove(dc->debug_mle_dentry); |
1007 | if (dc->debug_mle_dentry) | 961 | debugfs_remove(dc->debug_lockres_dentry); |
1008 | debugfs_remove(dc->debug_mle_dentry); | 962 | debugfs_remove(dc->debug_state_dentry); |
1009 | if (dc->debug_lockres_dentry) | ||
1010 | debugfs_remove(dc->debug_lockres_dentry); | ||
1011 | if (dc->debug_state_dentry) | ||
1012 | debugfs_remove(dc->debug_state_dentry); | ||
1013 | dlm_debug_put(dc); | 963 | dlm_debug_put(dc); |
1014 | } | 964 | } |
1015 | } | 965 | } |
@@ -1040,8 +990,7 @@ bail: | |||
1040 | 990 | ||
1041 | void dlm_destroy_debugfs_subroot(struct dlm_ctxt *dlm) | 991 | void dlm_destroy_debugfs_subroot(struct dlm_ctxt *dlm) |
1042 | { | 992 | { |
1043 | if (dlm->dlm_debugfs_subroot) | 993 | debugfs_remove(dlm->dlm_debugfs_subroot); |
1044 | debugfs_remove(dlm->dlm_debugfs_subroot); | ||
1045 | } | 994 | } |
1046 | 995 | ||
1047 | /* debugfs root */ | 996 | /* debugfs root */ |
@@ -1057,7 +1006,6 @@ int dlm_create_debugfs_root(void) | |||
1057 | 1006 | ||
1058 | void dlm_destroy_debugfs_root(void) | 1007 | void dlm_destroy_debugfs_root(void) |
1059 | { | 1008 | { |
1060 | if (dlm_debugfs_root) | 1009 | debugfs_remove(dlm_debugfs_root); |
1061 | debugfs_remove(dlm_debugfs_root); | ||
1062 | } | 1010 | } |
1063 | #endif /* CONFIG_DEBUG_FS */ | 1011 | #endif /* CONFIG_DEBUG_FS */ |
diff --git a/fs/ocfs2/dlm/dlmdebug.h b/fs/ocfs2/dlm/dlmdebug.h index 8c686d22f9c7..1f27c4812d1a 100644 --- a/fs/ocfs2/dlm/dlmdebug.h +++ b/fs/ocfs2/dlm/dlmdebug.h | |||
@@ -37,11 +37,6 @@ struct dlm_debug_ctxt { | |||
37 | struct dentry *debug_purgelist_dentry; | 37 | struct dentry *debug_purgelist_dentry; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | struct debug_buffer { | ||
41 | int len; | ||
42 | char *buf; | ||
43 | }; | ||
44 | |||
45 | struct debug_lockres { | 40 | struct debug_lockres { |
46 | int dl_len; | 41 | int dl_len; |
47 | char *dl_buf; | 42 | char *dl_buf; |
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index cc2aaa96cfe5..7e38a072d720 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c | |||
@@ -460,8 +460,6 @@ redo_bucket: | |||
460 | } | 460 | } |
461 | cond_resched_lock(&dlm->spinlock); | 461 | cond_resched_lock(&dlm->spinlock); |
462 | num += n; | 462 | num += n; |
463 | mlog(0, "%s: touched %d lockreses in bucket %d " | ||
464 | "(tot=%d)\n", dlm->name, n, i, num); | ||
465 | } | 463 | } |
466 | spin_unlock(&dlm->spinlock); | 464 | spin_unlock(&dlm->spinlock); |
467 | wake_up(&dlm->dlm_thread_wq); | 465 | wake_up(&dlm->dlm_thread_wq); |
@@ -1661,8 +1659,8 @@ bail: | |||
1661 | 1659 | ||
1662 | static void dlm_unregister_domain_handlers(struct dlm_ctxt *dlm) | 1660 | static void dlm_unregister_domain_handlers(struct dlm_ctxt *dlm) |
1663 | { | 1661 | { |
1664 | o2hb_unregister_callback(NULL, &dlm->dlm_hb_up); | 1662 | o2hb_unregister_callback(dlm->name, &dlm->dlm_hb_up); |
1665 | o2hb_unregister_callback(NULL, &dlm->dlm_hb_down); | 1663 | o2hb_unregister_callback(dlm->name, &dlm->dlm_hb_down); |
1666 | o2net_unregister_handler_list(&dlm->dlm_domain_handlers); | 1664 | o2net_unregister_handler_list(&dlm->dlm_domain_handlers); |
1667 | } | 1665 | } |
1668 | 1666 | ||
@@ -1674,13 +1672,13 @@ static int dlm_register_domain_handlers(struct dlm_ctxt *dlm) | |||
1674 | 1672 | ||
1675 | o2hb_setup_callback(&dlm->dlm_hb_down, O2HB_NODE_DOWN_CB, | 1673 | o2hb_setup_callback(&dlm->dlm_hb_down, O2HB_NODE_DOWN_CB, |
1676 | dlm_hb_node_down_cb, dlm, DLM_HB_NODE_DOWN_PRI); | 1674 | dlm_hb_node_down_cb, dlm, DLM_HB_NODE_DOWN_PRI); |
1677 | status = o2hb_register_callback(NULL, &dlm->dlm_hb_down); | 1675 | status = o2hb_register_callback(dlm->name, &dlm->dlm_hb_down); |
1678 | if (status) | 1676 | if (status) |
1679 | goto bail; | 1677 | goto bail; |
1680 | 1678 | ||
1681 | o2hb_setup_callback(&dlm->dlm_hb_up, O2HB_NODE_UP_CB, | 1679 | o2hb_setup_callback(&dlm->dlm_hb_up, O2HB_NODE_UP_CB, |
1682 | dlm_hb_node_up_cb, dlm, DLM_HB_NODE_UP_PRI); | 1680 | dlm_hb_node_up_cb, dlm, DLM_HB_NODE_UP_PRI); |
1683 | status = o2hb_register_callback(NULL, &dlm->dlm_hb_up); | 1681 | status = o2hb_register_callback(dlm->name, &dlm->dlm_hb_up); |
1684 | if (status) | 1682 | if (status) |
1685 | goto bail; | 1683 | goto bail; |
1686 | 1684 | ||
diff --git a/fs/ocfs2/dlm/dlmlock.c b/fs/ocfs2/dlm/dlmlock.c index 69cf369961c4..7009292aac5a 100644 --- a/fs/ocfs2/dlm/dlmlock.c +++ b/fs/ocfs2/dlm/dlmlock.c | |||
@@ -106,6 +106,9 @@ static int dlm_can_grant_new_lock(struct dlm_lock_resource *res, | |||
106 | 106 | ||
107 | if (!dlm_lock_compatible(tmplock->ml.type, lock->ml.type)) | 107 | if (!dlm_lock_compatible(tmplock->ml.type, lock->ml.type)) |
108 | return 0; | 108 | return 0; |
109 | if (!dlm_lock_compatible(tmplock->ml.convert_type, | ||
110 | lock->ml.type)) | ||
111 | return 0; | ||
109 | } | 112 | } |
110 | 113 | ||
111 | return 1; | 114 | return 1; |
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c index 2211acf33d9b..1d6d1d22c471 100644 --- a/fs/ocfs2/dlm/dlmthread.c +++ b/fs/ocfs2/dlm/dlmthread.c | |||
@@ -122,15 +122,13 @@ int __dlm_lockres_unused(struct dlm_lock_resource *res) | |||
122 | void __dlm_lockres_calc_usage(struct dlm_ctxt *dlm, | 122 | void __dlm_lockres_calc_usage(struct dlm_ctxt *dlm, |
123 | struct dlm_lock_resource *res) | 123 | struct dlm_lock_resource *res) |
124 | { | 124 | { |
125 | mlog_entry("%.*s\n", res->lockname.len, res->lockname.name); | ||
126 | |||
127 | assert_spin_locked(&dlm->spinlock); | 125 | assert_spin_locked(&dlm->spinlock); |
128 | assert_spin_locked(&res->spinlock); | 126 | assert_spin_locked(&res->spinlock); |
129 | 127 | ||
130 | if (__dlm_lockres_unused(res)){ | 128 | if (__dlm_lockres_unused(res)){ |
131 | if (list_empty(&res->purge)) { | 129 | if (list_empty(&res->purge)) { |
132 | mlog(0, "putting lockres %.*s:%p onto purge list\n", | 130 | mlog(0, "%s: Adding res %.*s to purge list\n", |
133 | res->lockname.len, res->lockname.name, res); | 131 | dlm->name, res->lockname.len, res->lockname.name); |
134 | 132 | ||
135 | res->last_used = jiffies; | 133 | res->last_used = jiffies; |
136 | dlm_lockres_get(res); | 134 | dlm_lockres_get(res); |
@@ -138,8 +136,8 @@ void __dlm_lockres_calc_usage(struct dlm_ctxt *dlm, | |||
138 | dlm->purge_count++; | 136 | dlm->purge_count++; |
139 | } | 137 | } |
140 | } else if (!list_empty(&res->purge)) { | 138 | } else if (!list_empty(&res->purge)) { |
141 | mlog(0, "removing lockres %.*s:%p from purge list, owner=%u\n", | 139 | mlog(0, "%s: Removing res %.*s from purge list\n", |
142 | res->lockname.len, res->lockname.name, res, res->owner); | 140 | dlm->name, res->lockname.len, res->lockname.name); |
143 | 141 | ||
144 | list_del_init(&res->purge); | 142 | list_del_init(&res->purge); |
145 | dlm_lockres_put(res); | 143 | dlm_lockres_put(res); |
@@ -150,7 +148,6 @@ void __dlm_lockres_calc_usage(struct dlm_ctxt *dlm, | |||
150 | void dlm_lockres_calc_usage(struct dlm_ctxt *dlm, | 148 | void dlm_lockres_calc_usage(struct dlm_ctxt *dlm, |
151 | struct dlm_lock_resource *res) | 149 | struct dlm_lock_resource *res) |
152 | { | 150 | { |
153 | mlog_entry("%.*s\n", res->lockname.len, res->lockname.name); | ||
154 | spin_lock(&dlm->spinlock); | 151 | spin_lock(&dlm->spinlock); |
155 | spin_lock(&res->spinlock); | 152 | spin_lock(&res->spinlock); |
156 | 153 | ||
@@ -171,9 +168,8 @@ static void dlm_purge_lockres(struct dlm_ctxt *dlm, | |||
171 | 168 | ||
172 | master = (res->owner == dlm->node_num); | 169 | master = (res->owner == dlm->node_num); |
173 | 170 | ||
174 | 171 | mlog(0, "%s: Purging res %.*s, master %d\n", dlm->name, | |
175 | mlog(0, "purging lockres %.*s, master = %d\n", res->lockname.len, | 172 | res->lockname.len, res->lockname.name, master); |
176 | res->lockname.name, master); | ||
177 | 173 | ||
178 | if (!master) { | 174 | if (!master) { |
179 | res->state |= DLM_LOCK_RES_DROPPING_REF; | 175 | res->state |= DLM_LOCK_RES_DROPPING_REF; |
@@ -189,27 +185,25 @@ static void dlm_purge_lockres(struct dlm_ctxt *dlm, | |||
189 | /* clear our bit from the master's refmap, ignore errors */ | 185 | /* clear our bit from the master's refmap, ignore errors */ |
190 | ret = dlm_drop_lockres_ref(dlm, res); | 186 | ret = dlm_drop_lockres_ref(dlm, res); |
191 | if (ret < 0) { | 187 | if (ret < 0) { |
192 | mlog_errno(ret); | 188 | mlog(ML_ERROR, "%s: deref %.*s failed %d\n", dlm->name, |
189 | res->lockname.len, res->lockname.name, ret); | ||
193 | if (!dlm_is_host_down(ret)) | 190 | if (!dlm_is_host_down(ret)) |
194 | BUG(); | 191 | BUG(); |
195 | } | 192 | } |
196 | mlog(0, "%s:%.*s: dlm_deref_lockres returned %d\n", | ||
197 | dlm->name, res->lockname.len, res->lockname.name, ret); | ||
198 | spin_lock(&dlm->spinlock); | 193 | spin_lock(&dlm->spinlock); |
199 | spin_lock(&res->spinlock); | 194 | spin_lock(&res->spinlock); |
200 | } | 195 | } |
201 | 196 | ||
202 | if (!list_empty(&res->purge)) { | 197 | if (!list_empty(&res->purge)) { |
203 | mlog(0, "removing lockres %.*s:%p from purgelist, " | 198 | mlog(0, "%s: Removing res %.*s from purgelist, master %d\n", |
204 | "master = %d\n", res->lockname.len, res->lockname.name, | 199 | dlm->name, res->lockname.len, res->lockname.name, master); |
205 | res, master); | ||
206 | list_del_init(&res->purge); | 200 | list_del_init(&res->purge); |
207 | dlm_lockres_put(res); | 201 | dlm_lockres_put(res); |
208 | dlm->purge_count--; | 202 | dlm->purge_count--; |
209 | } | 203 | } |
210 | 204 | ||
211 | if (!__dlm_lockres_unused(res)) { | 205 | if (!__dlm_lockres_unused(res)) { |
212 | mlog(ML_ERROR, "found lockres %s:%.*s: in use after deref\n", | 206 | mlog(ML_ERROR, "%s: res %.*s in use after deref\n", |
213 | dlm->name, res->lockname.len, res->lockname.name); | 207 | dlm->name, res->lockname.len, res->lockname.name); |
214 | __dlm_print_one_lock_resource(res); | 208 | __dlm_print_one_lock_resource(res); |
215 | BUG(); | 209 | BUG(); |
@@ -266,10 +260,10 @@ static void dlm_run_purge_list(struct dlm_ctxt *dlm, | |||
266 | unused = __dlm_lockres_unused(lockres); | 260 | unused = __dlm_lockres_unused(lockres); |
267 | if (!unused || | 261 | if (!unused || |
268 | (lockres->state & DLM_LOCK_RES_MIGRATING)) { | 262 | (lockres->state & DLM_LOCK_RES_MIGRATING)) { |
269 | mlog(0, "lockres %s:%.*s: is in use or " | 263 | mlog(0, "%s: res %.*s is in use or being remastered, " |
270 | "being remastered, used %d, state %d\n", | 264 | "used %d, state %d\n", dlm->name, |
271 | dlm->name, lockres->lockname.len, | 265 | lockres->lockname.len, lockres->lockname.name, |
272 | lockres->lockname.name, !unused, lockres->state); | 266 | !unused, lockres->state); |
273 | list_move_tail(&dlm->purge_list, &lockres->purge); | 267 | list_move_tail(&dlm->purge_list, &lockres->purge); |
274 | spin_unlock(&lockres->spinlock); | 268 | spin_unlock(&lockres->spinlock); |
275 | continue; | 269 | continue; |
@@ -296,15 +290,12 @@ static void dlm_shuffle_lists(struct dlm_ctxt *dlm, | |||
296 | struct list_head *head; | 290 | struct list_head *head; |
297 | int can_grant = 1; | 291 | int can_grant = 1; |
298 | 292 | ||
299 | //mlog(0, "res->lockname.len=%d\n", res->lockname.len); | 293 | /* |
300 | //mlog(0, "res->lockname.name=%p\n", res->lockname.name); | 294 | * Because this function is called with the lockres |
301 | //mlog(0, "shuffle res %.*s\n", res->lockname.len, | ||
302 | // res->lockname.name); | ||
303 | |||
304 | /* because this function is called with the lockres | ||
305 | * spinlock, and because we know that it is not migrating/ | 295 | * spinlock, and because we know that it is not migrating/ |
306 | * recovering/in-progress, it is fine to reserve asts and | 296 | * recovering/in-progress, it is fine to reserve asts and |
307 | * basts right before queueing them all throughout */ | 297 | * basts right before queueing them all throughout |
298 | */ | ||
308 | assert_spin_locked(&dlm->ast_lock); | 299 | assert_spin_locked(&dlm->ast_lock); |
309 | assert_spin_locked(&res->spinlock); | 300 | assert_spin_locked(&res->spinlock); |
310 | BUG_ON((res->state & (DLM_LOCK_RES_MIGRATING| | 301 | BUG_ON((res->state & (DLM_LOCK_RES_MIGRATING| |
@@ -314,13 +305,13 @@ static void dlm_shuffle_lists(struct dlm_ctxt *dlm, | |||
314 | converting: | 305 | converting: |
315 | if (list_empty(&res->converting)) | 306 | if (list_empty(&res->converting)) |
316 | goto blocked; | 307 | goto blocked; |
317 | mlog(0, "res %.*s has locks on a convert queue\n", res->lockname.len, | 308 | mlog(0, "%s: res %.*s has locks on the convert queue\n", dlm->name, |
318 | res->lockname.name); | 309 | res->lockname.len, res->lockname.name); |
319 | 310 | ||
320 | target = list_entry(res->converting.next, struct dlm_lock, list); | 311 | target = list_entry(res->converting.next, struct dlm_lock, list); |
321 | if (target->ml.convert_type == LKM_IVMODE) { | 312 | if (target->ml.convert_type == LKM_IVMODE) { |
322 | mlog(ML_ERROR, "%.*s: converting a lock with no " | 313 | mlog(ML_ERROR, "%s: res %.*s converting lock to invalid mode\n", |
323 | "convert_type!\n", res->lockname.len, res->lockname.name); | 314 | dlm->name, res->lockname.len, res->lockname.name); |
324 | BUG(); | 315 | BUG(); |
325 | } | 316 | } |
326 | head = &res->granted; | 317 | head = &res->granted; |
@@ -365,9 +356,12 @@ converting: | |||
365 | spin_lock(&target->spinlock); | 356 | spin_lock(&target->spinlock); |
366 | BUG_ON(target->ml.highest_blocked != LKM_IVMODE); | 357 | BUG_ON(target->ml.highest_blocked != LKM_IVMODE); |
367 | 358 | ||
368 | mlog(0, "calling ast for converting lock: %.*s, have: %d, " | 359 | mlog(0, "%s: res %.*s, AST for Converting lock %u:%llu, type " |
369 | "granting: %d, node: %u\n", res->lockname.len, | 360 | "%d => %d, node %u\n", dlm->name, res->lockname.len, |
370 | res->lockname.name, target->ml.type, | 361 | res->lockname.name, |
362 | dlm_get_lock_cookie_node(be64_to_cpu(target->ml.cookie)), | ||
363 | dlm_get_lock_cookie_seq(be64_to_cpu(target->ml.cookie)), | ||
364 | target->ml.type, | ||
371 | target->ml.convert_type, target->ml.node); | 365 | target->ml.convert_type, target->ml.node); |
372 | 366 | ||
373 | target->ml.type = target->ml.convert_type; | 367 | target->ml.type = target->ml.convert_type; |
@@ -428,11 +422,14 @@ blocked: | |||
428 | spin_lock(&target->spinlock); | 422 | spin_lock(&target->spinlock); |
429 | BUG_ON(target->ml.highest_blocked != LKM_IVMODE); | 423 | BUG_ON(target->ml.highest_blocked != LKM_IVMODE); |
430 | 424 | ||
431 | mlog(0, "calling ast for blocked lock: %.*s, granting: %d, " | 425 | mlog(0, "%s: res %.*s, AST for Blocked lock %u:%llu, type %d, " |
432 | "node: %u\n", res->lockname.len, res->lockname.name, | 426 | "node %u\n", dlm->name, res->lockname.len, |
427 | res->lockname.name, | ||
428 | dlm_get_lock_cookie_node(be64_to_cpu(target->ml.cookie)), | ||
429 | dlm_get_lock_cookie_seq(be64_to_cpu(target->ml.cookie)), | ||
433 | target->ml.type, target->ml.node); | 430 | target->ml.type, target->ml.node); |
434 | 431 | ||
435 | // target->ml.type is already correct | 432 | /* target->ml.type is already correct */ |
436 | list_move_tail(&target->list, &res->granted); | 433 | list_move_tail(&target->list, &res->granted); |
437 | 434 | ||
438 | BUG_ON(!target->lksb); | 435 | BUG_ON(!target->lksb); |
@@ -453,7 +450,6 @@ leave: | |||
453 | /* must have NO locks when calling this with res !=NULL * */ | 450 | /* must have NO locks when calling this with res !=NULL * */ |
454 | void dlm_kick_thread(struct dlm_ctxt *dlm, struct dlm_lock_resource *res) | 451 | void dlm_kick_thread(struct dlm_ctxt *dlm, struct dlm_lock_resource *res) |
455 | { | 452 | { |
456 | mlog_entry("dlm=%p, res=%p\n", dlm, res); | ||
457 | if (res) { | 453 | if (res) { |
458 | spin_lock(&dlm->spinlock); | 454 | spin_lock(&dlm->spinlock); |
459 | spin_lock(&res->spinlock); | 455 | spin_lock(&res->spinlock); |
@@ -466,8 +462,6 @@ void dlm_kick_thread(struct dlm_ctxt *dlm, struct dlm_lock_resource *res) | |||
466 | 462 | ||
467 | void __dlm_dirty_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res) | 463 | void __dlm_dirty_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res) |
468 | { | 464 | { |
469 | mlog_entry("dlm=%p, res=%p\n", dlm, res); | ||
470 | |||
471 | assert_spin_locked(&dlm->spinlock); | 465 | assert_spin_locked(&dlm->spinlock); |
472 | assert_spin_locked(&res->spinlock); | 466 | assert_spin_locked(&res->spinlock); |
473 | 467 | ||
@@ -484,13 +478,16 @@ void __dlm_dirty_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res) | |||
484 | res->state |= DLM_LOCK_RES_DIRTY; | 478 | res->state |= DLM_LOCK_RES_DIRTY; |
485 | } | 479 | } |
486 | } | 480 | } |
481 | |||
482 | mlog(0, "%s: res %.*s\n", dlm->name, res->lockname.len, | ||
483 | res->lockname.name); | ||
487 | } | 484 | } |
488 | 485 | ||
489 | 486 | ||
490 | /* Launch the NM thread for the mounted volume */ | 487 | /* Launch the NM thread for the mounted volume */ |
491 | int dlm_launch_thread(struct dlm_ctxt *dlm) | 488 | int dlm_launch_thread(struct dlm_ctxt *dlm) |
492 | { | 489 | { |
493 | mlog(0, "starting dlm thread...\n"); | 490 | mlog(0, "Starting dlm_thread...\n"); |
494 | 491 | ||
495 | dlm->dlm_thread_task = kthread_run(dlm_thread, dlm, "dlm_thread"); | 492 | dlm->dlm_thread_task = kthread_run(dlm_thread, dlm, "dlm_thread"); |
496 | if (IS_ERR(dlm->dlm_thread_task)) { | 493 | if (IS_ERR(dlm->dlm_thread_task)) { |
@@ -505,7 +502,7 @@ int dlm_launch_thread(struct dlm_ctxt *dlm) | |||
505 | void dlm_complete_thread(struct dlm_ctxt *dlm) | 502 | void dlm_complete_thread(struct dlm_ctxt *dlm) |
506 | { | 503 | { |
507 | if (dlm->dlm_thread_task) { | 504 | if (dlm->dlm_thread_task) { |
508 | mlog(ML_KTHREAD, "waiting for dlm thread to exit\n"); | 505 | mlog(ML_KTHREAD, "Waiting for dlm thread to exit\n"); |
509 | kthread_stop(dlm->dlm_thread_task); | 506 | kthread_stop(dlm->dlm_thread_task); |
510 | dlm->dlm_thread_task = NULL; | 507 | dlm->dlm_thread_task = NULL; |
511 | } | 508 | } |
@@ -536,7 +533,12 @@ static void dlm_flush_asts(struct dlm_ctxt *dlm) | |||
536 | /* get an extra ref on lock */ | 533 | /* get an extra ref on lock */ |
537 | dlm_lock_get(lock); | 534 | dlm_lock_get(lock); |
538 | res = lock->lockres; | 535 | res = lock->lockres; |
539 | mlog(0, "delivering an ast for this lockres\n"); | 536 | mlog(0, "%s: res %.*s, Flush AST for lock %u:%llu, type %d, " |
537 | "node %u\n", dlm->name, res->lockname.len, | ||
538 | res->lockname.name, | ||
539 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), | ||
540 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), | ||
541 | lock->ml.type, lock->ml.node); | ||
540 | 542 | ||
541 | BUG_ON(!lock->ast_pending); | 543 | BUG_ON(!lock->ast_pending); |
542 | 544 | ||
@@ -557,9 +559,9 @@ static void dlm_flush_asts(struct dlm_ctxt *dlm) | |||
557 | /* possible that another ast was queued while | 559 | /* possible that another ast was queued while |
558 | * we were delivering the last one */ | 560 | * we were delivering the last one */ |
559 | if (!list_empty(&lock->ast_list)) { | 561 | if (!list_empty(&lock->ast_list)) { |
560 | mlog(0, "aha another ast got queued while " | 562 | mlog(0, "%s: res %.*s, AST queued while flushing last " |
561 | "we were finishing the last one. will " | 563 | "one\n", dlm->name, res->lockname.len, |
562 | "keep the ast_pending flag set.\n"); | 564 | res->lockname.name); |
563 | } else | 565 | } else |
564 | lock->ast_pending = 0; | 566 | lock->ast_pending = 0; |
565 | 567 | ||
@@ -590,8 +592,12 @@ static void dlm_flush_asts(struct dlm_ctxt *dlm) | |||
590 | dlm_lock_put(lock); | 592 | dlm_lock_put(lock); |
591 | spin_unlock(&dlm->ast_lock); | 593 | spin_unlock(&dlm->ast_lock); |
592 | 594 | ||
593 | mlog(0, "delivering a bast for this lockres " | 595 | mlog(0, "%s: res %.*s, Flush BAST for lock %u:%llu, " |
594 | "(blocked = %d\n", hi); | 596 | "blocked %d, node %u\n", |
597 | dlm->name, res->lockname.len, res->lockname.name, | ||
598 | dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), | ||
599 | dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), | ||
600 | hi, lock->ml.node); | ||
595 | 601 | ||
596 | if (lock->ml.node != dlm->node_num) { | 602 | if (lock->ml.node != dlm->node_num) { |
597 | ret = dlm_send_proxy_bast(dlm, res, lock, hi); | 603 | ret = dlm_send_proxy_bast(dlm, res, lock, hi); |
@@ -605,9 +611,9 @@ static void dlm_flush_asts(struct dlm_ctxt *dlm) | |||
605 | /* possible that another bast was queued while | 611 | /* possible that another bast was queued while |
606 | * we were delivering the last one */ | 612 | * we were delivering the last one */ |
607 | if (!list_empty(&lock->bast_list)) { | 613 | if (!list_empty(&lock->bast_list)) { |
608 | mlog(0, "aha another bast got queued while " | 614 | mlog(0, "%s: res %.*s, BAST queued while flushing last " |
609 | "we were finishing the last one. will " | 615 | "one\n", dlm->name, res->lockname.len, |
610 | "keep the bast_pending flag set.\n"); | 616 | res->lockname.name); |
611 | } else | 617 | } else |
612 | lock->bast_pending = 0; | 618 | lock->bast_pending = 0; |
613 | 619 | ||
@@ -675,11 +681,12 @@ static int dlm_thread(void *data) | |||
675 | spin_lock(&res->spinlock); | 681 | spin_lock(&res->spinlock); |
676 | if (res->owner != dlm->node_num) { | 682 | if (res->owner != dlm->node_num) { |
677 | __dlm_print_one_lock_resource(res); | 683 | __dlm_print_one_lock_resource(res); |
678 | mlog(ML_ERROR, "inprog:%s, mig:%s, reco:%s, dirty:%s\n", | 684 | mlog(ML_ERROR, "%s: inprog %d, mig %d, reco %d," |
679 | res->state & DLM_LOCK_RES_IN_PROGRESS ? "yes" : "no", | 685 | " dirty %d\n", dlm->name, |
680 | res->state & DLM_LOCK_RES_MIGRATING ? "yes" : "no", | 686 | !!(res->state & DLM_LOCK_RES_IN_PROGRESS), |
681 | res->state & DLM_LOCK_RES_RECOVERING ? "yes" : "no", | 687 | !!(res->state & DLM_LOCK_RES_MIGRATING), |
682 | res->state & DLM_LOCK_RES_DIRTY ? "yes" : "no"); | 688 | !!(res->state & DLM_LOCK_RES_RECOVERING), |
689 | !!(res->state & DLM_LOCK_RES_DIRTY)); | ||
683 | } | 690 | } |
684 | BUG_ON(res->owner != dlm->node_num); | 691 | BUG_ON(res->owner != dlm->node_num); |
685 | 692 | ||
@@ -693,8 +700,8 @@ static int dlm_thread(void *data) | |||
693 | res->state &= ~DLM_LOCK_RES_DIRTY; | 700 | res->state &= ~DLM_LOCK_RES_DIRTY; |
694 | spin_unlock(&res->spinlock); | 701 | spin_unlock(&res->spinlock); |
695 | spin_unlock(&dlm->ast_lock); | 702 | spin_unlock(&dlm->ast_lock); |
696 | mlog(0, "delaying list shuffling for in-" | 703 | mlog(0, "%s: res %.*s, inprogress, delay list " |
697 | "progress lockres %.*s, state=%d\n", | 704 | "shuffle, state %d\n", dlm->name, |
698 | res->lockname.len, res->lockname.name, | 705 | res->lockname.len, res->lockname.name, |
699 | res->state); | 706 | res->state); |
700 | delay = 1; | 707 | delay = 1; |
@@ -706,10 +713,6 @@ static int dlm_thread(void *data) | |||
706 | * spinlock and do NOT have the dlm lock. | 713 | * spinlock and do NOT have the dlm lock. |
707 | * safe to reserve/queue asts and run the lists. */ | 714 | * safe to reserve/queue asts and run the lists. */ |
708 | 715 | ||
709 | mlog(0, "calling dlm_shuffle_lists with dlm=%s, " | ||
710 | "res=%.*s\n", dlm->name, | ||
711 | res->lockname.len, res->lockname.name); | ||
712 | |||
713 | /* called while holding lockres lock */ | 716 | /* called while holding lockres lock */ |
714 | dlm_shuffle_lists(dlm, res); | 717 | dlm_shuffle_lists(dlm, res); |
715 | res->state &= ~DLM_LOCK_RES_DIRTY; | 718 | res->state &= ~DLM_LOCK_RES_DIRTY; |
@@ -733,7 +736,8 @@ in_progress: | |||
733 | /* unlikely, but we may need to give time to | 736 | /* unlikely, but we may need to give time to |
734 | * other tasks */ | 737 | * other tasks */ |
735 | if (!--n) { | 738 | if (!--n) { |
736 | mlog(0, "throttling dlm_thread\n"); | 739 | mlog(0, "%s: Throttling dlm thread\n", |
740 | dlm->name); | ||
737 | break; | 741 | break; |
738 | } | 742 | } |
739 | } | 743 | } |