Lines Matching refs:ctx
251 struct file_lock_context *ctx; in locks_get_lock_context() local
254 ctx = smp_load_acquire(&inode->i_flctx); in locks_get_lock_context()
255 if (likely(ctx) || type == F_UNLCK) in locks_get_lock_context()
258 ctx = kmem_cache_alloc(flctx_cache, GFP_KERNEL); in locks_get_lock_context()
259 if (!ctx) in locks_get_lock_context()
262 spin_lock_init(&ctx->flc_lock); in locks_get_lock_context()
263 INIT_LIST_HEAD(&ctx->flc_flock); in locks_get_lock_context()
264 INIT_LIST_HEAD(&ctx->flc_posix); in locks_get_lock_context()
265 INIT_LIST_HEAD(&ctx->flc_lease); in locks_get_lock_context()
271 if (cmpxchg(&inode->i_flctx, NULL, ctx)) { in locks_get_lock_context()
272 kmem_cache_free(flctx_cache, ctx); in locks_get_lock_context()
273 ctx = smp_load_acquire(&inode->i_flctx); in locks_get_lock_context()
276 trace_locks_get_lock_context(inode, type, ctx); in locks_get_lock_context()
277 return ctx; in locks_get_lock_context()
293 struct file_lock_context *ctx = inode->i_flctx; in locks_check_ctx_lists() local
295 if (unlikely(!list_empty(&ctx->flc_flock) || in locks_check_ctx_lists()
296 !list_empty(&ctx->flc_posix) || in locks_check_ctx_lists()
297 !list_empty(&ctx->flc_lease))) { in locks_check_ctx_lists()
301 locks_dump_ctx_list(&ctx->flc_flock, "FLOCK"); in locks_check_ctx_lists()
302 locks_dump_ctx_list(&ctx->flc_posix, "POSIX"); in locks_check_ctx_lists()
303 locks_dump_ctx_list(&ctx->flc_lease, "LEASE"); in locks_check_ctx_lists()
326 struct file_lock_context *ctx = inode->i_flctx; in locks_free_lock_context() local
328 if (unlikely(ctx)) { in locks_free_lock_context()
330 kmem_cache_free(flctx_cache, ctx); in locks_free_lock_context()
932 struct file_lock_context *ctx; in posix_test_lock() local
935 ctx = smp_load_acquire(&inode->i_flctx); in posix_test_lock()
936 if (!ctx || list_empty_careful(&ctx->flc_posix)) { in posix_test_lock()
941 spin_lock(&ctx->flc_lock); in posix_test_lock()
942 list_for_each_entry(cfl, &ctx->flc_posix, fl_list) { in posix_test_lock()
950 spin_unlock(&ctx->flc_lock); in posix_test_lock()
1040 struct file_lock_context *ctx; in flock_lock_inode() local
1045 ctx = locks_get_lock_context(inode, request->fl_type); in flock_lock_inode()
1046 if (!ctx) { in flock_lock_inode()
1059 spin_lock(&ctx->flc_lock); in flock_lock_inode()
1063 list_for_each_entry(fl, &ctx->flc_flock, fl_list) { in flock_lock_inode()
1080 list_for_each_entry(fl, &ctx->flc_flock, fl_list) { in flock_lock_inode()
1094 locks_insert_lock_ctx(new_fl, &ctx->flc_flock); in flock_lock_inode()
1099 spin_unlock(&ctx->flc_lock); in flock_lock_inode()
1116 struct file_lock_context *ctx; in posix_lock_inode() local
1121 ctx = locks_get_lock_context(inode, request->fl_type); in posix_lock_inode()
1122 if (!ctx) in posix_lock_inode()
1139 spin_lock(&ctx->flc_lock); in posix_lock_inode()
1146 list_for_each_entry(fl, &ctx->flc_posix, fl_list) { in posix_lock_inode()
1181 list_for_each_entry(fl, &ctx->flc_posix, fl_list) { in posix_lock_inode()
1187 list_for_each_entry_safe_from(fl, tmp, &ctx->flc_posix, fl_list) { in posix_lock_inode()
1316 spin_unlock(&ctx->flc_lock); in posix_lock_inode()
1387 struct file_lock_context *ctx; in locks_mandatory_locked() local
1390 ctx = smp_load_acquire(&inode->i_flctx); in locks_mandatory_locked()
1391 if (!ctx || list_empty_careful(&ctx->flc_posix)) in locks_mandatory_locked()
1397 spin_lock(&ctx->flc_lock); in locks_mandatory_locked()
1399 list_for_each_entry(fl, &ctx->flc_posix, fl_list) { in locks_mandatory_locked()
1406 spin_unlock(&ctx->flc_lock); in locks_mandatory_locked()
1517 struct file_lock_context *ctx = inode->i_flctx; in time_out_leases() local
1520 lockdep_assert_held(&ctx->flc_lock); in time_out_leases()
1522 list_for_each_entry_safe(fl, tmp, &ctx->flc_lease, fl_list) { in time_out_leases()
1553 struct file_lock_context *ctx = inode->i_flctx; in any_leases_conflict() local
1556 lockdep_assert_held(&ctx->flc_lock); in any_leases_conflict()
1558 list_for_each_entry(fl, &ctx->flc_lease, fl_list) { in any_leases_conflict()
1581 struct file_lock_context *ctx; in __break_lease() local
1593 ctx = smp_load_acquire(&inode->i_flctx); in __break_lease()
1594 if (!ctx) { in __break_lease()
1600 spin_lock(&ctx->flc_lock); in __break_lease()
1614 list_for_each_entry_safe(fl, tmp, &ctx->flc_lease, fl_list) { in __break_lease()
1632 if (list_empty(&ctx->flc_lease)) in __break_lease()
1642 fl = list_first_entry(&ctx->flc_lease, struct file_lock, fl_list); in __break_lease()
1650 spin_unlock(&ctx->flc_lock); in __break_lease()
1658 spin_lock(&ctx->flc_lock); in __break_lease()
1673 spin_unlock(&ctx->flc_lock); in __break_lease()
1694 struct file_lock_context *ctx; in lease_get_mtime() local
1697 ctx = smp_load_acquire(&inode->i_flctx); in lease_get_mtime()
1698 if (ctx && !list_empty_careful(&ctx->flc_lease)) { in lease_get_mtime()
1699 spin_lock(&ctx->flc_lock); in lease_get_mtime()
1700 fl = list_first_entry_or_null(&ctx->flc_lease, in lease_get_mtime()
1704 spin_unlock(&ctx->flc_lock); in lease_get_mtime()
1739 struct file_lock_context *ctx; in fcntl_getlease() local
1743 ctx = smp_load_acquire(&inode->i_flctx); in fcntl_getlease()
1744 if (ctx && !list_empty_careful(&ctx->flc_lease)) { in fcntl_getlease()
1746 spin_lock(&ctx->flc_lock); in fcntl_getlease()
1748 list_for_each_entry(fl, &ctx->flc_lease, fl_list) { in fcntl_getlease()
1754 spin_unlock(&ctx->flc_lock); in fcntl_getlease()
1810 struct file_lock_context *ctx; in generic_add_lease() local
1819 ctx = locks_get_lock_context(inode, arg); in generic_add_lease()
1820 if (!ctx) in generic_add_lease()
1842 spin_lock(&ctx->flc_lock); in generic_add_lease()
1857 list_for_each_entry(fl, &ctx->flc_lease, fl_list) { in generic_add_lease()
1890 locks_insert_lock_ctx(lease, &ctx->flc_lease); in generic_add_lease()
1911 spin_unlock(&ctx->flc_lock); in generic_add_lease()
1926 struct file_lock_context *ctx; in generic_delete_lease() local
1929 ctx = smp_load_acquire(&inode->i_flctx); in generic_delete_lease()
1930 if (!ctx) { in generic_delete_lease()
1936 spin_lock(&ctx->flc_lock); in generic_delete_lease()
1937 list_for_each_entry(fl, &ctx->flc_lease, fl_list) { in generic_delete_lease()
1947 spin_unlock(&ctx->flc_lock); in generic_delete_lease()
2669 struct file_lock_context *ctx; in locks_remove_posix() local
2676 ctx = smp_load_acquire(&inode->i_flctx); in locks_remove_posix()
2677 if (!ctx || list_empty(&ctx->flc_posix)) in locks_remove_posix()
2723 locks_remove_lease(struct file *filp, struct file_lock_context *ctx) in locks_remove_lease() argument
2728 if (list_empty(&ctx->flc_lease)) in locks_remove_lease()
2732 spin_lock(&ctx->flc_lock); in locks_remove_lease()
2733 list_for_each_entry_safe(fl, tmp, &ctx->flc_lease, fl_list) in locks_remove_lease()
2736 spin_unlock(&ctx->flc_lock); in locks_remove_lease()
2747 struct file_lock_context *ctx; in locks_remove_file() local
2749 ctx = smp_load_acquire(&locks_inode(filp)->i_flctx); in locks_remove_file()
2750 if (!ctx) in locks_remove_file()
2757 locks_remove_flock(filp, ctx); in locks_remove_file()
2760 locks_remove_lease(filp, ctx); in locks_remove_file()
2762 spin_lock(&ctx->flc_lock); in locks_remove_file()
2763 locks_check_ctx_file_list(filp, &ctx->flc_posix, "POSIX"); in locks_remove_file()
2764 locks_check_ctx_file_list(filp, &ctx->flc_flock, "FLOCK"); in locks_remove_file()
2765 locks_check_ctx_file_list(filp, &ctx->flc_lease, "LEASE"); in locks_remove_file()
2766 spin_unlock(&ctx->flc_lock); in locks_remove_file()
2915 struct file_lock_context *ctx; in show_fd_locks() local
2918 ctx = smp_load_acquire(&inode->i_flctx); in show_fd_locks()
2919 if (!ctx) in show_fd_locks()
2922 spin_lock(&ctx->flc_lock); in show_fd_locks()
2923 __show_fd_locks(f, &ctx->flc_flock, &id, filp, files); in show_fd_locks()
2924 __show_fd_locks(f, &ctx->flc_posix, &id, filp, files); in show_fd_locks()
2925 __show_fd_locks(f, &ctx->flc_lease, &id, filp, files); in show_fd_locks()
2926 spin_unlock(&ctx->flc_lock); in show_fd_locks()