Lines Matching +full:lock +full:- +full:state
1 // SPDX-License-Identifier: GPL-2.0-or-later
36 spin_lock(&res->spinlock); in dlm_print_one_lock_resource()
38 spin_unlock(&res->spinlock); in dlm_print_one_lock_resource()
44 assert_spin_locked(&res->spinlock); in dlm_print_lockres_refmap()
49 bit = find_next_bit(res->refmap, O2NM_MAX_NODES, bit); in dlm_print_lockres_refmap()
55 printk("], inflight=%u\n", res->inflight_locks); in dlm_print_lockres_refmap()
58 static void __dlm_print_lock(struct dlm_lock *lock) in __dlm_print_lock() argument
60 spin_lock(&lock->spinlock); in __dlm_print_lock()
64 "pending=(conv=%c,lock=%c,cancel=%c,unlock=%c)\n", in __dlm_print_lock()
65 lock->ml.type, lock->ml.convert_type, lock->ml.node, in __dlm_print_lock()
66 dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), in __dlm_print_lock()
67 dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), in __dlm_print_lock()
68 kref_read(&lock->lock_refs), in __dlm_print_lock()
69 (list_empty(&lock->ast_list) ? 'y' : 'n'), in __dlm_print_lock()
70 (lock->ast_pending ? 'y' : 'n'), in __dlm_print_lock()
71 (list_empty(&lock->bast_list) ? 'y' : 'n'), in __dlm_print_lock()
72 (lock->bast_pending ? 'y' : 'n'), in __dlm_print_lock()
73 (lock->convert_pending ? 'y' : 'n'), in __dlm_print_lock()
74 (lock->lock_pending ? 'y' : 'n'), in __dlm_print_lock()
75 (lock->cancel_pending ? 'y' : 'n'), in __dlm_print_lock()
76 (lock->unlock_pending ? 'y' : 'n')); in __dlm_print_lock()
78 spin_unlock(&lock->spinlock); in __dlm_print_lock()
83 struct dlm_lock *lock; in __dlm_print_one_lock_resource() local
86 assert_spin_locked(&res->spinlock); in __dlm_print_one_lock_resource()
88 stringify_lockname(res->lockname.name, res->lockname.len, in __dlm_print_one_lock_resource()
90 printk("lockres: %s, owner=%u, state=%u\n", in __dlm_print_one_lock_resource()
91 buf, res->owner, res->state); in __dlm_print_one_lock_resource()
93 res->last_used, kref_read(&res->refs), in __dlm_print_one_lock_resource()
94 str_no_yes(list_empty(&res->purge))); in __dlm_print_one_lock_resource()
97 str_no_yes(list_empty(&res->dirty)), in __dlm_print_one_lock_resource()
98 str_no_yes(list_empty(&res->recovering)), in __dlm_print_one_lock_resource()
99 str_yes_no(res->migration_pending)); in __dlm_print_one_lock_resource()
101 res->inflight_locks, atomic_read(&res->asts_reserved)); in __dlm_print_one_lock_resource()
104 list_for_each_entry(lock, &res->granted, list) { in __dlm_print_one_lock_resource()
105 __dlm_print_lock(lock); in __dlm_print_one_lock_resource()
108 list_for_each_entry(lock, &res->converting, list) { in __dlm_print_one_lock_resource()
109 __dlm_print_lock(lock); in __dlm_print_one_lock_resource()
112 list_for_each_entry(lock, &res->blocked, list) { in __dlm_print_one_lock_resource()
113 __dlm_print_lock(lock); in __dlm_print_one_lock_resource()
119 dlm_print_one_lock_resource(lockid->lockres); in dlm_print_one_lock()
193 out += scnprintf(buf + out, len - out, "%.*s%08x", in stringify_lockname()
194 OCFS2_DENTRY_LOCK_INO_START - 1, lockname, in stringify_lockname()
197 out += scnprintf(buf + out, len - out, "%.*s", in stringify_lockname()
206 int i = -1; in stringify_nodemap()
209 out += scnprintf(buf + out, len - out, "%d ", i); in stringify_nodemap()
219 if (mle->type == DLM_MLE_BLOCK) in dump_mle()
221 else if (mle->type == DLM_MLE_MASTER) in dump_mle()
226 out += stringify_lockname(mle->mname, mle->mnamelen, buf + out, len - out); in dump_mle()
227 out += scnprintf(buf + out, len - out, in dump_mle()
229 mle_type, mle->master, mle->new_master, in dump_mle()
230 !list_empty(&mle->hb_events), in dump_mle()
231 !!mle->inuse, in dump_mle()
232 kref_read(&mle->mle_refs)); in dump_mle()
234 out += scnprintf(buf + out, len - out, "Maybe="); in dump_mle()
235 out += stringify_nodemap(mle->maybe_map, O2NM_MAX_NODES, in dump_mle()
236 buf + out, len - out); in dump_mle()
237 out += scnprintf(buf + out, len - out, "\n"); in dump_mle()
239 out += scnprintf(buf + out, len - out, "Vote="); in dump_mle()
240 out += stringify_nodemap(mle->vote_map, O2NM_MAX_NODES, in dump_mle()
241 buf + out, len - out); in dump_mle()
242 out += scnprintf(buf + out, len - out, "\n"); in dump_mle()
244 out += scnprintf(buf + out, len - out, "Response="); in dump_mle()
245 out += stringify_nodemap(mle->response_map, O2NM_MAX_NODES, in dump_mle()
246 buf + out, len - out); in dump_mle()
247 out += scnprintf(buf + out, len - out, "\n"); in dump_mle()
249 out += scnprintf(buf + out, len - out, "Node="); in dump_mle()
250 out += stringify_nodemap(mle->node_map, O2NM_MAX_NODES, in dump_mle()
251 buf + out, len - out); in dump_mle()
252 out += scnprintf(buf + out, len - out, "\n"); in dump_mle()
254 out += scnprintf(buf + out, len - out, "\n"); in dump_mle()
265 dump_mle(mle, buf, PAGE_SIZE - 1); in dlm_print_one_mle()
280 /* begin - utils funcs */
283 free_page((unsigned long)file->private_data); in debug_release()
290 return simple_read_from_buffer(buf, nbytes, ppos, file->private_data, in debug_read()
291 i_size_read(file->f_mapping->host)); in debug_read()
293 /* end - util funcs */
295 /* begin - purge list funcs */
302 out += scnprintf(buf + out, len - out, in debug_purgelist_print()
303 "Dumping Purgelist for Domain: %s\n", dlm->name); in debug_purgelist_print()
305 spin_lock(&dlm->spinlock); in debug_purgelist_print()
306 list_for_each_entry(res, &dlm->purge_list, purge) { in debug_purgelist_print()
308 if (len - out < 100) in debug_purgelist_print()
310 spin_lock(&res->spinlock); in debug_purgelist_print()
311 out += stringify_lockname(res->lockname.name, in debug_purgelist_print()
312 res->lockname.len, in debug_purgelist_print()
313 buf + out, len - out); in debug_purgelist_print()
314 out += scnprintf(buf + out, len - out, "\t%ld\n", in debug_purgelist_print()
315 (jiffies - res->last_used)/HZ); in debug_purgelist_print()
316 spin_unlock(&res->spinlock); in debug_purgelist_print()
318 spin_unlock(&dlm->spinlock); in debug_purgelist_print()
320 out += scnprintf(buf + out, len - out, "Total on list: %lu\n", total); in debug_purgelist_print()
327 struct dlm_ctxt *dlm = inode->i_private; in debug_purgelist_open()
334 i_size_write(inode, debug_purgelist_print(dlm, buf, PAGE_SIZE - 1)); in debug_purgelist_open()
336 file->private_data = buf; in debug_purgelist_open()
340 return -ENOMEM; in debug_purgelist_open()
349 /* end - purge list funcs */
351 /* begin - debug mle funcs */
359 out += scnprintf(buf + out, len - out, in debug_mle_print()
360 "Dumping MLEs for Domain: %s\n", dlm->name); in debug_mle_print()
362 spin_lock(&dlm->master_lock); in debug_mle_print()
368 if (len - out < 200) in debug_mle_print()
370 out += dump_mle(mle, buf + out, len - out); in debug_mle_print()
375 spin_unlock(&dlm->master_lock); in debug_mle_print()
377 out += scnprintf(buf + out, len - out, in debug_mle_print()
384 struct dlm_ctxt *dlm = inode->i_private; in debug_mle_open()
391 i_size_write(inode, debug_mle_print(dlm, buf, PAGE_SIZE - 1)); in debug_mle_open()
393 file->private_data = buf; in debug_mle_open()
397 return -ENOMEM; in debug_mle_open()
407 /* end - debug mle funcs */
409 /* begin - debug lockres funcs */
410 static int dump_lock(struct dlm_lock *lock, int list_type, char *buf, int len) in dump_lock() argument
415 spin_lock(&lock->spinlock); in dump_lock()
416 out = scnprintf(buf, len, "LOCK:%d,%d,%d,%d,%d,%d:%lld,%d,%d,%d,%d,%d," in dump_lock()
419 list_type, lock->ml.type, lock->ml.convert_type, in dump_lock()
420 lock->ml.node, in dump_lock()
421 dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), in dump_lock()
422 dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), in dump_lock()
423 !list_empty(&lock->ast_list), in dump_lock()
424 !list_empty(&lock->bast_list), in dump_lock()
425 lock->ast_pending, lock->bast_pending, in dump_lock()
426 lock->convert_pending, lock->lock_pending, in dump_lock()
427 lock->cancel_pending, lock->unlock_pending, in dump_lock()
428 kref_read(&lock->lock_refs)); in dump_lock()
429 spin_unlock(&lock->spinlock); in dump_lock()
436 struct dlm_lock *lock; in dump_lockres() local
440 out += scnprintf(buf + out, len - out, "NAME:"); in dump_lockres()
441 out += stringify_lockname(res->lockname.name, res->lockname.len, in dump_lockres()
442 buf + out, len - out); in dump_lockres()
443 out += scnprintf(buf + out, len - out, "\n"); in dump_lockres()
446 out += scnprintf(buf + out, len - out, in dump_lockres()
449 res->owner, res->state, res->last_used, in dump_lockres()
450 !list_empty(&res->purge), in dump_lockres()
451 !list_empty(&res->dirty), in dump_lockres()
452 !list_empty(&res->recovering), in dump_lockres()
453 res->inflight_locks, res->migration_pending, in dump_lockres()
454 atomic_read(&res->asts_reserved), in dump_lockres()
455 kref_read(&res->refs)); in dump_lockres()
458 out += scnprintf(buf + out, len - out, "RMAP:"); in dump_lockres()
459 out += stringify_nodemap(res->refmap, O2NM_MAX_NODES, in dump_lockres()
460 buf + out, len - out); in dump_lockres()
461 out += scnprintf(buf + out, len - out, "\n"); in dump_lockres()
464 out += scnprintf(buf + out, len - out, "LVBX:"); in dump_lockres()
466 out += scnprintf(buf + out, len - out, in dump_lockres()
467 "%02x", (unsigned char)res->lvb[i]); in dump_lockres()
468 out += scnprintf(buf + out, len - out, "\n"); in dump_lockres()
471 list_for_each_entry(lock, &res->granted, list) in dump_lockres()
472 out += dump_lock(lock, 0, buf + out, len - out); in dump_lockres()
475 list_for_each_entry(lock, &res->converting, list) in dump_lockres()
476 out += dump_lock(lock, 1, buf + out, len - out); in dump_lockres()
479 list_for_each_entry(lock, &res->blocked, list) in dump_lockres()
480 out += dump_lock(lock, 2, buf + out, len - out); in dump_lockres()
482 out += scnprintf(buf + out, len - out, "\n"); in dump_lockres()
489 struct debug_lockres *dl = m->private; in lockres_seq_start()
490 struct dlm_ctxt *dlm = dl->dl_ctxt; in lockres_seq_start()
491 struct dlm_lock_resource *oldres = dl->dl_res; in lockres_seq_start()
495 spin_lock(&dlm->track_lock); in lockres_seq_start()
497 track_list = &oldres->tracking; in lockres_seq_start()
499 track_list = &dlm->tracking_list; in lockres_seq_start()
502 spin_unlock(&dlm->track_lock); in lockres_seq_start()
508 if (&iter->tracking != &dlm->tracking_list) { in lockres_seq_start()
514 spin_unlock(&dlm->track_lock); in lockres_seq_start()
519 dl->dl_res = res; in lockres_seq_start()
522 spin_lock(&res->spinlock); in lockres_seq_start()
523 dump_lockres(res, dl->dl_buf, dl->dl_len - 1); in lockres_seq_start()
524 spin_unlock(&res->spinlock); in lockres_seq_start()
546 seq_printf(s, "%s", dl->dl_buf); in lockres_seq_show()
560 struct dlm_ctxt *dlm = inode->i_private; in debug_lockres_open()
572 dl->dl_len = PAGE_SIZE; in debug_lockres_open()
573 dl->dl_buf = buf; in debug_lockres_open()
576 dl->dl_ctxt = dlm; in debug_lockres_open()
583 mlog_errno(-ENOMEM); in debug_lockres_open()
584 return -ENOMEM; in debug_lockres_open()
589 struct seq_file *seq = file->private_data; in debug_lockres_release()
590 struct debug_lockres *dl = (struct debug_lockres *)seq->private; in debug_lockres_release()
592 if (dl->dl_res) in debug_lockres_release()
593 dlm_lockres_put(dl->dl_res); in debug_lockres_release()
594 dlm_put(dl->dl_ctxt); in debug_lockres_release()
595 kfree(dl->dl_buf); in debug_lockres_release()
605 /* end - debug lockres funcs */
607 /* begin - debug state funcs */
612 char *state; in debug_state_print() local
616 spin_lock(&dlm->spinlock); in debug_state_print()
618 switch (dlm->dlm_state) { in debug_state_print()
620 state = "NEW"; break; in debug_state_print()
622 state = "JOINED"; break; in debug_state_print()
624 state = "SHUTDOWN"; break; in debug_state_print()
626 state = "LEAVING"; break; in debug_state_print()
628 state = "UNKNOWN"; break; in debug_state_print()
632 out += scnprintf(buf + out, len - out, in debug_state_print()
634 dlm->name, dlm->key, dlm->dlm_locking_proto.pv_major, in debug_state_print()
635 dlm->dlm_locking_proto.pv_minor); in debug_state_print()
637 /* Thread Pid: xxx Node: xxx State: xxxxx */ in debug_state_print()
638 out += scnprintf(buf + out, len - out, in debug_state_print()
639 "Thread Pid: %d Node: %d State: %s\n", in debug_state_print()
640 task_pid_nr(dlm->dlm_thread_task), dlm->node_num, state); in debug_state_print()
643 out += scnprintf(buf + out, len - out, in debug_state_print()
645 dlm->num_joins, dlm->joining_node); in debug_state_print()
648 out += scnprintf(buf + out, len - out, "Domain Map: "); in debug_state_print()
649 out += stringify_nodemap(dlm->domain_map, O2NM_MAX_NODES, in debug_state_print()
650 buf + out, len - out); in debug_state_print()
651 out += scnprintf(buf + out, len - out, "\n"); in debug_state_print()
654 out += scnprintf(buf + out, len - out, "Exit Domain Map: "); in debug_state_print()
655 out += stringify_nodemap(dlm->exit_domain_map, O2NM_MAX_NODES, in debug_state_print()
656 buf + out, len - out); in debug_state_print()
657 out += scnprintf(buf + out, len - out, "\n"); in debug_state_print()
660 out += scnprintf(buf + out, len - out, "Live Map: "); in debug_state_print()
661 out += stringify_nodemap(dlm->live_nodes_map, O2NM_MAX_NODES, in debug_state_print()
662 buf + out, len - out); in debug_state_print()
663 out += scnprintf(buf + out, len - out, "\n"); in debug_state_print()
665 /* Lock Resources: xxx (xxx) */ in debug_state_print()
666 out += scnprintf(buf + out, len - out, in debug_state_print()
667 "Lock Resources: %d (%d)\n", in debug_state_print()
668 atomic_read(&dlm->res_cur_count), in debug_state_print()
669 atomic_read(&dlm->res_tot_count)); in debug_state_print()
672 tot_mles += atomic_read(&dlm->mle_tot_count[i]); in debug_state_print()
675 cur_mles += atomic_read(&dlm->mle_cur_count[i]); in debug_state_print()
678 out += scnprintf(buf + out, len - out, in debug_state_print()
682 out += scnprintf(buf + out, len - out, in debug_state_print()
684 atomic_read(&dlm->mle_cur_count[DLM_MLE_BLOCK]), in debug_state_print()
685 atomic_read(&dlm->mle_tot_count[DLM_MLE_BLOCK])); in debug_state_print()
688 out += scnprintf(buf + out, len - out, in debug_state_print()
690 atomic_read(&dlm->mle_cur_count[DLM_MLE_MASTER]), in debug_state_print()
691 atomic_read(&dlm->mle_tot_count[DLM_MLE_MASTER])); in debug_state_print()
694 out += scnprintf(buf + out, len - out, in debug_state_print()
696 atomic_read(&dlm->mle_cur_count[DLM_MLE_MIGRATION]), in debug_state_print()
697 atomic_read(&dlm->mle_tot_count[DLM_MLE_MIGRATION])); in debug_state_print()
700 out += scnprintf(buf + out, len - out, in debug_state_print()
703 (list_empty(&dlm->dirty_list) ? "Empty" : "InUse"), in debug_state_print()
704 (list_empty(&dlm->purge_list) ? "Empty" : "InUse"), in debug_state_print()
705 (list_empty(&dlm->pending_asts) ? "Empty" : "InUse"), in debug_state_print()
706 (list_empty(&dlm->pending_basts) ? "Empty" : "InUse")); in debug_state_print()
709 out += scnprintf(buf + out, len - out, in debug_state_print()
710 "Purge Count: %d Refs: %d\n", dlm->purge_count, in debug_state_print()
711 kref_read(&dlm->dlm_refs)); in debug_state_print()
714 out += scnprintf(buf + out, len - out, in debug_state_print()
715 "Dead Node: %d\n", dlm->reco.dead_node); in debug_state_print()
718 if (dlm->reco.state == DLM_RECO_STATE_ACTIVE) in debug_state_print()
719 state = "ACTIVE"; in debug_state_print()
721 state = "INACTIVE"; in debug_state_print()
723 /* Recovery Pid: xxxx Master: xxx State: xxxx */ in debug_state_print()
724 out += scnprintf(buf + out, len - out, in debug_state_print()
725 "Recovery Pid: %d Master: %d State: %s\n", in debug_state_print()
726 task_pid_nr(dlm->dlm_reco_thread_task), in debug_state_print()
727 dlm->reco.new_master, state); in debug_state_print()
730 out += scnprintf(buf + out, len - out, "Recovery Map: "); in debug_state_print()
731 out += stringify_nodemap(dlm->recovery_map, O2NM_MAX_NODES, in debug_state_print()
732 buf + out, len - out); in debug_state_print()
733 out += scnprintf(buf + out, len - out, "\n"); in debug_state_print()
735 /* Recovery Node State: */ in debug_state_print()
736 out += scnprintf(buf + out, len - out, "Recovery Node State:\n"); in debug_state_print()
737 list_for_each_entry(node, &dlm->reco.node_data, list) { in debug_state_print()
738 switch (node->state) { in debug_state_print()
740 state = "INIT"; in debug_state_print()
743 state = "REQUESTING"; in debug_state_print()
746 state = "DEAD"; in debug_state_print()
749 state = "RECEIVING"; in debug_state_print()
752 state = "REQUESTED"; in debug_state_print()
755 state = "DONE"; in debug_state_print()
758 state = "FINALIZE-SENT"; in debug_state_print()
761 state = "BAD"; in debug_state_print()
764 out += scnprintf(buf + out, len - out, "\t%u - %s\n", in debug_state_print()
765 node->node_num, state); in debug_state_print()
768 spin_unlock(&dlm->spinlock); in debug_state_print()
775 struct dlm_ctxt *dlm = inode->i_private; in debug_state_open()
782 i_size_write(inode, debug_state_print(dlm, buf, PAGE_SIZE - 1)); in debug_state_open()
784 file->private_data = buf; in debug_state_open()
788 return -ENOMEM; in debug_state_open()
797 /* end - debug state funcs */
804 dlm->dlm_debugfs_subroot, dlm, &debug_state_fops); in dlm_debug_init()
808 dlm->dlm_debugfs_subroot, dlm, &debug_lockres_fops); in dlm_debug_init()
812 dlm->dlm_debugfs_subroot, dlm, &debug_mle_fops); in dlm_debug_init()
816 dlm->dlm_debugfs_subroot, dlm, in dlm_debug_init()
820 /* subroot - domain dir */
823 dlm->dlm_debugfs_subroot = debugfs_create_dir(dlm->name, in dlm_create_debugfs_subroot()
829 debugfs_remove_recursive(dlm->dlm_debugfs_subroot); in dlm_destroy_debugfs_subroot()