Lines Matching refs:filp
232 locks_check_ctx_file_list(struct file *filp, struct list_head *list, in locks_check_ctx_file_list() argument
236 struct inode *inode = locks_inode(filp); in locks_check_ctx_file_list()
239 if (fl->fl_file == filp) in locks_check_ctx_file_list()
428 static void flock_make_lock(struct file *filp, struct file_lock *fl, int type) in flock_make_lock() argument
432 fl->fl_file = filp; in flock_make_lock()
433 fl->fl_owner = filp; in flock_make_lock()
454 static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl, in flock64_to_posix_lock() argument
462 fl->fl_start = filp->f_pos; in flock64_to_posix_lock()
465 fl->fl_start = i_size_read(file_inode(filp)); in flock64_to_posix_lock()
493 fl->fl_file = filp; in flock64_to_posix_lock()
504 static int flock_to_posix_lock(struct file *filp, struct file_lock *fl, in flock_to_posix_lock() argument
514 return flock64_to_posix_lock(filp, fl, &ll); in flock_to_posix_lock()
528 struct file *filp = fl->fl_file; in lease_setup() local
536 if (!fasync_insert_entry(fa->fa_fd, filp, &fl->fl_fasync, fa)) in lease_setup()
539 __f_setown(filp, task_pid(current), PIDTYPE_TGID, 0); in lease_setup()
551 static int lease_init(struct file *filp, long type, struct file_lock *fl) in lease_init() argument
556 fl->fl_owner = filp; in lease_init()
559 fl->fl_file = filp; in lease_init()
569 static struct file_lock *lease_alloc(struct file *filp, long type) in lease_alloc() argument
577 error = lease_init(filp, type, fl); in lease_alloc()
886 posix_test_lock(struct file *filp, struct file_lock *fl) in posix_test_lock() argument
890 struct inode *inode = locks_inode(filp); in posix_test_lock()
1330 int posix_lock_file(struct file *filp, struct file_lock *fl, in posix_lock_file() argument
1333 return posix_lock_inode(locks_inode(filp), fl, conflock); in posix_lock_file()
1382 struct file *filp = fl->fl_file; in lease_modify() local
1384 f_delown(filp); in lease_modify()
1385 filp->f_owner.signum = 0; in lease_modify()
1629 int fcntl_getlease(struct file *filp) in fcntl_getlease() argument
1632 struct inode *inode = locks_inode(filp); in fcntl_getlease()
1643 if (fl->fl_file != filp) in fcntl_getlease()
1668 check_conflicting_open(struct file *filp, const long arg, int flags) in check_conflicting_open() argument
1670 struct inode *inode = locks_inode(filp); in check_conflicting_open()
1690 if (filp->f_mode & FMODE_WRITE) in check_conflicting_open()
1692 else if (filp->f_mode & FMODE_READ) in check_conflicting_open()
1703 generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv) in generic_add_lease() argument
1706 struct inode *inode = locks_inode(filp); in generic_add_lease()
1741 error = check_conflicting_open(filp, arg, lease->fl_flags); in generic_add_lease()
1755 if (fl->fl_file == filp && in generic_add_lease()
1798 error = check_conflicting_open(filp, arg, lease->fl_flags); in generic_add_lease()
1818 static int generic_delete_lease(struct file *filp, void *owner) in generic_delete_lease() argument
1822 struct inode *inode = locks_inode(filp); in generic_delete_lease()
1835 if (fl->fl_file == filp && in generic_delete_lease()
1861 int generic_setlease(struct file *filp, long arg, struct file_lock **flp, in generic_setlease() argument
1864 struct inode *inode = locks_inode(filp); in generic_setlease()
1871 error = security_file_lock(filp, arg); in generic_setlease()
1877 return generic_delete_lease(filp, *priv); in generic_setlease()
1885 return generic_add_lease(filp, arg, flp, priv); in generic_setlease()
1968 vfs_setlease(struct file *filp, long arg, struct file_lock **lease, void **priv) in vfs_setlease() argument
1972 if (filp->f_op->setlease) in vfs_setlease()
1973 return filp->f_op->setlease(filp, arg, lease, priv); in vfs_setlease()
1975 return generic_setlease(filp, arg, lease, priv); in vfs_setlease()
1979 static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) in do_fcntl_add_lease() argument
1985 fl = lease_alloc(filp, arg); in do_fcntl_add_lease()
1996 error = vfs_setlease(filp, arg, &fl, (void **)&new); in do_fcntl_add_lease()
2014 int fcntl_setlease(unsigned int fd, struct file *filp, long arg) in fcntl_setlease() argument
2017 return vfs_setlease(filp, F_UNLCK, NULL, (void **)&filp); in fcntl_setlease()
2018 return do_fcntl_add_lease(fd, filp, arg); in fcntl_setlease()
2147 int vfs_test_lock(struct file *filp, struct file_lock *fl) in vfs_test_lock() argument
2149 if (filp->f_op->lock) in vfs_test_lock()
2150 return filp->f_op->lock(filp, F_GETLK, fl); in vfs_test_lock()
2151 posix_test_lock(filp, fl); in vfs_test_lock()
2223 int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock *flock) in fcntl_getlk() argument
2235 error = flock_to_posix_lock(filp, fl, flock); in fcntl_getlk()
2245 fl->fl_owner = filp; in fcntl_getlk()
2248 error = vfs_test_lock(filp, fl); in fcntl_getlk()
2296 int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) in vfs_lock_file() argument
2298 if (filp->f_op->lock) in vfs_lock_file()
2299 return filp->f_op->lock(filp, cmd, fl); in vfs_lock_file()
2301 return posix_lock_file(filp, fl, conf); in vfs_lock_file()
2305 static int do_lock_file_wait(struct file *filp, unsigned int cmd, in do_lock_file_wait() argument
2310 error = security_file_lock(filp, fl->fl_type); in do_lock_file_wait()
2315 error = vfs_lock_file(filp, cmd, fl, NULL); in do_lock_file_wait()
2347 int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk() argument
2351 struct inode *inode = locks_inode(filp); in fcntl_setlk()
2358 error = flock_to_posix_lock(filp, file_lock, flock); in fcntl_setlk()
2378 file_lock->fl_owner = filp; in fcntl_setlk()
2387 file_lock->fl_owner = filp; in fcntl_setlk()
2393 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2411 if (f != filp) { in fcntl_setlk()
2413 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2428 int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 *flock) in fcntl_getlk64() argument
2441 error = flock64_to_posix_lock(filp, fl, flock); in fcntl_getlk64()
2452 fl->fl_owner = filp; in fcntl_getlk64()
2455 error = vfs_test_lock(filp, fl); in fcntl_getlk64()
2471 int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk64() argument
2481 error = flock64_to_posix_lock(filp, file_lock, flock); in fcntl_setlk64()
2501 file_lock->fl_owner = filp; in fcntl_setlk64()
2510 file_lock->fl_owner = filp; in fcntl_setlk64()
2516 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2534 if (f != filp) { in fcntl_setlk64()
2536 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2552 void locks_remove_posix(struct file *filp, fl_owner_t owner) in locks_remove_posix() argument
2555 struct inode *inode = locks_inode(filp); in locks_remove_posix()
2575 lock.fl_file = filp; in locks_remove_posix()
2579 error = vfs_lock_file(filp, F_SETLK, &lock, NULL); in locks_remove_posix()
2589 locks_remove_flock(struct file *filp, struct file_lock_context *flctx) in locks_remove_flock() argument
2592 struct inode *inode = locks_inode(filp); in locks_remove_flock()
2597 flock_make_lock(filp, &fl, F_UNLCK); in locks_remove_flock()
2600 if (filp->f_op->flock) in locks_remove_flock()
2601 filp->f_op->flock(filp, F_SETLKW, &fl); in locks_remove_flock()
2611 locks_remove_lease(struct file *filp, struct file_lock_context *ctx) in locks_remove_lease() argument
2622 if (filp == fl->fl_file) in locks_remove_lease()
2633 void locks_remove_file(struct file *filp) in locks_remove_file() argument
2637 ctx = smp_load_acquire(&locks_inode(filp)->i_flctx); in locks_remove_file()
2642 locks_remove_posix(filp, filp); in locks_remove_file()
2645 locks_remove_flock(filp, ctx); in locks_remove_file()
2648 locks_remove_lease(filp, ctx); in locks_remove_file()
2651 locks_check_ctx_file_list(filp, &ctx->flc_posix, "POSIX"); in locks_remove_file()
2652 locks_check_ctx_file_list(filp, &ctx->flc_flock, "FLOCK"); in locks_remove_file()
2653 locks_check_ctx_file_list(filp, &ctx->flc_lease, "LEASE"); in locks_remove_file()
2664 int vfs_cancel_lock(struct file *filp, struct file_lock *fl) in vfs_cancel_lock() argument
2666 if (filp->f_op->lock) in vfs_cancel_lock()
2667 return filp->f_op->lock(filp, F_CANCELLK, fl); in vfs_cancel_lock()
2817 struct file *filp, struct files_struct *files) in __show_fd_locks() argument
2823 if (filp != fl->fl_file) in __show_fd_locks()
2826 fl->fl_owner != filp) in __show_fd_locks()
2836 struct file *filp, struct files_struct *files) in show_fd_locks() argument
2838 struct inode *inode = locks_inode(filp); in show_fd_locks()
2847 __show_fd_locks(f, &ctx->flc_flock, &id, filp, files); in show_fd_locks()
2848 __show_fd_locks(f, &ctx->flc_posix, &id, filp, files); in show_fd_locks()
2849 __show_fd_locks(f, &ctx->flc_lease, &id, filp, files); in show_fd_locks()