aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2006-08-18 12:54:25 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-08-21 09:50:09 -0400
commita345da3e8f28ff69e1b14df78f7ddc6e7b78b726 (patch)
treea1aa40c1aae01064b64b953c9b4a16180dd82be9 /fs/dlm
parent15d00c0b91ca776b51b5ab04f79ab35b06670d30 (diff)
[DLM] dump rsb and locks on assert
Introduce new function dlm_dump_rsb() to call within assertions instead of dlm_print_rsb(). The new function dumps info about all locks on the rsb in addition to rsb details. Signed-off-by: David Teigland <teigland@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/dlm')
-rw-r--r--fs/dlm/lock.c40
-rw-r--r--fs/dlm/lock.h1
-rw-r--r--fs/dlm/recover.c4
3 files changed, 34 insertions, 11 deletions
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index bb2e35151210..712438513cc4 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -171,6 +171,28 @@ void dlm_print_rsb(struct dlm_rsb *r)
171 r->res_recover_locks_count, r->res_name); 171 r->res_recover_locks_count, r->res_name);
172} 172}
173 173
174void dlm_dump_rsb(struct dlm_rsb *r)
175{
176 struct dlm_lkb *lkb;
177
178 dlm_print_rsb(r);
179
180 printk(KERN_ERR "rsb: root_list empty %d recover_list empty %d\n",
181 list_empty(&r->res_root_list), list_empty(&r->res_recover_list));
182 printk(KERN_ERR "rsb lookup list\n");
183 list_for_each_entry(lkb, &r->res_lookup, lkb_rsb_lookup)
184 dlm_print_lkb(lkb);
185 printk(KERN_ERR "rsb grant queue:\n");
186 list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue)
187 dlm_print_lkb(lkb);
188 printk(KERN_ERR "rsb convert queue:\n");
189 list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue)
190 dlm_print_lkb(lkb);
191 printk(KERN_ERR "rsb wait queue:\n");
192 list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue)
193 dlm_print_lkb(lkb);
194}
195
174/* Threads cannot use the lockspace while it's being recovered */ 196/* Threads cannot use the lockspace while it's being recovered */
175 197
176static inline void lock_recovery(struct dlm_ls *ls) 198static inline void lock_recovery(struct dlm_ls *ls)
@@ -478,7 +500,7 @@ static void unhold_rsb(struct dlm_rsb *r)
478{ 500{
479 int rv; 501 int rv;
480 rv = kref_put(&r->res_ref, toss_rsb); 502 rv = kref_put(&r->res_ref, toss_rsb);
481 DLM_ASSERT(!rv, dlm_print_rsb(r);); 503 DLM_ASSERT(!rv, dlm_dump_rsb(r););
482} 504}
483 505
484static void kill_rsb(struct kref *kref) 506static void kill_rsb(struct kref *kref)
@@ -488,12 +510,12 @@ static void kill_rsb(struct kref *kref)
488 /* All work is done after the return from kref_put() so we 510 /* All work is done after the return from kref_put() so we
489 can release the write_lock before the remove and free. */ 511 can release the write_lock before the remove and free. */
490 512
491 DLM_ASSERT(list_empty(&r->res_lookup),); 513 DLM_ASSERT(list_empty(&r->res_lookup), dlm_dump_rsb(r););
492 DLM_ASSERT(list_empty(&r->res_grantqueue),); 514 DLM_ASSERT(list_empty(&r->res_grantqueue), dlm_dump_rsb(r););
493 DLM_ASSERT(list_empty(&r->res_convertqueue),); 515 DLM_ASSERT(list_empty(&r->res_convertqueue), dlm_dump_rsb(r););
494 DLM_ASSERT(list_empty(&r->res_waitqueue),); 516 DLM_ASSERT(list_empty(&r->res_waitqueue), dlm_dump_rsb(r););
495 DLM_ASSERT(list_empty(&r->res_root_list),); 517 DLM_ASSERT(list_empty(&r->res_root_list), dlm_dump_rsb(r););
496 DLM_ASSERT(list_empty(&r->res_recover_list),); 518 DLM_ASSERT(list_empty(&r->res_recover_list), dlm_dump_rsb(r););
497} 519}
498 520
499/* Attaching/detaching lkb's from rsb's is for rsb reference counting. 521/* Attaching/detaching lkb's from rsb's is for rsb reference counting.
@@ -1336,7 +1358,7 @@ static void grant_pending_locks(struct dlm_rsb *r)
1336 struct dlm_lkb *lkb, *s; 1358 struct dlm_lkb *lkb, *s;
1337 int high = DLM_LOCK_IV; 1359 int high = DLM_LOCK_IV;
1338 1360
1339 DLM_ASSERT(is_master(r), dlm_print_rsb(r);); 1361 DLM_ASSERT(is_master(r), dlm_dump_rsb(r););
1340 1362
1341 high = grant_pending_convert(r, high); 1363 high = grant_pending_convert(r, high);
1342 high = grant_pending_wait(r, high); 1364 high = grant_pending_wait(r, high);
@@ -1431,7 +1453,7 @@ static int set_master(struct dlm_rsb *r, struct dlm_lkb *lkb)
1431 return 0; 1453 return 0;
1432 } 1454 }
1433 1455
1434 DLM_ASSERT(r->res_nodeid == -1, dlm_print_rsb(r);); 1456 DLM_ASSERT(r->res_nodeid == -1, dlm_dump_rsb(r););
1435 1457
1436 dir_nodeid = dlm_dir_nodeid(r); 1458 dir_nodeid = dlm_dir_nodeid(r);
1437 1459
diff --git a/fs/dlm/lock.h b/fs/dlm/lock.h
index 8d2660f0ab10..0843a3073ec3 100644
--- a/fs/dlm/lock.h
+++ b/fs/dlm/lock.h
@@ -14,6 +14,7 @@
14#define __LOCK_DOT_H__ 14#define __LOCK_DOT_H__
15 15
16void dlm_print_rsb(struct dlm_rsb *r); 16void dlm_print_rsb(struct dlm_rsb *r);
17void dlm_dump_rsb(struct dlm_rsb *r);
17void dlm_print_lkb(struct dlm_lkb *lkb); 18void dlm_print_lkb(struct dlm_lkb *lkb);
18int dlm_receive_message(struct dlm_header *hd, int nodeid, int recovery); 19int dlm_receive_message(struct dlm_header *hd, int nodeid, int recovery);
19int dlm_modes_compat(int mode1, int mode2); 20int dlm_modes_compat(int mode1, int mode2);
diff --git a/fs/dlm/recover.c b/fs/dlm/recover.c
index 1a86dfc8034e..528a2a0fa329 100644
--- a/fs/dlm/recover.c
+++ b/fs/dlm/recover.c
@@ -490,7 +490,7 @@ static int recover_locks(struct dlm_rsb *r)
490 if (all_queues_empty(r)) 490 if (all_queues_empty(r))
491 goto out; 491 goto out;
492 492
493 DLM_ASSERT(!r->res_recover_locks_count, dlm_print_rsb(r);); 493 DLM_ASSERT(!r->res_recover_locks_count, dlm_dump_rsb(r););
494 494
495 error = recover_locks_queue(r, &r->res_grantqueue); 495 error = recover_locks_queue(r, &r->res_grantqueue);
496 if (error) 496 if (error)
@@ -557,7 +557,7 @@ int dlm_recover_locks(struct dlm_ls *ls)
557 557
558void dlm_recovered_lock(struct dlm_rsb *r) 558void dlm_recovered_lock(struct dlm_rsb *r)
559{ 559{
560 DLM_ASSERT(rsb_flag(r, RSB_NEW_MASTER), dlm_print_rsb(r);); 560 DLM_ASSERT(rsb_flag(r, RSB_NEW_MASTER), dlm_dump_rsb(r););
561 561
562 r->res_recover_locks_count--; 562 r->res_recover_locks_count--;
563 if (!r->res_recover_locks_count) { 563 if (!r->res_recover_locks_count) {