Lines Matching full:ls

16    request_lock(ls, lkb)
17 convert_lock(ls, lkb)
18 unlock_lock(ls, lkb)
19 cancel_lock(ls, lkb)
89 static void do_purge(struct dlm_ls *ls, int nodeid, int pid);
203 static inline void dlm_lock_recovery(struct dlm_ls *ls) in dlm_lock_recovery() argument
205 down_read(&ls->ls_in_recovery); in dlm_lock_recovery()
208 void dlm_unlock_recovery(struct dlm_ls *ls) in dlm_unlock_recovery() argument
210 up_read(&ls->ls_in_recovery); in dlm_unlock_recovery()
213 int dlm_lock_recovery_try(struct dlm_ls *ls) in dlm_lock_recovery_try() argument
215 return down_read_trylock(&ls->ls_in_recovery); in dlm_lock_recovery_try()
349 struct dlm_ls *ls = r->res_ls; in put_rsb() local
352 spin_lock(&ls->ls_rsbtbl[bucket].lock); in put_rsb()
354 spin_unlock(&ls->ls_rsbtbl[bucket].lock); in put_rsb()
362 static int pre_rsb_struct(struct dlm_ls *ls) in pre_rsb_struct() argument
367 spin_lock(&ls->ls_new_rsb_spin); in pre_rsb_struct()
368 if (ls->ls_new_rsb_count > dlm_config.ci_new_rsb_count / 2) { in pre_rsb_struct()
369 spin_unlock(&ls->ls_new_rsb_spin); in pre_rsb_struct()
372 spin_unlock(&ls->ls_new_rsb_spin); in pre_rsb_struct()
374 r1 = dlm_allocate_rsb(ls); in pre_rsb_struct()
375 r2 = dlm_allocate_rsb(ls); in pre_rsb_struct()
377 spin_lock(&ls->ls_new_rsb_spin); in pre_rsb_struct()
379 list_add(&r1->res_hashchain, &ls->ls_new_rsb); in pre_rsb_struct()
380 ls->ls_new_rsb_count++; in pre_rsb_struct()
383 list_add(&r2->res_hashchain, &ls->ls_new_rsb); in pre_rsb_struct()
384 ls->ls_new_rsb_count++; in pre_rsb_struct()
386 count = ls->ls_new_rsb_count; in pre_rsb_struct()
387 spin_unlock(&ls->ls_new_rsb_spin); in pre_rsb_struct()
394 /* If ls->ls_new_rsb is empty, return -EAGAIN, so the caller can
398 static int get_rsb_struct(struct dlm_ls *ls, char *name, int len, in get_rsb_struct() argument
404 spin_lock(&ls->ls_new_rsb_spin); in get_rsb_struct()
405 if (list_empty(&ls->ls_new_rsb)) { in get_rsb_struct()
406 count = ls->ls_new_rsb_count; in get_rsb_struct()
407 spin_unlock(&ls->ls_new_rsb_spin); in get_rsb_struct()
408 log_debug(ls, "find_rsb retry %d %d %s", in get_rsb_struct()
413 r = list_first_entry(&ls->ls_new_rsb, struct dlm_rsb, res_hashchain); in get_rsb_struct()
417 ls->ls_new_rsb_count--; in get_rsb_struct()
418 spin_unlock(&ls->ls_new_rsb_spin); in get_rsb_struct()
420 r->res_ls = ls; in get_rsb_struct()
543 static int find_rsb_dir(struct dlm_ls *ls, char *name, int len, in find_rsb_dir() argument
587 error = pre_rsb_struct(ls); in find_rsb_dir()
592 spin_lock(&ls->ls_rsbtbl[b].lock); in find_rsb_dir()
594 error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].keep, name, len, &r); in find_rsb_dir()
608 error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, &r); in find_rsb_dir()
622 log_debug(ls, "find_rsb toss from_other %d master %d dir %d %s", in find_rsb_dir()
631 log_error(ls, "find_rsb toss from_dir %d master %d", in find_rsb_dir()
648 rb_erase(&r->res_hashnode, &ls->ls_rsbtbl[b].toss); in find_rsb_dir()
649 error = rsb_insert(r, &ls->ls_rsbtbl[b].keep); in find_rsb_dir()
661 error = get_rsb_struct(ls, name, len, &r); in find_rsb_dir()
663 spin_unlock(&ls->ls_rsbtbl[b].lock); in find_rsb_dir()
676 log_debug(ls, "find_rsb new from_dir %d recreate %s", in find_rsb_dir()
685 log_error(ls, "find_rsb new from_other %d dir %d our %d %s", in find_rsb_dir()
694 log_debug(ls, "find_rsb new from_other %d dir %d %s", in find_rsb_dir()
710 error = rsb_insert(r, &ls->ls_rsbtbl[b].keep); in find_rsb_dir()
712 spin_unlock(&ls->ls_rsbtbl[b].lock); in find_rsb_dir()
722 static int find_rsb_nodir(struct dlm_ls *ls, char *name, int len, in find_rsb_nodir() argument
733 error = pre_rsb_struct(ls); in find_rsb_nodir()
737 spin_lock(&ls->ls_rsbtbl[b].lock); in find_rsb_nodir()
739 error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].keep, name, len, &r); in find_rsb_nodir()
752 error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, &r); in find_rsb_nodir()
765 log_error(ls, "find_rsb toss from_nodeid %d master %d dir %d", in find_rsb_nodir()
776 log_error(ls, "find_rsb toss our %d master %d dir %d", in find_rsb_nodir()
783 rb_erase(&r->res_hashnode, &ls->ls_rsbtbl[b].toss); in find_rsb_nodir()
784 error = rsb_insert(r, &ls->ls_rsbtbl[b].keep); in find_rsb_nodir()
793 error = get_rsb_struct(ls, name, len, &r); in find_rsb_nodir()
795 spin_unlock(&ls->ls_rsbtbl[b].lock); in find_rsb_nodir()
808 error = rsb_insert(r, &ls->ls_rsbtbl[b].keep); in find_rsb_nodir()
810 spin_unlock(&ls->ls_rsbtbl[b].lock); in find_rsb_nodir()
816 static int find_rsb(struct dlm_ls *ls, char *name, int len, int from_nodeid, in find_rsb() argument
826 b = hash & (ls->ls_rsbtbl_size - 1); in find_rsb()
828 dir_nodeid = dlm_hash2nodeid(ls, hash); in find_rsb()
830 if (dlm_no_directory(ls)) in find_rsb()
831 return find_rsb_nodir(ls, name, len, hash, b, dir_nodeid, in find_rsb()
834 return find_rsb_dir(ls, name, len, hash, b, dir_nodeid, in find_rsb()
841 static int validate_master_nodeid(struct dlm_ls *ls, struct dlm_rsb *r, in validate_master_nodeid() argument
844 if (dlm_no_directory(ls)) { in validate_master_nodeid()
845 log_error(ls, "find_rsb keep from_nodeid %d master %d dir %d", in validate_master_nodeid()
858 log_debug(ls, "validate master from_other %d master %d " in validate_master_nodeid()
869 log_error(ls, "validate master from_dir %d master %d " in validate_master_nodeid()
910 int dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, char *name, int len, in dlm_master_lookup() argument
924 log_error(ls, "dlm_master_lookup from our_nodeid %d flags %x", in dlm_master_lookup()
930 b = hash & (ls->ls_rsbtbl_size - 1); in dlm_master_lookup()
932 dir_nodeid = dlm_hash2nodeid(ls, hash); in dlm_master_lookup()
934 log_error(ls, "dlm_master_lookup from %d dir %d our %d h %x %d", in dlm_master_lookup()
936 ls->ls_num_nodes); in dlm_master_lookup()
942 error = pre_rsb_struct(ls); in dlm_master_lookup()
946 spin_lock(&ls->ls_rsbtbl[b].lock); in dlm_master_lookup()
947 error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].keep, name, len, &r); in dlm_master_lookup()
953 spin_unlock(&ls->ls_rsbtbl[b].lock); in dlm_master_lookup()
958 error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, &r); in dlm_master_lookup()
969 log_error(ls, "dlm_master_lookup res_dir %d our %d %s", in dlm_master_lookup()
974 if (fix_master && dlm_is_removed(ls, r->res_master_nodeid)) { in dlm_master_lookup()
986 log_error(ls, "dlm_master_lookup fix_master on toss"); in dlm_master_lookup()
996 log_limit(ls, "dlm_master_lookup from_master %d " in dlm_master_lookup()
1002 log_error(ls, "from_master %d our_master", from_nodeid); in dlm_master_lookup()
1016 log_debug(ls, "dlm_master_lookup master 0 to %d first %x %s", in dlm_master_lookup()
1028 log_limit(ls, "dlm_master_lookup from master %d flags %x " in dlm_master_lookup()
1041 spin_unlock(&ls->ls_rsbtbl[b].lock); in dlm_master_lookup()
1050 error = get_rsb_struct(ls, name, len, &r); in dlm_master_lookup()
1052 spin_unlock(&ls->ls_rsbtbl[b].lock); in dlm_master_lookup()
1066 error = rsb_insert(r, &ls->ls_rsbtbl[b].toss); in dlm_master_lookup()
1070 spin_unlock(&ls->ls_rsbtbl[b].lock); in dlm_master_lookup()
1079 spin_unlock(&ls->ls_rsbtbl[b].lock); in dlm_master_lookup()
1083 static void dlm_dump_rsb_hash(struct dlm_ls *ls, uint32_t hash) in dlm_dump_rsb_hash() argument
1089 for (i = 0; i < ls->ls_rsbtbl_size; i++) { in dlm_dump_rsb_hash()
1090 spin_lock(&ls->ls_rsbtbl[i].lock); in dlm_dump_rsb_hash()
1091 for (n = rb_first(&ls->ls_rsbtbl[i].keep); n; n = rb_next(n)) { in dlm_dump_rsb_hash()
1096 spin_unlock(&ls->ls_rsbtbl[i].lock); in dlm_dump_rsb_hash()
1100 void dlm_dump_rsb_name(struct dlm_ls *ls, char *name, int len) in dlm_dump_rsb_name() argument
1107 b = hash & (ls->ls_rsbtbl_size - 1); in dlm_dump_rsb_name()
1109 spin_lock(&ls->ls_rsbtbl[b].lock); in dlm_dump_rsb_name()
1110 error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].keep, name, len, &r); in dlm_dump_rsb_name()
1114 error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, &r); in dlm_dump_rsb_name()
1120 spin_unlock(&ls->ls_rsbtbl[b].lock); in dlm_dump_rsb_name()
1126 struct dlm_ls *ls = r->res_ls; in toss_rsb() local
1130 rb_erase(&r->res_hashnode, &ls->ls_rsbtbl[r->res_bucket].keep); in toss_rsb()
1131 rsb_insert(r, &ls->ls_rsbtbl[r->res_bucket].toss); in toss_rsb()
1133 ls->ls_rsbtbl[r->res_bucket].flags |= DLM_RTF_SHRINK; in toss_rsb()
1181 static int create_lkb(struct dlm_ls *ls, struct dlm_lkb **lkb_ret) in create_lkb() argument
1186 lkb = dlm_allocate_lkb(ls); in create_lkb()
1201 spin_lock(&ls->ls_lkbidr_spin); in create_lkb()
1202 rv = idr_alloc(&ls->ls_lkbidr, lkb, 1, 0, GFP_NOWAIT); in create_lkb()
1205 spin_unlock(&ls->ls_lkbidr_spin); in create_lkb()
1209 log_error(ls, "create_lkb idr error %d", rv); in create_lkb()
1218 static int find_lkb(struct dlm_ls *ls, uint32_t lkid, struct dlm_lkb **lkb_ret) in find_lkb() argument
1222 spin_lock(&ls->ls_lkbidr_spin); in find_lkb()
1223 lkb = idr_find(&ls->ls_lkbidr, lkid); in find_lkb()
1226 spin_unlock(&ls->ls_lkbidr_spin); in find_lkb()
1245 static int __put_lkb(struct dlm_ls *ls, struct dlm_lkb *lkb) in __put_lkb() argument
1249 spin_lock(&ls->ls_lkbidr_spin); in __put_lkb()
1251 idr_remove(&ls->ls_lkbidr, lkid); in __put_lkb()
1252 spin_unlock(&ls->ls_lkbidr_spin); in __put_lkb()
1262 spin_unlock(&ls->ls_lkbidr_spin); in __put_lkb()
1269 struct dlm_ls *ls; in dlm_put_lkb() local
1274 ls = lkb->lkb_resource->res_ls; in dlm_put_lkb()
1275 return __put_lkb(ls, lkb); in dlm_put_lkb()
1393 void dlm_scan_waiters(struct dlm_ls *ls) in dlm_scan_waiters() argument
1406 mutex_lock(&ls->ls_waiters_mutex); in dlm_scan_waiters()
1408 list_for_each_entry(lkb, &ls->ls_waiters, lkb_wait_reply) { in dlm_scan_waiters()
1426 num_nodes = ls->ls_num_nodes; in dlm_scan_waiters()
1434 log_error(ls, "waitwarn %x %lld %d us check connection to " in dlm_scan_waiters()
1438 mutex_unlock(&ls->ls_waiters_mutex); in dlm_scan_waiters()
1442 log_debug(ls, "scan_waiters %u warn %u over %d us max %lld us", in dlm_scan_waiters()
1452 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in add_to_waiters() local
1455 mutex_lock(&ls->ls_waiters_mutex); in add_to_waiters()
1478 log_debug(ls, "addwait %x cur %d overlap %d count %d f %x", in add_to_waiters()
1493 list_add(&lkb->lkb_wait_reply, &ls->ls_waiters); in add_to_waiters()
1496 log_error(ls, "addwait error %x %d flags %x %d %d %s", in add_to_waiters()
1499 mutex_unlock(&ls->ls_waiters_mutex); in add_to_waiters()
1511 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in _remove_from_waiters() local
1515 log_debug(ls, "remwait %x unlock_reply overlap", lkb->lkb_id); in _remove_from_waiters()
1522 log_debug(ls, "remwait %x cancel_reply overlap", lkb->lkb_id); in _remove_from_waiters()
1533 log_debug(ls, "remwait %x cancel_reply wait_type %d", in _remove_from_waiters()
1549 log_debug(ls, "remwait %x convert_reply zap overlap_cancel", in _remove_from_waiters()
1565 log_error(ls, "remwait error %x remote %d %x msg %d flags %x no wait", in _remove_from_waiters()
1577 log_error(ls, "remwait error %x reply %d wait_type %d overlap", in _remove_from_waiters()
1595 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in remove_from_waiters() local
1598 mutex_lock(&ls->ls_waiters_mutex); in remove_from_waiters()
1600 mutex_unlock(&ls->ls_waiters_mutex); in remove_from_waiters()
1609 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in remove_from_waiters_ms() local
1613 mutex_lock(&ls->ls_waiters_mutex); in remove_from_waiters_ms()
1616 mutex_unlock(&ls->ls_waiters_mutex); in remove_from_waiters_ms()
1627 struct dlm_ls *ls = r->res_ls; in wait_pending_remove() local
1629 spin_lock(&ls->ls_remove_spin); in wait_pending_remove()
1630 if (ls->ls_remove_len && in wait_pending_remove()
1631 !rsb_cmp(r, ls->ls_remove_name, ls->ls_remove_len)) { in wait_pending_remove()
1632 log_debug(ls, "delay lookup for remove dir %d %s", in wait_pending_remove()
1634 spin_unlock(&ls->ls_remove_spin); in wait_pending_remove()
1638 spin_unlock(&ls->ls_remove_spin); in wait_pending_remove()
1648 static void shrink_bucket(struct dlm_ls *ls, int b) in shrink_bucket() argument
1658 memset(&ls->ls_remove_lens, 0, sizeof(int) * DLM_REMOVE_NAMES_MAX); in shrink_bucket()
1660 spin_lock(&ls->ls_rsbtbl[b].lock); in shrink_bucket()
1662 if (!(ls->ls_rsbtbl[b].flags & DLM_RTF_SHRINK)) { in shrink_bucket()
1663 spin_unlock(&ls->ls_rsbtbl[b].lock); in shrink_bucket()
1667 for (n = rb_first(&ls->ls_rsbtbl[b].toss); n; n = next) { in shrink_bucket()
1676 if (!dlm_no_directory(ls) && in shrink_bucket()
1689 if (!dlm_no_directory(ls) && in shrink_bucket()
1697 ls->ls_remove_lens[remote_count] = r->res_length; in shrink_bucket()
1698 memcpy(ls->ls_remove_names[remote_count], r->res_name, in shrink_bucket()
1708 log_error(ls, "tossed rsb in use %s", r->res_name); in shrink_bucket()
1712 rb_erase(&r->res_hashnode, &ls->ls_rsbtbl[b].toss); in shrink_bucket()
1717 ls->ls_rsbtbl[b].flags |= DLM_RTF_SHRINK; in shrink_bucket()
1719 ls->ls_rsbtbl[b].flags &= ~DLM_RTF_SHRINK; in shrink_bucket()
1720 spin_unlock(&ls->ls_rsbtbl[b].lock); in shrink_bucket()
1737 name = ls->ls_remove_names[i]; in shrink_bucket()
1738 len = ls->ls_remove_lens[i]; in shrink_bucket()
1740 spin_lock(&ls->ls_rsbtbl[b].lock); in shrink_bucket()
1741 rv = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, &r); in shrink_bucket()
1743 spin_unlock(&ls->ls_rsbtbl[b].lock); in shrink_bucket()
1744 log_debug(ls, "remove_name not toss %s", name); in shrink_bucket()
1749 spin_unlock(&ls->ls_rsbtbl[b].lock); in shrink_bucket()
1750 log_debug(ls, "remove_name master %d dir %d our %d %s", in shrink_bucket()
1758 spin_unlock(&ls->ls_rsbtbl[b].lock); in shrink_bucket()
1759 log_error(ls, "remove_name dir %d master %d our %d %s", in shrink_bucket()
1767 spin_unlock(&ls->ls_rsbtbl[b].lock); in shrink_bucket()
1768 log_debug(ls, "remove_name toss_time %lu now %lu %s", in shrink_bucket()
1774 spin_unlock(&ls->ls_rsbtbl[b].lock); in shrink_bucket()
1775 log_error(ls, "remove_name in use %s", name); in shrink_bucket()
1779 rb_erase(&r->res_hashnode, &ls->ls_rsbtbl[b].toss); in shrink_bucket()
1782 spin_lock(&ls->ls_remove_spin); in shrink_bucket()
1783 ls->ls_remove_len = len; in shrink_bucket()
1784 memcpy(ls->ls_remove_name, name, DLM_RESNAME_MAXLEN); in shrink_bucket()
1785 spin_unlock(&ls->ls_remove_spin); in shrink_bucket()
1786 spin_unlock(&ls->ls_rsbtbl[b].lock); in shrink_bucket()
1791 spin_lock(&ls->ls_remove_spin); in shrink_bucket()
1792 ls->ls_remove_len = 0; in shrink_bucket()
1793 memset(ls->ls_remove_name, 0, DLM_RESNAME_MAXLEN); in shrink_bucket()
1794 spin_unlock(&ls->ls_remove_spin); in shrink_bucket()
1800 void dlm_scan_rsbs(struct dlm_ls *ls) in dlm_scan_rsbs() argument
1804 for (i = 0; i < ls->ls_rsbtbl_size; i++) { in dlm_scan_rsbs()
1805 shrink_bucket(ls, i); in dlm_scan_rsbs()
1806 if (dlm_locking_stopped(ls)) in dlm_scan_rsbs()
1814 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in add_timeout() local
1819 if (test_bit(LSFL_TIMEWARN, &ls->ls_flags) && in add_timeout()
1830 mutex_lock(&ls->ls_timeout_mutex); in add_timeout()
1832 list_add_tail(&lkb->lkb_time_list, &ls->ls_timeout); in add_timeout()
1833 mutex_unlock(&ls->ls_timeout_mutex); in add_timeout()
1838 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in del_timeout() local
1840 mutex_lock(&ls->ls_timeout_mutex); in del_timeout()
1845 mutex_unlock(&ls->ls_timeout_mutex); in del_timeout()
1854 void dlm_scan_timeout(struct dlm_ls *ls) in dlm_scan_timeout() argument
1862 if (dlm_locking_stopped(ls)) in dlm_scan_timeout()
1867 mutex_lock(&ls->ls_timeout_mutex); in dlm_scan_timeout()
1868 list_for_each_entry(lkb, &ls->ls_timeout, lkb_time_list) { in dlm_scan_timeout()
1886 mutex_unlock(&ls->ls_timeout_mutex); in dlm_scan_timeout()
1904 log_debug(ls, "timeout cancel %x node %d %s", in dlm_scan_timeout()
1921 void dlm_adjust_timeouts(struct dlm_ls *ls) in dlm_adjust_timeouts() argument
1924 u64 adj_us = jiffies_to_usecs(jiffies - ls->ls_recover_begin); in dlm_adjust_timeouts()
1926 ls->ls_recover_begin = 0; in dlm_adjust_timeouts()
1927 mutex_lock(&ls->ls_timeout_mutex); in dlm_adjust_timeouts()
1928 list_for_each_entry(lkb, &ls->ls_timeout, lkb_time_list) in dlm_adjust_timeouts()
1930 mutex_unlock(&ls->ls_timeout_mutex); in dlm_adjust_timeouts()
1935 mutex_lock(&ls->ls_waiters_mutex); in dlm_adjust_timeouts()
1936 list_for_each_entry(lkb, &ls->ls_waiters, lkb_wait_reply) { in dlm_adjust_timeouts()
1940 mutex_unlock(&ls->ls_waiters_mutex); in dlm_adjust_timeouts()
2886 static int validate_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, in validate_lock_args() argument
2923 log_debug(ls, "validate_lock_args %d %x %x %x %d %d %s", in validate_lock_args()
2939 struct dlm_ls *ls = lkb->lkb_resource->res_ls; in validate_unlock_args() local
2943 log_error(ls, "unlock on MSTCPY %x", lkb->lkb_id); in validate_unlock_args()
2953 log_debug(ls, "unlock on ENDOFLIFE %x", lkb->lkb_id); in validate_unlock_args()
2963 log_debug(ls, "unlock on rsb_lookup %x", lkb->lkb_id); in validate_unlock_args()
3060 log_debug(ls, "validate_unlock_args %d %x %x %x %x %d %s", rv, in validate_unlock_args()
3314 static int request_lock(struct dlm_ls *ls, struct dlm_lkb *lkb, char *name, in request_lock() argument
3320 error = validate_lock_args(ls, lkb, args); in request_lock()
3324 error = find_rsb(ls, name, len, 0, R_REQUEST, &r); in request_lock()
3340 static int convert_lock(struct dlm_ls *ls, struct dlm_lkb *lkb, in convert_lock() argument
3351 error = validate_lock_args(ls, lkb, args); in convert_lock()
3362 static int unlock_lock(struct dlm_ls *ls, struct dlm_lkb *lkb, in unlock_lock() argument
3384 static int cancel_lock(struct dlm_ls *ls, struct dlm_lkb *lkb, in cancel_lock() argument
3421 struct dlm_ls *ls; in dlm_lock() local
3426 ls = dlm_find_lockspace_local(lockspace); in dlm_lock()
3427 if (!ls) in dlm_lock()
3430 dlm_lock_recovery(ls); in dlm_lock()
3433 error = find_lkb(ls, lksb->sb_lkid, &lkb); in dlm_lock()
3435 error = create_lkb(ls, &lkb); in dlm_lock()
3446 error = convert_lock(ls, lkb, &args); in dlm_lock()
3448 error = request_lock(ls, lkb, name, namelen, &args); in dlm_lock()
3454 __put_lkb(ls, lkb); in dlm_lock()
3458 dlm_unlock_recovery(ls); in dlm_lock()
3459 dlm_put_lockspace(ls); in dlm_lock()
3469 struct dlm_ls *ls; in dlm_unlock() local
3474 ls = dlm_find_lockspace_local(lockspace); in dlm_unlock()
3475 if (!ls) in dlm_unlock()
3478 dlm_lock_recovery(ls); in dlm_unlock()
3480 error = find_lkb(ls, lkid, &lkb); in dlm_unlock()
3489 error = cancel_lock(ls, lkb, &args); in dlm_unlock()
3491 error = unlock_lock(ls, lkb, &args); in dlm_unlock()
3500 dlm_unlock_recovery(ls); in dlm_unlock()
3501 dlm_put_lockspace(ls); in dlm_unlock()
3527 static int _create_message(struct dlm_ls *ls, int mb_len, in _create_message() argument
3549 ms->m_header.h_lockspace = ls->ls_global_id; in _create_message()
3839 static int send_lookup_reply(struct dlm_ls *ls, struct dlm_message *ms_in, in send_lookup_reply() argument
3842 struct dlm_rsb *r = &ls->ls_stub_rsb; in send_lookup_reply()
3887 static int receive_lvb(struct dlm_ls *ls, struct dlm_lkb *lkb, in receive_lvb() argument
3894 lkb->lkb_lvbptr = dlm_allocate_lvb(ls); in receive_lvb()
3898 if (len > ls->ls_lvblen) in receive_lvb()
3899 len = ls->ls_lvblen; in receive_lvb()
3915 static int receive_request_args(struct dlm_ls *ls, struct dlm_lkb *lkb, in receive_request_args() argument
3929 lkb->lkb_lvbptr = dlm_allocate_lvb(ls); in receive_request_args()
3937 static int receive_convert_args(struct dlm_ls *ls, struct dlm_lkb *lkb, in receive_convert_args() argument
3943 if (receive_lvb(ls, lkb, ms)) in receive_convert_args()
3952 static int receive_unlock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, in receive_unlock_args() argument
3955 if (receive_lvb(ls, lkb, ms)) in receive_unlock_args()
3963 static void setup_stub_lkb(struct dlm_ls *ls, struct dlm_message *ms) in setup_stub_lkb() argument
3965 struct dlm_lkb *lkb = &ls->ls_stub_lkb; in setup_stub_lkb()
4014 static void send_repeat_remove(struct dlm_ls *ls, char *ms_name, int len) in send_repeat_remove() argument
4027 b = hash & (ls->ls_rsbtbl_size - 1); in send_repeat_remove()
4029 dir_nodeid = dlm_hash2nodeid(ls, hash); in send_repeat_remove()
4031 log_error(ls, "send_repeat_remove dir %d %s", dir_nodeid, name); in send_repeat_remove()
4033 spin_lock(&ls->ls_rsbtbl[b].lock); in send_repeat_remove()
4034 rv = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].keep, name, len, &r); in send_repeat_remove()
4036 spin_unlock(&ls->ls_rsbtbl[b].lock); in send_repeat_remove()
4037 log_error(ls, "repeat_remove on keep %s", name); in send_repeat_remove()
4041 rv = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, &r); in send_repeat_remove()
4043 spin_unlock(&ls->ls_rsbtbl[b].lock); in send_repeat_remove()
4044 log_error(ls, "repeat_remove on toss %s", name); in send_repeat_remove()
4048 /* use ls->remove_name2 to avoid conflict with shrink? */ in send_repeat_remove()
4050 spin_lock(&ls->ls_remove_spin); in send_repeat_remove()
4051 ls->ls_remove_len = len; in send_repeat_remove()
4052 memcpy(ls->ls_remove_name, name, DLM_RESNAME_MAXLEN); in send_repeat_remove()
4053 spin_unlock(&ls->ls_remove_spin); in send_repeat_remove()
4054 spin_unlock(&ls->ls_rsbtbl[b].lock); in send_repeat_remove()
4056 rv = _create_message(ls, sizeof(struct dlm_message) + len, in send_repeat_remove()
4066 spin_lock(&ls->ls_remove_spin); in send_repeat_remove()
4067 ls->ls_remove_len = 0; in send_repeat_remove()
4068 memset(ls->ls_remove_name, 0, DLM_RESNAME_MAXLEN); in send_repeat_remove()
4069 spin_unlock(&ls->ls_remove_spin); in send_repeat_remove()
4072 static int receive_request(struct dlm_ls *ls, struct dlm_message *ms) in receive_request() argument
4081 error = create_lkb(ls, &lkb); in receive_request()
4087 error = receive_request_args(ls, lkb, ms); in receive_request()
4089 __put_lkb(ls, lkb); in receive_request()
4101 error = find_rsb(ls, ms->m_extra, namelen, from_nodeid, in receive_request()
4104 __put_lkb(ls, lkb); in receive_request()
4111 error = validate_master_nodeid(ls, r, from_nodeid); in receive_request()
4115 __put_lkb(ls, lkb); in receive_request()
4151 log_limit(ls, "receive_request %x from %d %d", in receive_request()
4156 send_repeat_remove(ls, ms->m_extra, namelen); in receive_request()
4160 setup_stub_lkb(ls, ms); in receive_request()
4161 send_request_reply(&ls->ls_stub_rsb, &ls->ls_stub_lkb, error); in receive_request()
4165 static int receive_convert(struct dlm_ls *ls, struct dlm_message *ms) in receive_convert() argument
4171 error = find_lkb(ls, ms->m_remid, &lkb); in receive_convert()
4176 log_error(ls, "receive_convert %x remid %x recover_seq %llu " in receive_convert()
4196 error = receive_convert_args(ls, lkb, ms); in receive_convert()
4215 setup_stub_lkb(ls, ms); in receive_convert()
4216 send_convert_reply(&ls->ls_stub_rsb, &ls->ls_stub_lkb, error); in receive_convert()
4220 static int receive_unlock(struct dlm_ls *ls, struct dlm_message *ms) in receive_unlock() argument
4226 error = find_lkb(ls, ms->m_remid, &lkb); in receive_unlock()
4231 log_error(ls, "receive_unlock %x remid %x remote %d %x", in receive_unlock()
4250 error = receive_unlock_args(ls, lkb, ms); in receive_unlock()
4266 setup_stub_lkb(ls, ms); in receive_unlock()
4267 send_unlock_reply(&ls->ls_stub_rsb, &ls->ls_stub_lkb, error); in receive_unlock()
4271 static int receive_cancel(struct dlm_ls *ls, struct dlm_message *ms) in receive_cancel() argument
4277 error = find_lkb(ls, ms->m_remid, &lkb); in receive_cancel()
4302 setup_stub_lkb(ls, ms); in receive_cancel()
4303 send_cancel_reply(&ls->ls_stub_rsb, &ls->ls_stub_lkb, error); in receive_cancel()
4307 static int receive_grant(struct dlm_ls *ls, struct dlm_message *ms) in receive_grant() argument
4313 error = find_lkb(ls, ms->m_remid, &lkb); in receive_grant()
4338 static int receive_bast(struct dlm_ls *ls, struct dlm_message *ms) in receive_bast() argument
4344 error = find_lkb(ls, ms->m_remid, &lkb); in receive_bast()
4366 static void receive_lookup(struct dlm_ls *ls, struct dlm_message *ms) in receive_lookup() argument
4375 error = dlm_master_lookup(ls, from_nodeid, ms->m_extra, len, 0, in receive_lookup()
4380 receive_request(ls, ms); in receive_lookup()
4383 send_lookup_reply(ls, ms, ret_nodeid, error); in receive_lookup()
4386 static void receive_remove(struct dlm_ls *ls, struct dlm_message *ms) in receive_remove() argument
4398 log_error(ls, "receive_remove from %d bad len %d", in receive_remove()
4403 dir_nodeid = dlm_hash2nodeid(ls, ms->m_hash); in receive_remove()
4405 log_error(ls, "receive_remove from %d bad nodeid %d", in receive_remove()
4423 b = hash & (ls->ls_rsbtbl_size - 1); in receive_remove()
4425 spin_lock(&ls->ls_rsbtbl[b].lock); in receive_remove()
4427 rv = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, &r); in receive_remove()
4430 rv = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].keep, name, len, &r); in receive_remove()
4433 log_error(ls, "receive_remove from %d not found %s", in receive_remove()
4435 spin_unlock(&ls->ls_rsbtbl[b].lock); in receive_remove()
4440 log_error(ls, "receive_remove keep from %d master %d", in receive_remove()
4443 spin_unlock(&ls->ls_rsbtbl[b].lock); in receive_remove()
4447 log_debug(ls, "receive_remove from %d master %d first %x %s", in receive_remove()
4450 spin_unlock(&ls->ls_rsbtbl[b].lock); in receive_remove()
4455 log_error(ls, "receive_remove toss from %d master %d", in receive_remove()
4458 spin_unlock(&ls->ls_rsbtbl[b].lock); in receive_remove()
4463 rb_erase(&r->res_hashnode, &ls->ls_rsbtbl[b].toss); in receive_remove()
4464 spin_unlock(&ls->ls_rsbtbl[b].lock); in receive_remove()
4467 log_error(ls, "receive_remove from %d rsb ref error", in receive_remove()
4470 spin_unlock(&ls->ls_rsbtbl[b].lock); in receive_remove()
4474 static void receive_purge(struct dlm_ls *ls, struct dlm_message *ms) in receive_purge() argument
4476 do_purge(ls, ms->m_nodeid, ms->m_pid); in receive_purge()
4479 static int receive_request_reply(struct dlm_ls *ls, struct dlm_message *ms) in receive_request_reply() argument
4486 error = find_lkb(ls, ms->m_remid, &lkb); in receive_request_reply()
4501 log_error(ls, "receive_request_reply %x remote %d %x result %d", in receive_request_reply()
4546 log_limit(ls, "receive_request_reply %x from %d %d " in receive_request_reply()
4573 log_error(ls, "receive_request_reply %x error %d", in receive_request_reply()
4578 log_debug(ls, "receive_request_reply %x result %d unlock", in receive_request_reply()
4584 log_debug(ls, "receive_request_reply %x cancel", lkb->lkb_id); in receive_request_reply()
4666 static int receive_convert_reply(struct dlm_ls *ls, struct dlm_message *ms) in receive_convert_reply() argument
4671 error = find_lkb(ls, ms->m_remid, &lkb); in receive_convert_reply()
4716 static int receive_unlock_reply(struct dlm_ls *ls, struct dlm_message *ms) in receive_unlock_reply() argument
4721 error = find_lkb(ls, ms->m_remid, &lkb); in receive_unlock_reply()
4766 static int receive_cancel_reply(struct dlm_ls *ls, struct dlm_message *ms) in receive_cancel_reply() argument
4771 error = find_lkb(ls, ms->m_remid, &lkb); in receive_cancel_reply()
4780 static void receive_lookup_reply(struct dlm_ls *ls, struct dlm_message *ms) in receive_lookup_reply() argument
4787 error = find_lkb(ls, ms->m_lkid, &lkb); in receive_lookup_reply()
4789 log_error(ls, "receive_lookup_reply no lkid %x", ms->m_lkid); in receive_lookup_reply()
4814 log_error(ls, "receive_lookup_reply %x from %d ret %d " in receive_lookup_reply()
4828 log_error(ls, "receive_lookup_reply %x from %d bad ret_nodeid", in receive_lookup_reply()
4840 log_debug(ls, "receive_lookup_reply %x unlock %x", in receive_lookup_reply()
4858 static void _receive_message(struct dlm_ls *ls, struct dlm_message *ms, in _receive_message() argument
4863 if (!dlm_is_member(ls, ms->m_header.h_nodeid)) { in _receive_message()
4864 log_limit(ls, "receive %d from non-member %d %x %x %d", in _receive_message()
4875 error = receive_request(ls, ms); in _receive_message()
4879 error = receive_convert(ls, ms); in _receive_message()
4883 error = receive_unlock(ls, ms); in _receive_message()
4888 error = receive_cancel(ls, ms); in _receive_message()
4894 error = receive_request_reply(ls, ms); in _receive_message()
4898 error = receive_convert_reply(ls, ms); in _receive_message()
4902 error = receive_unlock_reply(ls, ms); in _receive_message()
4906 error = receive_cancel_reply(ls, ms); in _receive_message()
4913 error = receive_grant(ls, ms); in _receive_message()
4918 error = receive_bast(ls, ms); in _receive_message()
4924 receive_lookup(ls, ms); in _receive_message()
4928 receive_remove(ls, ms); in _receive_message()
4934 receive_lookup_reply(ls, ms); in _receive_message()
4940 receive_purge(ls, ms); in _receive_message()
4944 log_error(ls, "unknown message type %d", ms->m_type); in _receive_message()
4959 log_debug(ls, "receive %d no %x remote %d %x saved_seq %u", in _receive_message()
4963 log_error(ls, "receive %d no %x remote %d %x saved_seq %u", in _receive_message()
4968 dlm_dump_rsb_hash(ls, ms->m_hash); in _receive_message()
4972 log_error(ls, "receive %d inval from %d lkid %x remid %x " in _receive_message()
4987 static void dlm_receive_message(struct dlm_ls *ls, struct dlm_message *ms, in dlm_receive_message() argument
4990 if (dlm_locking_stopped(ls)) { in dlm_receive_message()
4994 if (!ls->ls_generation) { in dlm_receive_message()
4995 log_limit(ls, "receive %d from %d ignore old gen", in dlm_receive_message()
5000 dlm_add_requestqueue(ls, nodeid, ms); in dlm_receive_message()
5002 dlm_wait_requestqueue(ls); in dlm_receive_message()
5003 _receive_message(ls, ms, 0); in dlm_receive_message()
5010 void dlm_receive_message_saved(struct dlm_ls *ls, struct dlm_message *ms, in dlm_receive_message_saved() argument
5013 _receive_message(ls, ms, saved_seq); in dlm_receive_message_saved()
5024 struct dlm_ls *ls; in dlm_receive_buffer() local
5047 ls = dlm_find_lockspace_global(hd->h_lockspace); in dlm_receive_buffer()
5048 if (!ls) { in dlm_receive_buffer()
5061 be inactive (in this ls) before transitioning to recovery mode */ in dlm_receive_buffer()
5063 down_read(&ls->ls_recv_active); in dlm_receive_buffer()
5065 dlm_receive_message(ls, &p->message, nodeid); in dlm_receive_buffer()
5067 dlm_receive_rcom(ls, &p->rcom, nodeid); in dlm_receive_buffer()
5068 up_read(&ls->ls_recv_active); in dlm_receive_buffer()
5070 dlm_put_lockspace(ls); in dlm_receive_buffer()
5073 static void recover_convert_waiter(struct dlm_ls *ls, struct dlm_lkb *lkb, in recover_convert_waiter() argument
5101 static int waiter_needs_recovery(struct dlm_ls *ls, struct dlm_lkb *lkb, in waiter_needs_recovery() argument
5104 if (dlm_no_directory(ls)) in waiter_needs_recovery()
5107 if (dlm_is_removed(ls, lkb->lkb_wait_nodeid)) in waiter_needs_recovery()
5119 void dlm_recover_waiters_pre(struct dlm_ls *ls) in dlm_recover_waiters_pre() argument
5130 mutex_lock(&ls->ls_waiters_mutex); in dlm_recover_waiters_pre()
5132 list_for_each_entry_safe(lkb, safe, &ls->ls_waiters, lkb_wait_reply) { in dlm_recover_waiters_pre()
5140 log_debug(ls, "waiter %x remote %x msg %d r_nodeid %d " in dlm_recover_waiters_pre()
5159 if (!waiter_needs_recovery(ls, lkb, dir_nodeid)) in dlm_recover_waiters_pre()
5183 log_debug(ls, "rwpre overlap %x %x %d %d %d", in dlm_recover_waiters_pre()
5195 recover_convert_waiter(ls, lkb, ms_stub); in dlm_recover_waiters_pre()
5221 log_error(ls, "invalid lkb wait_type %d %d", in dlm_recover_waiters_pre()
5226 mutex_unlock(&ls->ls_waiters_mutex); in dlm_recover_waiters_pre()
5230 static struct dlm_lkb *find_resend_waiter(struct dlm_ls *ls) in find_resend_waiter() argument
5235 mutex_lock(&ls->ls_waiters_mutex); in find_resend_waiter()
5236 list_for_each_entry(lkb, &ls->ls_waiters, lkb_wait_reply) { in find_resend_waiter()
5243 mutex_unlock(&ls->ls_waiters_mutex); in find_resend_waiter()
5266 int dlm_recover_waiters_post(struct dlm_ls *ls) in dlm_recover_waiters_post() argument
5273 if (dlm_locking_stopped(ls)) { in dlm_recover_waiters_post()
5274 log_debug(ls, "recover_waiters_post aborted"); in dlm_recover_waiters_post()
5279 lkb = find_resend_waiter(ls); in dlm_recover_waiters_post()
5292 log_debug(ls, "waiter %x remote %x msg %d r_nodeid %d " in dlm_recover_waiters_post()
5307 mutex_lock(&ls->ls_waiters_mutex); in dlm_recover_waiters_post()
5309 mutex_unlock(&ls->ls_waiters_mutex); in dlm_recover_waiters_post()
5349 log_error(ls, "waiter %x msg %d r_nodeid %d " in dlm_recover_waiters_post()
5362 static void purge_mstcpy_list(struct dlm_ls *ls, struct dlm_rsb *r, in purge_mstcpy_list() argument
5374 if (lkb->lkb_recover_seq == ls->ls_recover_seq) in purge_mstcpy_list()
5381 log_error(ls, "purged mstcpy lkb not released"); in purge_mstcpy_list()
5387 struct dlm_ls *ls = r->res_ls; in dlm_purge_mstcpy_locks() local
5389 purge_mstcpy_list(ls, r, &r->res_grantqueue); in dlm_purge_mstcpy_locks()
5390 purge_mstcpy_list(ls, r, &r->res_convertqueue); in dlm_purge_mstcpy_locks()
5391 purge_mstcpy_list(ls, r, &r->res_waitqueue); in dlm_purge_mstcpy_locks()
5394 static void purge_dead_list(struct dlm_ls *ls, struct dlm_rsb *r, in purge_dead_list() argument
5405 dlm_is_removed(ls, lkb->lkb_nodeid)) { in purge_dead_list()
5418 log_error(ls, "purged dead lkb not released"); in purge_dead_list()
5429 void dlm_recover_purge(struct dlm_ls *ls) in dlm_recover_purge() argument
5440 list_for_each_entry(memb, &ls->ls_nodes_gone, list) { in dlm_recover_purge()
5448 down_write(&ls->ls_root_sem); in dlm_recover_purge()
5449 list_for_each_entry(r, &ls->ls_root_list, res_root_list) { in dlm_recover_purge()
5453 purge_dead_list(ls, r, &r->res_grantqueue, in dlm_recover_purge()
5455 purge_dead_list(ls, r, &r->res_convertqueue, in dlm_recover_purge()
5457 purge_dead_list(ls, r, &r->res_waitqueue, in dlm_recover_purge()
5464 up_write(&ls->ls_root_sem); in dlm_recover_purge()
5467 log_rinfo(ls, "dlm_recover_purge %u locks for %u nodes", in dlm_recover_purge()
5471 static struct dlm_rsb *find_grant_rsb(struct dlm_ls *ls, int bucket) in find_grant_rsb() argument
5476 spin_lock(&ls->ls_rsbtbl[bucket].lock); in find_grant_rsb()
5477 for (n = rb_first(&ls->ls_rsbtbl[bucket].keep); n; n = rb_next(n)) { in find_grant_rsb()
5487 spin_unlock(&ls->ls_rsbtbl[bucket].lock); in find_grant_rsb()
5490 spin_unlock(&ls->ls_rsbtbl[bucket].lock); in find_grant_rsb()
5511 void dlm_recover_grant(struct dlm_ls *ls) in dlm_recover_grant() argument
5520 r = find_grant_rsb(ls, bucket); in dlm_recover_grant()
5522 if (bucket == ls->ls_rsbtbl_size - 1) in dlm_recover_grant()
5541 log_rinfo(ls, "dlm_recover_grant %u locks on %u resources", in dlm_recover_grant()
5575 static int receive_rcom_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, in receive_rcom_lock_args() argument
5597 if (lvblen > ls->ls_lvblen) in receive_rcom_lock_args()
5599 lkb->lkb_lvbptr = dlm_allocate_lvb(ls); in receive_rcom_lock_args()
5626 int dlm_recover_master_copy(struct dlm_ls *ls, struct dlm_rcom *rc) in dlm_recover_master_copy() argument
5650 error = find_rsb(ls, rl->rl_name, le16_to_cpu(rl->rl_namelen), in dlm_recover_master_copy()
5657 if (dlm_no_directory(ls) && (dlm_dir_nodeid(r) != dlm_our_nodeid())) { in dlm_recover_master_copy()
5658 log_error(ls, "dlm_recover_master_copy remote %d %x not dir", in dlm_recover_master_copy()
5670 error = create_lkb(ls, &lkb); in dlm_recover_master_copy()
5674 error = receive_rcom_lock_args(ls, lkb, r, rc); in dlm_recover_master_copy()
5676 __put_lkb(ls, lkb); in dlm_recover_master_copy()
5683 ls->ls_recover_locks_in++; in dlm_recover_master_copy()
5693 lkb->lkb_recover_seq = ls->ls_recover_seq; in dlm_recover_master_copy()
5700 log_rinfo(ls, "dlm_recover_master_copy remote %d %x error %d", in dlm_recover_master_copy()
5707 int dlm_recover_process_copy(struct dlm_ls *ls, struct dlm_rcom *rc) in dlm_recover_process_copy() argument
5719 error = find_lkb(ls, lkid, &lkb); in dlm_recover_process_copy()
5721 log_error(ls, "dlm_recover_process_copy no %x remote %d %x %d", in dlm_recover_process_copy()
5731 log_error(ls, "dlm_recover_process_copy bad %x remote %d %x %d", in dlm_recover_process_copy()
5746 log_debug(ls, "dlm_recover_process_copy %x remote %d %x %d", in dlm_recover_process_copy()
5756 log_error(ls, "dlm_recover_process_copy %x remote %d %x %d unk", in dlm_recover_process_copy()
5771 int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua, in dlm_user_request() argument
5779 dlm_lock_recovery(ls); in dlm_user_request()
5781 error = create_lkb(ls, &lkb); in dlm_user_request()
5791 __put_lkb(ls, lkb); in dlm_user_request()
5802 __put_lkb(ls, lkb); in dlm_user_request()
5810 error = request_lock(ls, lkb, name, namelen, &args); in dlm_user_request()
5822 __put_lkb(ls, lkb); in dlm_user_request()
5832 dlm_unlock_recovery(ls); in dlm_user_request()
5836 int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, in dlm_user_convert() argument
5845 dlm_lock_recovery(ls); in dlm_user_convert()
5847 error = find_lkb(ls, lkid, &lkb); in dlm_user_convert()
5878 error = convert_lock(ls, lkb, &args); in dlm_user_convert()
5885 dlm_unlock_recovery(ls); in dlm_user_convert()
5896 int dlm_user_adopt_orphan(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, in dlm_user_adopt_orphan() argument
5906 mutex_lock(&ls->ls_orphans_mutex); in dlm_user_adopt_orphan()
5907 list_for_each_entry(lkb, &ls->ls_orphans, lkb_ownqueue) { in dlm_user_adopt_orphan()
5923 mutex_unlock(&ls->ls_orphans_mutex); in dlm_user_adopt_orphan()
5962 int dlm_user_unlock(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, in dlm_user_unlock() argument
5970 dlm_lock_recovery(ls); in dlm_user_unlock()
5972 error = find_lkb(ls, lkid, &lkb); in dlm_user_unlock()
5988 error = unlock_lock(ls, lkb, &args); in dlm_user_unlock()
6006 dlm_unlock_recovery(ls); in dlm_user_unlock()
6011 int dlm_user_cancel(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, in dlm_user_cancel() argument
6019 dlm_lock_recovery(ls); in dlm_user_cancel()
6021 error = find_lkb(ls, lkid, &lkb); in dlm_user_cancel()
6034 error = cancel_lock(ls, lkb, &args); in dlm_user_cancel()
6044 dlm_unlock_recovery(ls); in dlm_user_cancel()
6049 int dlm_user_deadlock(struct dlm_ls *ls, uint32_t flags, uint32_t lkid) in dlm_user_deadlock() argument
6057 dlm_lock_recovery(ls); in dlm_user_deadlock()
6059 error = find_lkb(ls, lkid, &lkb); in dlm_user_deadlock()
6093 dlm_unlock_recovery(ls); in dlm_user_deadlock()
6100 static int orphan_proc_lock(struct dlm_ls *ls, struct dlm_lkb *lkb) in orphan_proc_lock() argument
6106 mutex_lock(&ls->ls_orphans_mutex); in orphan_proc_lock()
6107 list_add_tail(&lkb->lkb_ownqueue, &ls->ls_orphans); in orphan_proc_lock()
6108 mutex_unlock(&ls->ls_orphans_mutex); in orphan_proc_lock()
6112 error = cancel_lock(ls, lkb, &args); in orphan_proc_lock()
6123 static int unlock_proc_lock(struct dlm_ls *ls, struct dlm_lkb *lkb) in unlock_proc_lock() argument
6131 error = unlock_lock(ls, lkb, &args); in unlock_proc_lock()
6141 static struct dlm_lkb *del_proc_lock(struct dlm_ls *ls, in del_proc_lock() argument
6146 mutex_lock(&ls->ls_clear_proc_locks); in del_proc_lock()
6158 mutex_unlock(&ls->ls_clear_proc_locks); in del_proc_lock()
6172 void dlm_clear_proc_locks(struct dlm_ls *ls, struct dlm_user_proc *proc) in dlm_clear_proc_locks() argument
6176 dlm_lock_recovery(ls); in dlm_clear_proc_locks()
6179 lkb = del_proc_lock(ls, proc); in dlm_clear_proc_locks()
6184 orphan_proc_lock(ls, lkb); in dlm_clear_proc_locks()
6186 unlock_proc_lock(ls, lkb); in dlm_clear_proc_locks()
6195 mutex_lock(&ls->ls_clear_proc_locks); in dlm_clear_proc_locks()
6211 mutex_unlock(&ls->ls_clear_proc_locks); in dlm_clear_proc_locks()
6212 dlm_unlock_recovery(ls); in dlm_clear_proc_locks()
6215 static void purge_proc_locks(struct dlm_ls *ls, struct dlm_user_proc *proc) in purge_proc_locks() argument
6233 unlock_proc_lock(ls, lkb); in purge_proc_locks()
6257 static void do_purge(struct dlm_ls *ls, int nodeid, int pid) in do_purge() argument
6261 mutex_lock(&ls->ls_orphans_mutex); in do_purge()
6262 list_for_each_entry_safe(lkb, safe, &ls->ls_orphans, lkb_ownqueue) { in do_purge()
6265 unlock_proc_lock(ls, lkb); in do_purge()
6269 mutex_unlock(&ls->ls_orphans_mutex); in do_purge()
6272 static int send_purge(struct dlm_ls *ls, int nodeid, int pid) in send_purge() argument
6278 error = _create_message(ls, sizeof(struct dlm_message), nodeid, in send_purge()
6288 int dlm_user_purge(struct dlm_ls *ls, struct dlm_user_proc *proc, in dlm_user_purge() argument
6294 error = send_purge(ls, nodeid, pid); in dlm_user_purge()
6296 dlm_lock_recovery(ls); in dlm_user_purge()
6298 purge_proc_locks(ls, proc); in dlm_user_purge()
6300 do_purge(ls, nodeid, pid); in dlm_user_purge()
6301 dlm_unlock_recovery(ls); in dlm_user_purge()