Lines Matching refs:file_lock
183 static bool lease_breaking(struct file_lock *fl) in lease_breaking()
188 static int target_leasetype(struct file_lock *fl) in target_leasetype()
283 struct file_lock *fl; in locks_dump_ctx_list()
311 struct file_lock *fl; in locks_check_ctx_file_list()
334 static void locks_init_lock_heads(struct file_lock *fl) in locks_init_lock_heads()
344 struct file_lock *locks_alloc_lock(void) in locks_alloc_lock()
346 struct file_lock *fl = kmem_cache_zalloc(filelock_cache, GFP_KERNEL); in locks_alloc_lock()
355 void locks_release_private(struct file_lock *fl) in locks_release_private()
380 void locks_free_lock(struct file_lock *fl) in locks_free_lock()
390 struct file_lock *fl; in locks_dispose_list()
393 fl = list_first_entry(dispose, struct file_lock, fl_list); in locks_dispose_list()
399 void locks_init_lock(struct file_lock *fl) in locks_init_lock()
401 memset(fl, 0, sizeof(struct file_lock)); in locks_init_lock()
409 void locks_copy_conflock(struct file_lock *new, struct file_lock *fl) in locks_copy_conflock()
428 void locks_copy_lock(struct file_lock *new, struct file_lock *fl) in locks_copy_lock()
445 static void locks_move_blocks(struct file_lock *new, struct file_lock *fl) in locks_move_blocks()
447 struct file_lock *f; in locks_move_blocks()
478 static struct file_lock *
479 flock_make_lock(struct file *filp, unsigned int cmd, struct file_lock *fl) in flock_make_lock()
504 static int assign_type(struct file_lock *fl, long type) in assign_type()
518 static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl, in flock64_to_posix_lock()
568 static int flock_to_posix_lock(struct file *filp, struct file_lock *fl, in flock_to_posix_lock()
583 lease_break_callback(struct file_lock *fl) in lease_break_callback()
590 lease_setup(struct file_lock *fl, void **priv) in lease_setup()
615 static int lease_init(struct file *filp, long type, struct file_lock *fl) in lease_init()
633 static struct file_lock *lease_alloc(struct file *filp, long type) in lease_alloc()
635 struct file_lock *fl = locks_alloc_lock(); in lease_alloc()
651 static inline int locks_overlap(struct file_lock *fl1, struct file_lock *fl2) in locks_overlap()
660 static int posix_same_owner(struct file_lock *fl1, struct file_lock *fl2) in posix_same_owner()
666 static void locks_insert_global_locks(struct file_lock *fl) in locks_insert_global_locks()
679 static void locks_delete_global_locks(struct file_lock *fl) in locks_delete_global_locks()
700 posix_owner_key(struct file_lock *fl) in posix_owner_key()
705 static void locks_insert_global_blocked(struct file_lock *waiter) in locks_insert_global_blocked()
712 static void locks_delete_global_blocked(struct file_lock *waiter) in locks_delete_global_blocked()
724 static void __locks_delete_block(struct file_lock *waiter) in __locks_delete_block()
731 static void __locks_wake_up_blocks(struct file_lock *blocker) in __locks_wake_up_blocks()
734 struct file_lock *waiter; in __locks_wake_up_blocks()
737 struct file_lock, fl_blocked_member); in __locks_wake_up_blocks()
752 int locks_delete_block(struct file_lock *waiter) in locks_delete_block()
795 static void __locks_insert_block(struct file_lock *blocker, in __locks_insert_block() argument
796 struct file_lock *waiter, in __locks_insert_block()
797 bool conflict(struct file_lock *, in __locks_insert_block() argument
798 struct file_lock *)) in __locks_insert_block()
800 struct file_lock *fl; in __locks_insert_block()
822 static void locks_insert_block(struct file_lock *blocker, in locks_insert_block() argument
823 struct file_lock *waiter, in locks_insert_block()
824 bool conflict(struct file_lock *, in locks_insert_block() argument
825 struct file_lock *)) in locks_insert_block()
837 static void locks_wake_up_blocks(struct file_lock *blocker) in locks_wake_up_blocks()
855 locks_insert_lock_ctx(struct file_lock *fl, struct list_head *before) in locks_insert_lock_ctx()
862 locks_unlink_lock_ctx(struct file_lock *fl) in locks_unlink_lock_ctx()
870 locks_delete_lock_ctx(struct file_lock *fl, struct list_head *dispose) in locks_delete_lock_ctx()
882 static bool locks_conflict(struct file_lock *caller_fl, in locks_conflict()
883 struct file_lock *sys_fl) in locks_conflict()
895 static bool posix_locks_conflict(struct file_lock *caller_fl, in posix_locks_conflict()
896 struct file_lock *sys_fl) in posix_locks_conflict()
914 static bool flock_locks_conflict(struct file_lock *caller_fl, in flock_locks_conflict()
915 struct file_lock *sys_fl) in flock_locks_conflict()
929 posix_test_lock(struct file *filp, struct file_lock *fl) in posix_test_lock()
931 struct file_lock *cfl; in posix_test_lock()
991 static struct file_lock *what_owner_is_waiting_for(struct file_lock *block_fl) in what_owner_is_waiting_for()
993 struct file_lock *fl; in what_owner_is_waiting_for()
1006 static int posix_locks_deadlock(struct file_lock *caller_fl, in posix_locks_deadlock()
1007 struct file_lock *block_fl) in posix_locks_deadlock()
1036 static int flock_lock_inode(struct inode *inode, struct file_lock *request) in flock_lock_inode()
1038 struct file_lock *new_fl = NULL; in flock_lock_inode()
1039 struct file_lock *fl; in flock_lock_inode()
1108 static int posix_lock_inode(struct inode *inode, struct file_lock *request, in posix_lock_inode()
1109 struct file_lock *conflock) in posix_lock_inode()
1111 struct file_lock *fl, *tmp; in posix_lock_inode()
1112 struct file_lock *new_fl = NULL; in posix_lock_inode()
1113 struct file_lock *new_fl2 = NULL; in posix_lock_inode()
1114 struct file_lock *left = NULL; in posix_lock_inode()
1115 struct file_lock *right = NULL; in posix_lock_inode()
1345 int posix_lock_file(struct file *filp, struct file_lock *fl, in posix_lock_file()
1346 struct file_lock *conflock) in posix_lock_file()
1359 static int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl) in posix_lock_inode_wait()
1388 struct file_lock *fl; in locks_mandatory_locked()
1423 struct file_lock fl; in locks_mandatory_area()
1471 static void lease_clear_pending(struct file_lock *fl, int arg) in lease_clear_pending()
1483 int lease_modify(struct file_lock *fl, int arg, struct list_head *dispose) in lease_modify()
1518 struct file_lock *fl, *tmp; in time_out_leases()
1531 static bool leases_conflict(struct file_lock *lease, struct file_lock *breaker) in leases_conflict()
1551 any_leases_conflict(struct inode *inode, struct file_lock *breaker) in any_leases_conflict()
1554 struct file_lock *fl; in any_leases_conflict()
1582 struct file_lock *new_fl, *fl, *tmp; in __break_lease()
1642 fl = list_first_entry(&ctx->flc_lease, struct file_lock, fl_list); in __break_lease()
1695 struct file_lock *fl; in lease_get_mtime()
1701 struct file_lock, fl_list); in lease_get_mtime()
1737 struct file_lock *fl; in fcntl_getlease()
1806 generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv) in generic_add_lease()
1808 struct file_lock *fl, *my_fl = NULL, *lease; in generic_add_lease()
1924 struct file_lock *fl, *victim = NULL; in generic_delete_lease()
1964 int generic_setlease(struct file *filp, long arg, struct file_lock **flp, in generic_setlease()
2011 setlease_notifier(long arg, struct file_lock *lease) in setlease_notifier()
2036 setlease_notifier(long arg, struct file_lock *lease) in setlease_notifier()
2071 vfs_setlease(struct file *filp, long arg, struct file_lock **lease, void **priv) in vfs_setlease()
2084 struct file_lock *fl; in do_fcntl_add_lease()
2131 static int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl) in flock_lock_inode_wait()
2154 int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl) in locks_lock_inode_wait()
2191 struct file_lock *lock; in SYSCALL_DEFINE2()
2244 int vfs_test_lock(struct file *filp, struct file_lock *fl) in vfs_test_lock()
2260 static pid_t locks_translate_pid(struct file_lock *fl, struct pid_namespace *ns) in locks_translate_pid()
2284 static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl) in posix_lock_to_flock()
2306 static void posix_lock_to_flock64(struct flock64 *flock, struct file_lock *fl) in posix_lock_to_flock64()
2322 struct file_lock *fl; in fcntl_getlk()
2394 int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) in vfs_lock_file()
2404 struct file_lock *fl) in do_lock_file_wait()
2427 check_fmode_for_setlk(struct file_lock *fl) in check_fmode_for_setlk()
2447 struct file_lock *file_lock = locks_alloc_lock(); in fcntl_setlk() local
2452 if (file_lock == NULL) in fcntl_setlk()
2463 error = flock_to_posix_lock(filp, file_lock, flock); in fcntl_setlk()
2467 error = check_fmode_for_setlk(file_lock); in fcntl_setlk()
2482 file_lock->fl_flags |= FL_OFDLCK; in fcntl_setlk()
2483 file_lock->fl_owner = filp; in fcntl_setlk()
2491 file_lock->fl_flags |= FL_OFDLCK; in fcntl_setlk()
2492 file_lock->fl_owner = filp; in fcntl_setlk()
2495 file_lock->fl_flags |= FL_SLEEP; in fcntl_setlk()
2498 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2505 if (!error && file_lock->fl_type != F_UNLCK && in fcntl_setlk()
2506 !(file_lock->fl_flags & FL_OFDLCK)) { in fcntl_setlk()
2512 spin_lock(¤t->files->file_lock); in fcntl_setlk()
2514 spin_unlock(¤t->files->file_lock); in fcntl_setlk()
2516 file_lock->fl_type = F_UNLCK; in fcntl_setlk()
2517 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2523 trace_fcntl_setlk(inode, file_lock, error); in fcntl_setlk()
2524 locks_free_lock(file_lock); in fcntl_setlk()
2534 struct file_lock *fl; in fcntl_getlk64()
2578 struct file_lock *file_lock = locks_alloc_lock(); in fcntl_setlk64() local
2583 if (file_lock == NULL) in fcntl_setlk64()
2594 error = flock64_to_posix_lock(filp, file_lock, flock); in fcntl_setlk64()
2598 error = check_fmode_for_setlk(file_lock); in fcntl_setlk64()
2613 file_lock->fl_flags |= FL_OFDLCK; in fcntl_setlk64()
2614 file_lock->fl_owner = filp; in fcntl_setlk64()
2622 file_lock->fl_flags |= FL_OFDLCK; in fcntl_setlk64()
2623 file_lock->fl_owner = filp; in fcntl_setlk64()
2626 file_lock->fl_flags |= FL_SLEEP; in fcntl_setlk64()
2629 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2636 if (!error && file_lock->fl_type != F_UNLCK && in fcntl_setlk64()
2637 !(file_lock->fl_flags & FL_OFDLCK)) { in fcntl_setlk64()
2643 spin_lock(¤t->files->file_lock); in fcntl_setlk64()
2645 spin_unlock(¤t->files->file_lock); in fcntl_setlk64()
2647 file_lock->fl_type = F_UNLCK; in fcntl_setlk64()
2648 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2654 locks_free_lock(file_lock); in fcntl_setlk64()
2668 struct file_lock lock; in locks_remove_posix()
2703 struct file_lock fl; in locks_remove_flock()
2725 struct file_lock *fl, *tmp; in locks_remove_lease()
2776 int vfs_cancel_lock(struct file *filp, struct file_lock *fl) in vfs_cancel_lock()
2793 static void lock_get_status(struct seq_file *f, struct file_lock *fl, in lock_get_status()
2875 struct file_lock *fl, *bfl; in locks_show()
2878 fl = hlist_entry(v, struct file_lock, fl_link); in locks_show()
2895 struct file_lock *fl; in __show_fd_locks()
2979 sizeof(struct file_lock), 0, SLAB_PANIC, NULL); in filelock_init()