Lines Matching full:ls

27 void dlm_slot_save(struct dlm_ls *ls, struct dlm_rcom *rc,  in dlm_slot_save()  argument
39 void dlm_slots_copy_out(struct dlm_ls *ls, struct dlm_rcom *rc) in dlm_slots_copy_out() argument
49 for (i = 0; i < ls->ls_slots_size; i++) { in dlm_slots_copy_out()
50 slot = &ls->ls_slots[i]; in dlm_slots_copy_out()
61 static void log_slots(struct dlm_ls *ls, uint32_t gen, int num_slots, in log_slots() argument
93 log_rinfo(ls, "generation %u slots %d%s", gen, num_slots, line); in log_slots()
96 int dlm_slots_copy_in(struct dlm_ls *ls) in dlm_slots_copy_in() argument
99 struct dlm_rcom *rc = ls->ls_recover_buf; in dlm_slots_copy_in()
110 if (gen <= ls->ls_generation) { in dlm_slots_copy_in()
111 log_error(ls, "dlm_slots_copy_in gen %u old %u", in dlm_slots_copy_in()
112 gen, ls->ls_generation); in dlm_slots_copy_in()
114 ls->ls_generation = gen; in dlm_slots_copy_in()
127 log_slots(ls, gen, num_slots, ro0, NULL, 0); in dlm_slots_copy_in()
129 list_for_each_entry(memb, &ls->ls_nodes, list) { in dlm_slots_copy_in()
139 if (ls->ls_slot && ls->ls_slot != memb->slot) { in dlm_slots_copy_in()
140 log_error(ls, "dlm_slots_copy_in our slot " in dlm_slots_copy_in()
141 "changed %d %d", ls->ls_slot, in dlm_slots_copy_in()
146 if (!ls->ls_slot) in dlm_slots_copy_in()
147 ls->ls_slot = memb->slot; in dlm_slots_copy_in()
151 log_error(ls, "dlm_slots_copy_in nodeid %d no slot", in dlm_slots_copy_in()
164 int dlm_slots_assign(struct dlm_ls *ls, int *num_slots, int *slots_size, in dlm_slots_assign() argument
178 list_for_each_entry(memb, &ls->ls_nodes, list) { in dlm_slots_assign()
180 memb->slot = ls->ls_slot; in dlm_slots_assign()
181 memb->generation = ls->ls_generation; in dlm_slots_assign()
186 list_for_each_entry(memb, &ls->ls_nodes, list) { in dlm_slots_assign()
210 log_error(ls, "nodeid %d slot changed %d %d", in dlm_slots_assign()
226 list_for_each_entry(memb, &ls->ls_nodes, list) { in dlm_slots_assign()
231 log_error(ls, "invalid slot number %d", memb->slot); in dlm_slots_assign()
243 list_for_each_entry(memb, &ls->ls_nodes, list) { in dlm_slots_assign()
257 if (!ls->ls_slot && memb->nodeid == our_nodeid) in dlm_slots_assign()
258 ls->ls_slot = memb->slot; in dlm_slots_assign()
263 log_error(ls, "no free slot found"); in dlm_slots_assign()
271 log_slots(ls, gen, num, NULL, array, array_size); in dlm_slots_assign()
277 log_error(ls, "num_slots %d exceeds max_slots %d", in dlm_slots_assign()
290 static void add_ordered_member(struct dlm_ls *ls, struct dlm_member *new) in add_ordered_member() argument
295 struct list_head *head = &ls->ls_nodes; in add_ordered_member()
314 static int dlm_add_member(struct dlm_ls *ls, struct dlm_config_node *node) in dlm_add_member() argument
332 add_ordered_member(ls, memb); in dlm_add_member()
333 ls->ls_num_nodes++; in dlm_add_member()
348 int dlm_is_member(struct dlm_ls *ls, int nodeid) in dlm_is_member() argument
350 if (find_memb(&ls->ls_nodes, nodeid)) in dlm_is_member()
355 int dlm_is_removed(struct dlm_ls *ls, int nodeid) in dlm_is_removed() argument
357 if (find_memb(&ls->ls_nodes_gone, nodeid)) in dlm_is_removed()
373 void dlm_clear_members(struct dlm_ls *ls) in dlm_clear_members() argument
375 clear_memb_list(&ls->ls_nodes); in dlm_clear_members()
376 ls->ls_num_nodes = 0; in dlm_clear_members()
379 void dlm_clear_members_gone(struct dlm_ls *ls) in dlm_clear_members_gone() argument
381 clear_memb_list(&ls->ls_nodes_gone); in dlm_clear_members_gone()
384 static void make_member_array(struct dlm_ls *ls) in make_member_array() argument
389 kfree(ls->ls_node_array); in make_member_array()
390 ls->ls_node_array = NULL; in make_member_array()
392 list_for_each_entry(memb, &ls->ls_nodes, list) { in make_member_array()
400 total = ls->ls_num_nodes; in make_member_array()
404 ls->ls_total_weight = total; in make_member_array()
409 list_for_each_entry(memb, &ls->ls_nodes, list) { in make_member_array()
424 ls->ls_node_array = array; in make_member_array()
429 static int ping_members(struct dlm_ls *ls) in ping_members() argument
434 list_for_each_entry(memb, &ls->ls_nodes, list) { in ping_members()
435 error = dlm_recovery_stopped(ls); in ping_members()
438 error = dlm_rcom_status(ls, memb->nodeid, 0); in ping_members()
443 log_rinfo(ls, "ping_members aborted %d last nodeid %d", in ping_members()
444 error, ls->ls_recover_nodeid); in ping_members()
448 static void dlm_lsop_recover_prep(struct dlm_ls *ls) in dlm_lsop_recover_prep() argument
450 if (!ls->ls_ops || !ls->ls_ops->recover_prep) in dlm_lsop_recover_prep()
452 ls->ls_ops->recover_prep(ls->ls_ops_arg); in dlm_lsop_recover_prep()
455 static void dlm_lsop_recover_slot(struct dlm_ls *ls, struct dlm_member *memb) in dlm_lsop_recover_slot() argument
461 if (!ls->ls_ops || !ls->ls_ops->recover_slot) in dlm_lsop_recover_slot()
478 ls->ls_ops->recover_slot(ls->ls_ops_arg, &slot); in dlm_lsop_recover_slot()
481 void dlm_lsop_recover_done(struct dlm_ls *ls) in dlm_lsop_recover_done() argument
487 if (!ls->ls_ops || !ls->ls_ops->recover_done) in dlm_lsop_recover_done()
490 num = ls->ls_num_nodes; in dlm_lsop_recover_done()
496 list_for_each_entry(memb, &ls->ls_nodes, list) { in dlm_lsop_recover_done()
498 log_error(ls, "dlm_lsop_recover_done bad num %d", num); in dlm_lsop_recover_done()
506 ls->ls_ops->recover_done(ls->ls_ops_arg, slots, num, in dlm_lsop_recover_done()
507 ls->ls_slot, ls->ls_generation); in dlm_lsop_recover_done()
524 int dlm_recover_members(struct dlm_ls *ls, struct dlm_recover *rv, int *neg_out) in dlm_recover_members() argument
533 list_for_each_entry(memb, &ls->ls_nodes_gone, list) { in dlm_recover_members()
534 log_rinfo(ls, "prev removed member %d", memb->nodeid); in dlm_recover_members()
540 list_for_each_entry_safe(memb, safe, &ls->ls_nodes, list) { in dlm_recover_members()
546 log_rinfo(ls, "remove member %d", memb->nodeid); in dlm_recover_members()
549 log_rinfo(ls, "remove member %d comm_seq %u %u", in dlm_recover_members()
554 list_move(&memb->list, &ls->ls_nodes_gone); in dlm_recover_members()
555 ls->ls_num_nodes--; in dlm_recover_members()
556 dlm_lsop_recover_slot(ls, memb); in dlm_recover_members()
563 if (dlm_is_member(ls, node->nodeid)) in dlm_recover_members()
565 dlm_add_member(ls, node); in dlm_recover_members()
566 log_rinfo(ls, "add member %d", node->nodeid); in dlm_recover_members()
569 list_for_each_entry(memb, &ls->ls_nodes, list) { in dlm_recover_members()
573 ls->ls_low_nodeid = low; in dlm_recover_members()
575 make_member_array(ls); in dlm_recover_members()
578 error = ping_members(ls); in dlm_recover_members()
582 ls->ls_members_result = error; in dlm_recover_members()
583 complete(&ls->ls_members_done); in dlm_recover_members()
586 log_rinfo(ls, "dlm_recover_members %d nodes", ls->ls_num_nodes); in dlm_recover_members()
593 int dlm_ls_stop(struct dlm_ls *ls) in dlm_ls_stop() argument
608 down_write(&ls->ls_recv_active); in dlm_ls_stop()
616 spin_lock(&ls->ls_recover_lock); in dlm_ls_stop()
617 set_bit(LSFL_RECOVER_STOP, &ls->ls_flags); in dlm_ls_stop()
618 new = test_and_clear_bit(LSFL_RUNNING, &ls->ls_flags); in dlm_ls_stop()
619 ls->ls_recover_seq++; in dlm_ls_stop()
620 spin_unlock(&ls->ls_recover_lock); in dlm_ls_stop()
627 up_write(&ls->ls_recv_active); in dlm_ls_stop()
638 set_bit(LSFL_RECOVER_DOWN, &ls->ls_flags); in dlm_ls_stop()
639 wake_up_process(ls->ls_recoverd_task); in dlm_ls_stop()
640 wait_event(ls->ls_recover_lock_wait, in dlm_ls_stop()
641 test_bit(LSFL_RECOVER_LOCK, &ls->ls_flags)); in dlm_ls_stop()
650 dlm_recoverd_suspend(ls); in dlm_ls_stop()
652 spin_lock(&ls->ls_recover_lock); in dlm_ls_stop()
653 kfree(ls->ls_slots); in dlm_ls_stop()
654 ls->ls_slots = NULL; in dlm_ls_stop()
655 ls->ls_num_slots = 0; in dlm_ls_stop()
656 ls->ls_slots_size = 0; in dlm_ls_stop()
657 ls->ls_recover_status = 0; in dlm_ls_stop()
658 spin_unlock(&ls->ls_recover_lock); in dlm_ls_stop()
660 dlm_recoverd_resume(ls); in dlm_ls_stop()
662 if (!ls->ls_recover_begin) in dlm_ls_stop()
663 ls->ls_recover_begin = jiffies; in dlm_ls_stop()
665 dlm_lsop_recover_prep(ls); in dlm_ls_stop()
669 int dlm_ls_start(struct dlm_ls *ls) in dlm_ls_start() argument
679 error = dlm_config_nodes(ls->ls_name, &nodes, &count); in dlm_ls_start()
683 spin_lock(&ls->ls_recover_lock); in dlm_ls_start()
687 if (!dlm_locking_stopped(ls)) { in dlm_ls_start()
688 spin_unlock(&ls->ls_recover_lock); in dlm_ls_start()
689 log_error(ls, "start ignored: lockspace running"); in dlm_ls_start()
696 rv->seq = ++ls->ls_recover_seq; in dlm_ls_start()
697 rv_old = ls->ls_recover_args; in dlm_ls_start()
698 ls->ls_recover_args = rv; in dlm_ls_start()
699 spin_unlock(&ls->ls_recover_lock); in dlm_ls_start()
702 log_error(ls, "unused recovery %llx %d", in dlm_ls_start()
708 set_bit(LSFL_RECOVER_WORK, &ls->ls_flags); in dlm_ls_start()
709 wake_up_process(ls->ls_recoverd_task); in dlm_ls_start()