Lines Matching defs:file_lock

72 static struct file_lock *file_lock(struct file_lock_core *flc)
74 return container_of(flc, struct file_lock, c);
162 * fl->fl_blocker pointer for file_lock structures that are acting as lock
273 struct file_lock *locks_alloc_lock(void)
275 struct file_lock *fl = kmem_cache_zalloc(filelock_cache, GFP_KERNEL);
296 void locks_release_private(struct file_lock *fl)
350 void locks_free_lock(struct file_lock *fl)
375 locks_free_lock(file_lock(flc));
379 void locks_init_lock(struct file_lock *fl)
381 memset(fl, 0, sizeof(struct file_lock));
394 * Initialize a new lock from an existing file_lock structure.
396 void locks_copy_conflock(struct file_lock *new, struct file_lock *fl)
415 void locks_copy_lock(struct file_lock *new, struct file_lock *fl)
432 static void locks_move_blocks(struct file_lock *new, struct file_lock *fl)
434 struct file_lock *f;
464 /* Fill in a file_lock structure with an appropriate FLOCK lock. */
465 static void flock_make_lock(struct file *filp, struct file_lock *fl, int type)
491 static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,
538 /* Verify a "struct flock" and copy it to a "struct file_lock" as a POSIX
541 static int flock_to_posix_lock(struct file *filp, struct file_lock *fl,
602 /* Allocate a file_lock initialised to this type of lease */
621 static inline int locks_overlap(struct file_lock *fl1, struct file_lock *fl2)
704 struct file_lock *fl;
709 fl = file_lock(waiter);
776 int locks_delete_block(struct file_lock *waiter)
880 locks_free_lock(file_lock(fl));
902 struct file_lock *caller_fl = file_lock(caller_flc);
903 struct file_lock *sys_fl = file_lock(sys_flc);
921 static bool posix_test_locks_conflict(struct file_lock *caller_fl,
922 struct file_lock *sys_fl)
952 posix_test_lock(struct file *filp, struct file_lock *fl)
954 struct file_lock *cfl;
1042 static bool posix_locks_deadlock(struct file_lock *caller_fl,
1043 struct file_lock *block_fl)
1074 static int flock_lock_inode(struct inode *inode, struct file_lock *request)
1076 struct file_lock *new_fl = NULL;
1077 struct file_lock *fl;
1146 static int posix_lock_inode(struct inode *inode, struct file_lock *request,
1147 struct file_lock *conflock)
1149 struct file_lock *fl, *tmp;
1150 struct file_lock *new_fl = NULL;
1151 struct file_lock *new_fl2 = NULL;
1152 struct file_lock *left = NULL;
1153 struct file_lock *right = NULL;
1166 * We may need two file_lock structures for this operation,
1399 int posix_lock_file(struct file *filp, struct file_lock *fl,
1400 struct file_lock *conflock)
1413 static int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
1918 * @flp: input - file_lock to use, output - file_lock inserted
1995 * @lease: file_lock to use when adding a lease
2075 static int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
2099 int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl)
2134 struct file_lock fl;
2194 int vfs_test_lock(struct file *filp, struct file_lock *fl)
2205 * locks_translate_pid - translate a file_lock's fl_pid number into a namespace
2206 * @fl: The file_lock who's fl_pid should be translated
2238 static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl)
2260 static void posix_lock_to_flock64(struct flock64 *flock, struct file_lock *fl)
2276 struct file_lock *fl;
2350 int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf)
2361 struct file_lock *fl)
2385 check_fmode_for_setlk(struct file_lock *fl)
2405 struct file_lock *file_lock = locks_alloc_lock();
2410 if (file_lock == NULL)
2413 error = flock_to_posix_lock(filp, file_lock, flock);
2417 error = check_fmode_for_setlk(file_lock);
2432 file_lock->c.flc_flags |= FL_OFDLCK;
2433 file_lock->c.flc_owner = filp;
2441 file_lock->c.flc_flags |= FL_OFDLCK;
2442 file_lock->c.flc_owner = filp;
2445 file_lock->c.flc_flags |= FL_SLEEP;
2448 error = do_lock_file_wait(filp, cmd, file_lock);
2455 if (!error && file_lock->c.flc_type != F_UNLCK &&
2456 !(file_lock->c.flc_flags & FL_OFDLCK)) {
2463 spin_lock(&files->file_lock);
2465 spin_unlock(&files->file_lock);
2467 file_lock->c.flc_type = F_UNLCK;
2468 error = do_lock_file_wait(filp, cmd, file_lock);
2474 trace_fcntl_setlk(inode, file_lock, error);
2475 locks_free_lock(file_lock);
2485 struct file_lock *fl;
2529 struct file_lock *file_lock = locks_alloc_lock();
2533 if (file_lock == NULL)
2536 error = flock64_to_posix_lock(filp, file_lock, flock);
2540 error = check_fmode_for_setlk(file_lock);
2555 file_lock->c.flc_flags |= FL_OFDLCK;
2556 file_lock->c.flc_owner = filp;
2564 file_lock->c.flc_flags |= FL_OFDLCK;
2565 file_lock->c.flc_owner = filp;
2568 file_lock->c.flc_flags |= FL_SLEEP;
2571 error = do_lock_file_wait(filp, cmd, file_lock);
2578 if (!error && file_lock->c.flc_type != F_UNLCK &&
2579 !(file_lock->c.flc_flags & FL_OFDLCK)) {
2586 spin_lock(&files->file_lock);
2588 spin_unlock(&files->file_lock);
2590 file_lock->c.flc_type = F_UNLCK;
2591 error = do_lock_file_wait(filp, cmd, file_lock);
2597 locks_free_lock(file_lock);
2611 struct file_lock lock;
2646 struct file_lock fl;
2719 int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
2767 struct file_lock *fl = file_lock(flc);
2987 sizeof(struct file_lock), 0, SLAB_PANIC, NULL);