Lines Matching refs:lock

164 static void	flk_free_lock(lock_descriptor_t	*lock);
461 lock_descriptor_t *fplock, *lock, *nlock; in ofdcleanlock() local
482 SET_LOCK_TO_FIRST_SLEEP_VP(gp, lock, vp); in ofdcleanlock()
484 if (lock) { in ofdcleanlock()
486 nlock = lock->l_next; in ofdcleanlock()
487 if (fplock == lock) { in ofdcleanlock()
488 CANCEL_WAKEUP(lock); in ofdcleanlock()
491 lock = nlock; in ofdcleanlock()
492 } while (lock->l_vnode == vp); in ofdcleanlock()
495 SET_LOCK_TO_FIRST_ACTIVE_VP(gp, lock, vp); in ofdcleanlock()
497 if (lock) { in ofdcleanlock()
499 nlock = lock->l_next; in ofdcleanlock()
500 if (fplock == lock) { in ofdcleanlock()
501 flk_delete_active_lock(lock, 0); in ofdcleanlock()
502 flk_wakeup(lock, 1); in ofdcleanlock()
503 flk_free_lock(lock); in ofdcleanlock()
506 lock = nlock; in ofdcleanlock()
507 } while (lock->l_vnode == vp); in ofdcleanlock()
1010 flk_free_lock(lock_descriptor_t *lock) in flk_free_lock() argument
1014 ASSERT(IS_DEAD(lock)); in flk_free_lock()
1016 if ((fp = lock->l_ofd) != NULL) in flk_free_lock()
1019 if (IS_REFERENCED(lock)) { in flk_free_lock()
1020 lock->l_state |= DELETED_LOCK; in flk_free_lock()
1024 kmem_free((void *)lock, sizeof (lock_descriptor_t)); in flk_free_lock()
1028 flk_set_state(lock_descriptor_t *lock, int new_state) in flk_set_state() argument
1043 if (IS_INTERRUPTED(lock)) { in flk_set_state()
1050 if (IS_CANCELLED(lock)) { in flk_set_state()
1056 CHECK_LOCK_TRANSITION(lock->l_status, new_state); in flk_set_state()
1057 if (IS_PXFS(lock)) { in flk_set_state()
1058 cl_flk_state_transition_notify(lock, lock->l_status, new_state); in flk_set_state()
1060 lock->l_status = new_state; in flk_set_state()
1083 lock_descriptor_t *lock; in flk_process_request() local
1100 SET_LOCK_TO_FIRST_ACTIVE_VP(gp, lock, vp); in flk_process_request()
1103 if (lock) { in flk_process_request()
1105 if (BLOCKS(lock, request)) { in flk_process_request()
1116 if (SAME_OWNER(lock, request) && in flk_process_request()
1117 COVERS(lock, request) && in flk_process_request()
1120 lock = lock->l_next; in flk_process_request()
1121 } while (lock->l_vnode == vp); in flk_process_request()
1133 SET_LOCK_TO_FIRST_SLEEP_VP(gp, lock, vp); in flk_process_request()
1134 if (lock) { in flk_process_request()
1136 if (BLOCKS(lock, request)) { in flk_process_request()
1137 if (IS_GRANTED(lock)) { in flk_process_request()
1144 lock = lock->l_next; in flk_process_request()
1145 } while ((lock->l_vnode == vp)); in flk_process_request()
1146 first_glock = lock->l_prev; in flk_process_request()
1172 SET_LOCK_TO_FIRST_ACTIVE_VP(gp, lock, vp); in flk_process_request()
1173 if (lock) { in flk_process_request()
1175 flk_recompute_dependencies(lock, lk, 1, 0); in flk_process_request()
1176 lock = lock->l_next; in flk_process_request()
1177 } while (lock->l_vnode == vp); in flk_process_request()
1179 lock = first_glock; in flk_process_request()
1180 if (lock) { in flk_process_request()
1182 if (IS_GRANTED(lock)) { in flk_process_request()
1183 flk_recompute_dependencies(lock, lk, 1, 0); in flk_process_request()
1185 lock = lock->l_prev; in flk_process_request()
1186 } while ((lock->l_vnode == vp)); in flk_process_request()
1200 SET_LOCK_TO_FIRST_SLEEP_VP(gp, lock, vp); in flk_process_request()
1217 if (lock) { in flk_process_request()
1219 if (BLOCKS(lock, request)) { in flk_process_request()
1222 if (COVERS(lock, request) && in flk_process_request()
1223 lock->l_type == F_WRLCK) { in flk_process_request()
1225 !SAME_OWNER(lock, covered_by)) { in flk_process_request()
1230 covered_by = lock; in flk_process_request()
1233 !SAME_OWNER(lock, covered_by)) { in flk_process_request()
1234 lock = lock->l_next; in flk_process_request()
1237 if ((error = flk_add_edge(request, lock, in flk_process_request()
1241 lock = lock->l_next; in flk_process_request()
1242 } while (lock->l_vnode == vp); in flk_process_request()
1254 SET_LOCK_TO_FIRST_ACTIVE_VP(gp, lock, vp); in flk_process_request()
1255 ASSERT(lock != NULL); in flk_process_request()
1257 if (BLOCKS(lock, request)) { in flk_process_request()
1259 !SAME_OWNER(lock, covered_by)) { in flk_process_request()
1260 lock = lock->l_next; in flk_process_request()
1263 if ((error = flk_add_edge(request, lock, in flk_process_request()
1267 lock = lock->l_next; in flk_process_request()
1268 } while (lock->l_vnode == vp); in flk_process_request()
1305 lock_descriptor_t *lock, *lock1; in flk_execute_request() local
1322 SET_LOCK_TO_FIRST_ACTIVE_VP(gp, lock, vp); in flk_execute_request()
1324 if (lock == NULL && request->l_type == F_UNLCK) in flk_execute_request()
1326 if (lock == NULL) { in flk_execute_request()
1332 lock1 = lock->l_next; in flk_execute_request()
1333 if (SAME_OWNER(request, lock)) { in flk_execute_request()
1334 done_searching = flk_relation(lock, request); in flk_execute_request()
1336 lock = lock1; in flk_execute_request()
1337 } while (lock->l_vnode == vp && !done_searching); in flk_execute_request()
1613 flk_relation(lock_descriptor_t *lock, lock_descriptor_t *request) in flk_relation() argument
1621 graph_t *gp = (lock->l_graph); in flk_relation()
1634 lock->l_type == F_WRLCK) in flk_relation()
1637 lock->l_type == F_RDLCK) in flk_relation()
1642 if (lock->l_end < request->l_start) { in flk_relation()
1643 if (lock->l_end == request->l_start - 1 && in flk_relation()
1646 request->l_start = lock->l_start; in flk_relation()
1654 if (lock->l_start > request->l_end) { in flk_relation()
1655 if (request->l_end == lock->l_start - 1 && in flk_relation()
1658 request->l_end = lock->l_end; in flk_relation()
1666 if (request->l_end < lock->l_end) { in flk_relation()
1667 if (request->l_start > lock->l_start) { in flk_relation()
1669 request->l_start = lock->l_start; in flk_relation()
1670 request->l_end = lock->l_end; in flk_relation()
1676 COPY(lock1, lock); in flk_relation()
1677 COPY(lock2, lock); in flk_relation()
1678 lock1->l_start = lock->l_start; in flk_relation()
1681 lock2->l_end = lock->l_end; in flk_relation()
1687 } else if (request->l_start < lock->l_start) { in flk_relation()
1689 request->l_end = lock->l_end; in flk_relation()
1694 COPY(lock1, lock); in flk_relation()
1702 request->l_start = lock->l_start; in flk_relation()
1703 request->l_end = lock->l_end; in flk_relation()
1708 COPY(lock1, lock); in flk_relation()
1715 } else if (request->l_end > lock->l_end) { in flk_relation()
1716 if (request->l_start > lock->l_start) { in flk_relation()
1718 request->l_start = lock->l_start; in flk_relation()
1723 COPY(lock1, lock); in flk_relation()
1729 } else if (request->l_start < lock->l_start) { in flk_relation()
1737 if (request->l_start > lock->l_start) { in flk_relation()
1739 request->l_start = lock->l_start; in flk_relation()
1744 COPY(lock1, lock); in flk_relation()
1750 } else if (request->l_start < lock->l_start) { in flk_relation()
1758 flk_delete_active_lock(lock, 0); in flk_relation()
1759 flk_wakeup(lock, 1); in flk_relation()
1760 flk_free_lock(lock); in flk_relation()
1784 ASSERT(FIRST_ADJ(lock) == HEAD(lock)); in flk_relation()
1791 ep = FIRST_IN(lock); in flk_relation()
1792 while (ep != HEAD(lock)) { in flk_relation()
1797 flk_delete_active_lock(lock, 0); in flk_relation()
1801 flk_recompute_dependencies(lock, topology, nvertex, 1); in flk_relation()
1818 flk_wakeup(lock, 0); in flk_relation()
1820 ep = FIRST_IN(lock); in flk_relation()
1821 while (ep != HEAD(lock)) { in flk_relation()
1822 lock->l_sedge = NEXT_IN(ep); in flk_relation()
1826 ep = lock->l_sedge; in flk_relation()
1829 flk_free_lock(lock); in flk_relation()
1845 lock_descriptor_t *first_lock, *lock; in flk_insert_active_lock() local
1849 SET_LOCK_TO_FIRST_ACTIVE_VP(gp, lock, vp); in flk_insert_active_lock()
1850 first_lock = lock; in flk_insert_active_lock()
1853 for (; (lock->l_vnode == vp && in flk_insert_active_lock()
1854 lock->l_start < new_lock->l_start); lock = lock->l_next) in flk_insert_active_lock()
1857 lock = ACTIVE_HEAD(gp); in flk_insert_active_lock()
1860 lock->l_prev->l_next = new_lock; in flk_insert_active_lock()
1861 new_lock->l_next = lock; in flk_insert_active_lock()
1862 new_lock->l_prev = lock->l_prev; in flk_insert_active_lock()
1863 lock->l_prev = new_lock; in flk_insert_active_lock()
1882 flk_delete_active_lock(lock_descriptor_t *lock, int free_lock) in flk_delete_active_lock() argument
1884 vnode_t *vp = lock->l_vnode; in flk_delete_active_lock()
1885 graph_t *gp = lock->l_graph; in flk_delete_active_lock()
1889 ASSERT(NO_DEPENDENTS(lock)); in flk_delete_active_lock()
1890 ASSERT(NOT_BLOCKED(lock)); in flk_delete_active_lock()
1891 ASSERT(IS_ACTIVE(lock)); in flk_delete_active_lock()
1895 if (vp->v_filocks == (struct filock *)lock) { in flk_delete_active_lock()
1897 ((lock->l_next->l_vnode == vp) ? lock->l_next : in flk_delete_active_lock()
1900 lock->l_next->l_prev = lock->l_prev; in flk_delete_active_lock()
1901 lock->l_prev->l_next = lock->l_next; in flk_delete_active_lock()
1902 lock->l_next = lock->l_prev = NULL; in flk_delete_active_lock()
1903 flk_set_state(lock, FLK_DEAD_STATE); in flk_delete_active_lock()
1904 lock->l_state &= ~ACTIVE_LOCK; in flk_delete_active_lock()
1907 flk_free_lock(lock); in flk_delete_active_lock()
1921 lock_descriptor_t *lock; in flk_insert_sleeping_lock() local
1926 for (lock = gp->sleeping_locks.l_next; (lock != &gp->sleeping_locks && in flk_insert_sleeping_lock()
1927 lock->l_vnode < vp); lock = lock->l_next) in flk_insert_sleeping_lock()
1930 lock->l_prev->l_next = request; in flk_insert_sleeping_lock()
1931 request->l_prev = lock->l_prev; in flk_insert_sleeping_lock()
1932 lock->l_prev = request; in flk_insert_sleeping_lock()
1933 request->l_next = lock; in flk_insert_sleeping_lock()
1952 lock_descriptor_t *vertex, *lock; in flk_cancel_sleeping_lock() local
1997 SET_LOCK_TO_FIRST_SLEEP_VP(gp, lock, vp); in flk_cancel_sleeping_lock()
1999 if (lock) { in flk_cancel_sleeping_lock()
2001 if (IS_RECOMPUTE(lock)) { in flk_cancel_sleeping_lock()
2002 lock->l_index = nvertex; in flk_cancel_sleeping_lock()
2003 topology[nvertex++] = lock; in flk_cancel_sleeping_lock()
2005 lock->l_color = NO_COLOR; in flk_cancel_sleeping_lock()
2006 lock = lock->l_next; in flk_cancel_sleeping_lock()
2007 } while (lock->l_vnode == vp); in flk_cancel_sleeping_lock()
2010 SET_LOCK_TO_FIRST_ACTIVE_VP(gp, lock, vp); in flk_cancel_sleeping_lock()
2012 if (lock) { in flk_cancel_sleeping_lock()
2014 if (IS_RECOMPUTE(lock)) { in flk_cancel_sleeping_lock()
2015 lock->l_index = nvertex; in flk_cancel_sleeping_lock()
2016 topology[nvertex++] = lock; in flk_cancel_sleeping_lock()
2018 lock->l_color = NO_COLOR; in flk_cancel_sleeping_lock()
2019 lock = lock->l_next; in flk_cancel_sleeping_lock()
2020 } while (lock->l_vnode == vp); in flk_cancel_sleeping_lock()
2090 lock_descriptor_t *lock; in flk_graph_uncolor() local
2094 for (lock = ACTIVE_HEAD(gp)->l_next; lock != ACTIVE_HEAD(gp); in flk_graph_uncolor()
2095 lock = lock->l_next) in flk_graph_uncolor()
2096 lock->l_color = 0; in flk_graph_uncolor()
2098 for (lock = SLEEPING_HEAD(gp)->l_next; lock != SLEEPING_HEAD(gp); in flk_graph_uncolor()
2099 lock = lock->l_next) in flk_graph_uncolor()
2100 lock->l_color = 0; in flk_graph_uncolor()
2111 flk_wakeup(lock_descriptor_t *lock, int adj_list_remove) in flk_wakeup() argument
2114 graph_t *gp = lock->l_graph; in flk_wakeup()
2118 if (NO_DEPENDENTS(lock)) in flk_wakeup()
2120 ep = FIRST_IN(lock); in flk_wakeup()
2134 lock->l_sedge = NEXT_IN(ep); in flk_wakeup()
2137 ep = lock->l_sedge; in flk_wakeup()
2138 } while (ep != HEAD(lock)); in flk_wakeup()
2139 ASSERT(NO_DEPENDENTS(lock)); in flk_wakeup()
2168 lock_descriptor_t *vertex, *lock; in flk_recompute_dependencies() local
2214 lock = topology[i]; in flk_recompute_dependencies()
2215 if (COLORED(lock)) in flk_recompute_dependencies()
2217 if (BLOCKS(lock, vertex)) { in flk_recompute_dependencies()
2218 (void) flk_add_edge(vertex, lock, in flk_recompute_dependencies()
2220 COLOR(lock); in flk_recompute_dependencies()
2222 count += flk_color_reachables(lock); in flk_recompute_dependencies()
2242 lock = ep->from_vertex; in flk_recompute_dependencies()
2243 STACK_PUSH(vertex_stack, lock, l_stack); in flk_recompute_dependencies()
2244 lock->l_sedge = FIRST_IN(lock); in flk_recompute_dependencies()
2262 lock_descriptor_t *ver, *lock; in flk_color_reachables() local
2276 lock = ep->to_vertex; in flk_color_reachables()
2277 if (COLORED(lock)) in flk_color_reachables()
2279 COLOR(lock); in flk_color_reachables()
2280 if (IS_RECOMPUTE(lock)) in flk_color_reachables()
2282 STACK_PUSH(vertex_stack, lock, l_stack1); in flk_color_reachables()
2295 flk_update_barriers(lock_descriptor_t *lock) in flk_update_barriers() argument
2303 STACK_PUSH(vertex_stack, lock, l_stack1); in flk_update_barriers()
2339 flk_find_barriers(lock_descriptor_t *lock) in flk_find_barriers() argument
2348 STACK_PUSH(vertex_stack, lock, l_stack1); in flk_find_barriers()
2388 lock_descriptor_t *lock, *blocker; in flk_get_first_blocking_lock() local
2392 SET_LOCK_TO_FIRST_ACTIVE_VP(gp, lock, vp); in flk_get_first_blocking_lock()
2394 if (lock) { in flk_get_first_blocking_lock()
2396 if (BLOCKS(lock, request)) { in flk_get_first_blocking_lock()
2397 blocker = lock; in flk_get_first_blocking_lock()
2400 lock = lock->l_next; in flk_get_first_blocking_lock()
2401 } while (lock->l_vnode == vp); in flk_get_first_blocking_lock()
2411 SET_LOCK_TO_FIRST_SLEEP_VP(gp, lock, vp); in flk_get_first_blocking_lock()
2412 if (lock) { in flk_get_first_blocking_lock()
2414 if (BLOCKS(lock, request)) { in flk_get_first_blocking_lock()
2415 blocker = lock; in flk_get_first_blocking_lock()
2418 lock = lock->l_next; in flk_get_first_blocking_lock()
2419 } while (lock->l_vnode == vp); in flk_get_first_blocking_lock()
2503 lock_descriptor_t *lock; in cl_flk_has_remote_locks_for_nlmid() local
2522 SET_LOCK_TO_FIRST_ACTIVE_VP(gp, lock, vp); in cl_flk_has_remote_locks_for_nlmid()
2524 if (lock) { in cl_flk_has_remote_locks_for_nlmid()
2525 while (lock->l_vnode == vp) { in cl_flk_has_remote_locks_for_nlmid()
2527 lock_nlmid = GETNLMID(lock->l_flock.l_sysid); in cl_flk_has_remote_locks_for_nlmid()
2533 if (IS_LOCKMGR(lock) && nlmid == lock_nlmid) { in cl_flk_has_remote_locks_for_nlmid()
2537 lock = lock->l_next; in cl_flk_has_remote_locks_for_nlmid()
2541 SET_LOCK_TO_FIRST_SLEEP_VP(gp, lock, vp); in cl_flk_has_remote_locks_for_nlmid()
2543 if (lock) { in cl_flk_has_remote_locks_for_nlmid()
2544 while (lock->l_vnode == vp) { in cl_flk_has_remote_locks_for_nlmid()
2546 lock_nlmid = GETNLMID(lock->l_flock.l_sysid); in cl_flk_has_remote_locks_for_nlmid()
2552 if (IS_LOCKMGR(lock) && nlmid == lock_nlmid) { in cl_flk_has_remote_locks_for_nlmid()
2556 lock = lock->l_next; in cl_flk_has_remote_locks_for_nlmid()
2577 lock_descriptor_t *lock; in flk_has_remote_locks() local
2588 SET_LOCK_TO_FIRST_ACTIVE_VP(gp, lock, vp); in flk_has_remote_locks()
2590 if (lock) { in flk_has_remote_locks()
2591 while (lock->l_vnode == vp) { in flk_has_remote_locks()
2592 if (IS_REMOTE(lock)) { in flk_has_remote_locks()
2596 lock = lock->l_next; in flk_has_remote_locks()
2600 SET_LOCK_TO_FIRST_SLEEP_VP(gp, lock, vp); in flk_has_remote_locks()
2602 if (lock) { in flk_has_remote_locks()
2603 while (lock->l_vnode == vp) { in flk_has_remote_locks()
2604 if (IS_REMOTE(lock)) { in flk_has_remote_locks()
2608 lock = lock->l_next; in flk_has_remote_locks()
2625 lock_descriptor_t *lock; in flk_has_remote_locks_for_sysid() local
2639 SET_LOCK_TO_FIRST_ACTIVE_VP(gp, lock, vp); in flk_has_remote_locks_for_sysid()
2641 if (lock) { in flk_has_remote_locks_for_sysid()
2642 while (lock->l_vnode == vp) { in flk_has_remote_locks_for_sysid()
2643 if (lock->l_flock.l_sysid == sysid) { in flk_has_remote_locks_for_sysid()
2647 lock = lock->l_next; in flk_has_remote_locks_for_sysid()
2651 SET_LOCK_TO_FIRST_SLEEP_VP(gp, lock, vp); in flk_has_remote_locks_for_sysid()
2653 if (lock) { in flk_has_remote_locks_for_sysid()
2654 while (lock->l_vnode == vp) { in flk_has_remote_locks_for_sysid()
2655 if (lock->l_flock.l_sysid == sysid) { in flk_has_remote_locks_for_sysid()
2659 lock = lock->l_next; in flk_has_remote_locks_for_sysid()
2682 lock_descriptor_t *lock; in flk_sysid_has_locks() local
2697 for (lock = ACTIVE_HEAD(gp)->l_next; in flk_sysid_has_locks()
2698 lock != ACTIVE_HEAD(gp) && !has_locks; in flk_sysid_has_locks()
2699 lock = lock->l_next) { in flk_sysid_has_locks()
2700 if (lock->l_flock.l_sysid == sysid) in flk_sysid_has_locks()
2706 for (lock = SLEEPING_HEAD(gp)->l_next; in flk_sysid_has_locks()
2707 lock != SLEEPING_HEAD(gp) && !has_locks; in flk_sysid_has_locks()
2708 lock = lock->l_next) { in flk_sysid_has_locks()
2709 if (lock->l_flock.l_sysid == sysid) in flk_sysid_has_locks()
2735 lock_descriptor_t *lock, *nlock; in cl_flk_remove_locks_by_sysid() local
2756 lock = SLEEPING_HEAD(gp)->l_next; in cl_flk_remove_locks_by_sysid()
2757 while (lock != SLEEPING_HEAD(gp)) { in cl_flk_remove_locks_by_sysid()
2758 nlock = lock->l_next; in cl_flk_remove_locks_by_sysid()
2759 if (lock->l_flock.l_sysid == sysid) { in cl_flk_remove_locks_by_sysid()
2760 INTERRUPT_WAKEUP(lock); in cl_flk_remove_locks_by_sysid()
2762 lock = nlock; in cl_flk_remove_locks_by_sysid()
2766 lock = ACTIVE_HEAD(gp)->l_next; in cl_flk_remove_locks_by_sysid()
2767 while (lock != ACTIVE_HEAD(gp)) { in cl_flk_remove_locks_by_sysid()
2768 nlock = lock->l_next; in cl_flk_remove_locks_by_sysid()
2769 if (lock->l_flock.l_sysid == sysid) { in cl_flk_remove_locks_by_sysid()
2770 flk_delete_active_lock(lock, 0); in cl_flk_remove_locks_by_sysid()
2771 flk_wakeup(lock, 1); in cl_flk_remove_locks_by_sysid()
2772 flk_free_lock(lock); in cl_flk_remove_locks_by_sysid()
2774 lock = nlock; in cl_flk_remove_locks_by_sysid()
2788 lock_descriptor_t *lock, *nlock; in flk_delete_locks_by_sysid() local
2808 lock = SLEEPING_HEAD(gp)->l_next; in flk_delete_locks_by_sysid()
2809 while (lock != SLEEPING_HEAD(gp)) { in flk_delete_locks_by_sysid()
2810 nlock = lock->l_next; in flk_delete_locks_by_sysid()
2811 if (lock->l_flock.l_sysid == sysid) { in flk_delete_locks_by_sysid()
2812 INTERRUPT_WAKEUP(lock); in flk_delete_locks_by_sysid()
2814 lock = nlock; in flk_delete_locks_by_sysid()
2818 lock = ACTIVE_HEAD(gp)->l_next; in flk_delete_locks_by_sysid()
2819 while (lock != ACTIVE_HEAD(gp)) { in flk_delete_locks_by_sysid()
2820 nlock = lock->l_next; in flk_delete_locks_by_sysid()
2821 if (lock->l_flock.l_sysid == sysid) { in flk_delete_locks_by_sysid()
2822 flk_delete_active_lock(lock, 0); in flk_delete_locks_by_sysid()
2823 flk_wakeup(lock, 1); in flk_delete_locks_by_sysid()
2824 flk_free_lock(lock); in flk_delete_locks_by_sysid()
2826 lock = nlock; in flk_delete_locks_by_sysid()
2842 lock_descriptor_t *lock, *nlock; in cl_flk_delete_pxfs_locks() local
2857 lock = SLEEPING_HEAD(gp)->l_next; in cl_flk_delete_pxfs_locks()
2858 while (lock != SLEEPING_HEAD(gp)) { in cl_flk_delete_pxfs_locks()
2859 nlock = lock->l_next; in cl_flk_delete_pxfs_locks()
2860 if (lock->l_vnode->v_vfsp == vfsp) { in cl_flk_delete_pxfs_locks()
2861 ASSERT(IS_PXFS(lock)); in cl_flk_delete_pxfs_locks()
2862 if (GETPXFSID(lock->l_flock.l_sysid) == in cl_flk_delete_pxfs_locks()
2864 flk_set_state(lock, in cl_flk_delete_pxfs_locks()
2866 flk_cancel_sleeping_lock(lock, 1); in cl_flk_delete_pxfs_locks()
2869 lock = nlock; in cl_flk_delete_pxfs_locks()
2873 lock = ACTIVE_HEAD(gp)->l_next; in cl_flk_delete_pxfs_locks()
2874 while (lock != ACTIVE_HEAD(gp)) { in cl_flk_delete_pxfs_locks()
2875 nlock = lock->l_next; in cl_flk_delete_pxfs_locks()
2876 if (lock->l_vnode->v_vfsp == vfsp) { in cl_flk_delete_pxfs_locks()
2877 ASSERT(IS_PXFS(lock)); in cl_flk_delete_pxfs_locks()
2878 if (GETPXFSID(lock->l_flock.l_sysid) == in cl_flk_delete_pxfs_locks()
2880 flk_delete_active_lock(lock, 0); in cl_flk_delete_pxfs_locks()
2881 flk_wakeup(lock, 1); in cl_flk_delete_pxfs_locks()
2882 flk_free_lock(lock); in cl_flk_delete_pxfs_locks()
2885 lock = nlock; in cl_flk_delete_pxfs_locks()
2901 lock_descriptor_t *lock, *nlock; in flk_canceled() local
2907 SET_LOCK_TO_FIRST_SLEEP_VP(gp, lock, vp); in flk_canceled()
2909 if (lock) { in flk_canceled()
2910 while (lock->l_vnode == vp) { in flk_canceled()
2911 nlock = lock->l_next; in flk_canceled()
2912 if (SAME_OWNER(lock, request) && in flk_canceled()
2913 lock->l_start == request->l_start && in flk_canceled()
2914 lock->l_end == request->l_end) { in flk_canceled()
2915 INTERRUPT_WAKEUP(lock); in flk_canceled()
2918 lock = nlock; in flk_canceled()
2934 lock_descriptor_t *lock, *nlock; in cleanlocks() local
2948 SET_LOCK_TO_FIRST_SLEEP_VP(gp, lock, vp); in cleanlocks()
2950 if (lock) { in cleanlocks()
2952 nlock = lock->l_next; in cleanlocks()
2953 if ((lock->l_flock.l_pid == pid || in cleanlocks()
2955 lock->l_flock.l_sysid == sysid) { in cleanlocks()
2956 CANCEL_WAKEUP(lock); in cleanlocks()
2958 lock = nlock; in cleanlocks()
2959 } while (lock->l_vnode == vp); in cleanlocks()
2962 SET_LOCK_TO_FIRST_ACTIVE_VP(gp, lock, vp); in cleanlocks()
2964 if (lock) { in cleanlocks()
2966 nlock = lock->l_next; in cleanlocks()
2967 if ((lock->l_flock.l_pid == pid || in cleanlocks()
2969 lock->l_flock.l_sysid == sysid) { in cleanlocks()
2970 flk_delete_active_lock(lock, 0); in cleanlocks()
2971 STACK_PUSH(link_stack, lock, l_stack); in cleanlocks()
2973 lock = nlock; in cleanlocks()
2974 } while (lock->l_vnode == vp); in cleanlocks()
2977 while ((lock = STACK_TOP(link_stack)) != NULL) { in cleanlocks()
2979 flk_wakeup(lock, 1); in cleanlocks()
2980 flk_free_lock(lock); in cleanlocks()
3079 flk_check_deadlock(lock_descriptor_t *lock) in flk_check_deadlock() argument
3092 if (lock->l_ofd != NULL) in flk_check_deadlock()
3098 start_vertex = flk_get_proc_vertex(lock); in flk_check_deadlock()
3103 ep = FIRST_ADJ(lock); in flk_check_deadlock()
3104 while (ep != HEAD(lock)) { in flk_check_deadlock()
3126 ep = FIRST_IN(lock); in flk_check_deadlock()
3128 while (ep != HEAD(lock)) { in flk_check_deadlock()
3187 ep = FIRST_ADJ(lock); in flk_check_deadlock()
3188 while (ep != HEAD(lock)) { in flk_check_deadlock()
3215 ep = FIRST_IN(lock); in flk_check_deadlock()
3216 while (ep != HEAD(lock)) { in flk_check_deadlock()
3255 flk_get_proc_vertex(lock_descriptor_t *lock) in flk_get_proc_vertex() argument
3262 if (lock->pvertex != -1) { in flk_get_proc_vertex()
3263 ASSERT(lock->pvertex >= 0); in flk_get_proc_vertex()
3264 pv = pgraph.proc[lock->pvertex]; in flk_get_proc_vertex()
3265 if (pv != NULL && PROC_SAME_OWNER(lock, pv)) { in flk_get_proc_vertex()
3271 if (pv != NULL && PROC_SAME_OWNER(lock, pv)) { in flk_get_proc_vertex()
3272 lock->pvertex = pv->index = i; in flk_get_proc_vertex()
3277 pv->pid = lock->l_flock.l_pid; in flk_get_proc_vertex()
3278 pv->sysid = lock->l_flock.l_sysid; in flk_get_proc_vertex()
3284 lock->pvertex = pv->index = i; in flk_get_proc_vertex()
3302 pv->index = lock->pvertex = pgraph.gcount; in flk_get_proc_vertex()
3663 lock_descriptor_t *lock; in get_lock_list() local
3705 for (lock = graph_head->l_next; in get_lock_list()
3706 lock != graph_head; in get_lock_list()
3707 lock = lock->l_next) { in get_lock_list()
3708 if (use_sysid && lock->l_flock.l_sysid != sysid) in get_lock_list()
3710 if (pid != NOPID && lock->l_flock.l_pid != pid) in get_lock_list()
3712 if (vp != NULL && lock->l_vnode != vp) in get_lock_list()
3714 if (lock_state && !(lock_state & lock->l_state)) in get_lock_list()
3716 if (zoneid != lock->l_zoneid && zoneid != ALL_ZONES) in get_lock_list()
3725 VN_HOLD(lock->l_vnode); in get_lock_list()
3726 llp->ll_vp = lock->l_vnode; in get_lock_list()
3727 create_flock(lock, &(llp->ll_flock)); in get_lock_list()
3847 lock_descriptor_t *lock; /* lock */ in cl_flk_change_nlm_state_all_locks() local
3861 for (lock = SLEEPING_HEAD(gp)->l_next; in cl_flk_change_nlm_state_all_locks()
3862 lock != SLEEPING_HEAD(gp); in cl_flk_change_nlm_state_all_locks()
3863 lock = nlock) { in cl_flk_change_nlm_state_all_locks()
3864 nlock = lock->l_next; in cl_flk_change_nlm_state_all_locks()
3866 lock_nlmid = GETNLMID(lock->l_flock.l_sysid); in cl_flk_change_nlm_state_all_locks()
3873 if (IS_LOCKMGR(lock) && nlmid == lock_nlmid) { in cl_flk_change_nlm_state_all_locks()
3874 SET_NLM_STATE(lock, nlm_state); in cl_flk_change_nlm_state_all_locks()
3879 for (lock = ACTIVE_HEAD(gp)->l_next; in cl_flk_change_nlm_state_all_locks()
3880 lock != ACTIVE_HEAD(gp); in cl_flk_change_nlm_state_all_locks()
3881 lock = nlock) { in cl_flk_change_nlm_state_all_locks()
3882 nlock = lock->l_next; in cl_flk_change_nlm_state_all_locks()
3884 lock_nlmid = GETNLMID(lock->l_flock.l_sysid); in cl_flk_change_nlm_state_all_locks()
3891 if (IS_LOCKMGR(lock) && nlmid == lock_nlmid) { in cl_flk_change_nlm_state_all_locks()
3892 ASSERT(IS_ACTIVE(lock)); in cl_flk_change_nlm_state_all_locks()
3893 SET_NLM_STATE(lock, nlm_state); in cl_flk_change_nlm_state_all_locks()
3908 lock_descriptor_t *lock; in cl_flk_wakeup_sleeping_nlm_locks() local
3923 for (lock = SLEEPING_HEAD(gp)->l_next; in cl_flk_wakeup_sleeping_nlm_locks()
3924 lock != SLEEPING_HEAD(gp); in cl_flk_wakeup_sleeping_nlm_locks()
3925 lock = nlock) { in cl_flk_wakeup_sleeping_nlm_locks()
3926 nlock = lock->l_next; in cl_flk_wakeup_sleeping_nlm_locks()
3933 if (IS_LOCKMGR(lock)) { in cl_flk_wakeup_sleeping_nlm_locks()
3936 GETNLMID(lock->l_flock.l_sysid); in cl_flk_wakeup_sleeping_nlm_locks()
3938 SET_NLM_STATE(lock, in cl_flk_wakeup_sleeping_nlm_locks()
3940 INTERRUPT_WAKEUP(lock); in cl_flk_wakeup_sleeping_nlm_locks()
3956 lock_descriptor_t *lock; in cl_flk_unlock_nlm_granted() local
3971 for (lock = ACTIVE_HEAD(gp)->l_next; in cl_flk_unlock_nlm_granted()
3972 lock != ACTIVE_HEAD(gp); in cl_flk_unlock_nlm_granted()
3973 lock = nlock) { in cl_flk_unlock_nlm_granted()
3974 nlock = lock->l_next; in cl_flk_unlock_nlm_granted()
3975 ASSERT(IS_ACTIVE(lock)); in cl_flk_unlock_nlm_granted()
3986 if (IS_LOCKMGR(lock)) { in cl_flk_unlock_nlm_granted()
3988 lock_nlmid = GETNLMID(lock->l_flock.l_sysid); in cl_flk_unlock_nlm_granted()
3990 flk_delete_active_lock(lock, 0); in cl_flk_unlock_nlm_granted()
3991 flk_wakeup(lock, 1); in cl_flk_unlock_nlm_granted()
3992 flk_free_lock(lock); in cl_flk_unlock_nlm_granted()
4006 lock_descriptor_t *lock; in wakeup_sleeping_lockmgr_locks() local
4022 for (lock = SLEEPING_HEAD(gp)->l_next; in wakeup_sleeping_lockmgr_locks()
4023 lock != SLEEPING_HEAD(gp); in wakeup_sleeping_lockmgr_locks()
4024 lock = nlock) { in wakeup_sleeping_lockmgr_locks()
4025 nlock = lock->l_next; in wakeup_sleeping_lockmgr_locks()
4026 if (IS_LOCKMGR(lock) && lock->l_zoneid == zoneid) { in wakeup_sleeping_lockmgr_locks()
4027 INTERRUPT_WAKEUP(lock); in wakeup_sleeping_lockmgr_locks()
4041 lock_descriptor_t *lock; in unlock_lockmgr_granted() local
4057 for (lock = ACTIVE_HEAD(gp)->l_next; in unlock_lockmgr_granted()
4058 lock != ACTIVE_HEAD(gp); in unlock_lockmgr_granted()
4059 lock = nlock) { in unlock_lockmgr_granted()
4060 nlock = lock->l_next; in unlock_lockmgr_granted()
4061 if (IS_LOCKMGR(lock) && lock->l_zoneid == zoneid) { in unlock_lockmgr_granted()
4062 ASSERT(IS_ACTIVE(lock)); in unlock_lockmgr_granted()
4063 flk_delete_active_lock(lock, 0); in unlock_lockmgr_granted()
4064 flk_wakeup(lock, 1); in unlock_lockmgr_granted()
4065 flk_free_lock(lock); in unlock_lockmgr_granted()
4292 lock_descriptor_t *lock; in nbl_lock_conflict() local
4311 SET_LOCK_TO_FIRST_ACTIVE_VP(gp, lock, vp); in nbl_lock_conflict()
4313 for (; lock && lock->l_vnode == vp; lock = lock->l_next) { in nbl_lock_conflict()
4314 if ((svmand || (lock->l_state & NBMAND_LOCK)) && in nbl_lock_conflict()
4315 (lock->l_flock.l_sysid != sysid || in nbl_lock_conflict()
4316 lock->l_flock.l_pid != pid) && in nbl_lock_conflict()
4318 lock->l_type, lock->l_start, lock->l_end)) { in nbl_lock_conflict()
4354 lock_descriptor_t *lock, *lock1; in check_active_locks() local
4357 for (lock = ACTIVE_HEAD(gp)->l_next; lock != ACTIVE_HEAD(gp); in check_active_locks()
4358 lock = lock->l_next) { in check_active_locks()
4359 ASSERT(IS_ACTIVE(lock)); in check_active_locks()
4360 ASSERT(NOT_BLOCKED(lock)); in check_active_locks()
4361 ASSERT(!IS_BARRIER(lock)); in check_active_locks()
4363 ep = FIRST_IN(lock); in check_active_locks()
4365 while (ep != HEAD(lock)) { in check_active_locks()
4371 for (lock1 = lock->l_next; lock1 != ACTIVE_HEAD(gp); in check_active_locks()
4373 if (lock1->l_vnode == lock->l_vnode) { in check_active_locks()
4374 if (BLOCKS(lock1, lock)) { in check_active_locks()
4377 (void *)lock1, (void *)lock); in check_active_locks()
4378 } else if (BLOCKS(lock, lock1)) { in check_active_locks()
4381 (void *)lock, (void *)lock1); in check_active_locks()
4538 lock_descriptor_t *lock; in check_owner_locks() local
4544 SET_LOCK_TO_FIRST_ACTIVE_VP(gp, lock, vp); in check_owner_locks()
4546 if (lock) { in check_owner_locks()
4547 while (lock != ACTIVE_HEAD(gp) && (lock->l_vnode == vp)) { in check_owner_locks()
4548 if (lock->l_flock.l_pid == pid && in check_owner_locks()
4549 lock->l_flock.l_sysid == sysid) in check_owner_locks()
4552 pid, (void *)lock); in check_owner_locks()
4553 lock = lock->l_next; in check_owner_locks()
4556 SET_LOCK_TO_FIRST_SLEEP_VP(gp, lock, vp); in check_owner_locks()
4558 if (lock) { in check_owner_locks()
4559 while (lock != SLEEPING_HEAD(gp) && (lock->l_vnode == vp)) { in check_owner_locks()
4560 if (lock->l_flock.l_pid == pid && in check_owner_locks()
4561 lock->l_flock.l_sysid == sysid) in check_owner_locks()
4564 pid, (void *)lock); in check_owner_locks()
4565 lock = lock->l_next; in check_owner_locks()