Lines Matching refs:filp
308 locks_check_ctx_file_list(struct file *filp, struct list_head *list, in locks_check_ctx_file_list() argument
312 struct inode *inode = locks_inode(filp); in locks_check_ctx_file_list()
315 if (fl->fl_file == filp) in locks_check_ctx_file_list()
479 flock_make_lock(struct file *filp, unsigned int cmd, struct file_lock *fl) in flock_make_lock() argument
494 fl->fl_file = filp; in flock_make_lock()
495 fl->fl_owner = filp; in flock_make_lock()
518 static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl, in flock64_to_posix_lock() argument
526 fl->fl_start = filp->f_pos; in flock64_to_posix_lock()
529 fl->fl_start = i_size_read(file_inode(filp)); in flock64_to_posix_lock()
557 fl->fl_file = filp; in flock64_to_posix_lock()
568 static int flock_to_posix_lock(struct file *filp, struct file_lock *fl, in flock_to_posix_lock() argument
578 return flock64_to_posix_lock(filp, fl, &ll); in flock_to_posix_lock()
592 struct file *filp = fl->fl_file; in lease_setup() local
600 if (!fasync_insert_entry(fa->fa_fd, filp, &fl->fl_fasync, fa)) in lease_setup()
603 __f_setown(filp, task_pid(current), PIDTYPE_TGID, 0); in lease_setup()
615 static int lease_init(struct file *filp, long type, struct file_lock *fl) in lease_init() argument
620 fl->fl_owner = filp; in lease_init()
623 fl->fl_file = filp; in lease_init()
633 static struct file_lock *lease_alloc(struct file *filp, long type) in lease_alloc() argument
641 error = lease_init(filp, type, fl); in lease_alloc()
929 posix_test_lock(struct file *filp, struct file_lock *fl) in posix_test_lock() argument
933 struct inode *inode = locks_inode(filp); in posix_test_lock()
1345 int posix_lock_file(struct file *filp, struct file_lock *fl, in posix_lock_file() argument
1348 return posix_lock_inode(locks_inode(filp), fl, conflock); in posix_lock_file()
1420 int locks_mandatory_area(struct inode *inode, struct file *filp, loff_t start, in locks_mandatory_area() argument
1429 fl.fl_file = filp; in locks_mandatory_area()
1431 if (filp && !(filp->f_flags & O_NONBLOCK)) in locks_mandatory_area()
1438 if (filp) { in locks_mandatory_area()
1439 fl.fl_owner = filp; in locks_mandatory_area()
1492 struct file *filp = fl->fl_file; in lease_modify() local
1494 f_delown(filp); in lease_modify()
1495 filp->f_owner.signum = 0; in lease_modify()
1735 int fcntl_getlease(struct file *filp) in fcntl_getlease() argument
1738 struct inode *inode = locks_inode(filp); in fcntl_getlease()
1749 if (fl->fl_file != filp) in fcntl_getlease()
1774 check_conflicting_open(struct file *filp, const long arg, int flags) in check_conflicting_open() argument
1776 struct inode *inode = locks_inode(filp); in check_conflicting_open()
1793 if (filp->f_mode & FMODE_WRITE) in check_conflicting_open()
1795 else if (filp->f_mode & FMODE_READ) in check_conflicting_open()
1806 generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv) in generic_add_lease() argument
1809 struct inode *inode = locks_inode(filp); in generic_add_lease()
1844 error = check_conflicting_open(filp, arg, lease->fl_flags); in generic_add_lease()
1858 if (fl->fl_file == filp && in generic_add_lease()
1901 error = check_conflicting_open(filp, arg, lease->fl_flags); in generic_add_lease()
1921 static int generic_delete_lease(struct file *filp, void *owner) in generic_delete_lease() argument
1925 struct inode *inode = locks_inode(filp); in generic_delete_lease()
1938 if (fl->fl_file == filp && in generic_delete_lease()
1964 int generic_setlease(struct file *filp, long arg, struct file_lock **flp, in generic_setlease() argument
1967 struct inode *inode = locks_inode(filp); in generic_setlease()
1974 error = security_file_lock(filp, arg); in generic_setlease()
1980 return generic_delete_lease(filp, *priv); in generic_setlease()
1988 return generic_add_lease(filp, arg, flp, priv); in generic_setlease()
2071 vfs_setlease(struct file *filp, long arg, struct file_lock **lease, void **priv) in vfs_setlease() argument
2075 if (filp->f_op->setlease) in vfs_setlease()
2076 return filp->f_op->setlease(filp, arg, lease, priv); in vfs_setlease()
2078 return generic_setlease(filp, arg, lease, priv); in vfs_setlease()
2082 static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) in do_fcntl_add_lease() argument
2088 fl = lease_alloc(filp, arg); in do_fcntl_add_lease()
2099 error = vfs_setlease(filp, arg, &fl, (void **)&new); in do_fcntl_add_lease()
2117 int fcntl_setlease(unsigned int fd, struct file *filp, long arg) in fcntl_setlease() argument
2120 return vfs_setlease(filp, F_UNLCK, NULL, (void **)&filp); in fcntl_setlease()
2121 return do_fcntl_add_lease(fd, filp, arg); in fcntl_setlease()
2244 int vfs_test_lock(struct file *filp, struct file_lock *fl) in vfs_test_lock() argument
2246 if (filp->f_op->lock) in vfs_test_lock()
2247 return filp->f_op->lock(filp, F_GETLK, fl); in vfs_test_lock()
2248 posix_test_lock(filp, fl); in vfs_test_lock()
2320 int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock *flock) in fcntl_getlk() argument
2332 error = flock_to_posix_lock(filp, fl, flock); in fcntl_getlk()
2343 fl->fl_owner = filp; in fcntl_getlk()
2346 error = vfs_test_lock(filp, 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() argument
2396 if (filp->f_op->lock) in vfs_lock_file()
2397 return filp->f_op->lock(filp, cmd, fl); in vfs_lock_file()
2399 return posix_lock_file(filp, fl, conf); in vfs_lock_file()
2403 static int do_lock_file_wait(struct file *filp, unsigned int cmd, in do_lock_file_wait() argument
2408 error = security_file_lock(filp, fl->fl_type); in do_lock_file_wait()
2413 error = vfs_lock_file(filp, cmd, fl, NULL); in do_lock_file_wait()
2444 int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk() argument
2448 struct inode *inode = locks_inode(filp); in fcntl_setlk()
2458 if (mandatory_lock(inode) && mapping_writably_mapped(filp->f_mapping)) { in fcntl_setlk()
2463 error = flock_to_posix_lock(filp, file_lock, flock); in fcntl_setlk()
2483 file_lock->fl_owner = filp; in fcntl_setlk()
2492 file_lock->fl_owner = filp; in fcntl_setlk()
2498 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2515 if (f != filp) { in fcntl_setlk()
2517 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2532 int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 *flock) in fcntl_getlk64() argument
2545 error = flock64_to_posix_lock(filp, fl, flock); in fcntl_getlk64()
2556 fl->fl_owner = filp; in fcntl_getlk64()
2559 error = vfs_test_lock(filp, fl); in fcntl_getlk64()
2575 int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk64() argument
2579 struct inode *inode = locks_inode(filp); in fcntl_setlk64()
2589 if (mandatory_lock(inode) && mapping_writably_mapped(filp->f_mapping)) { in fcntl_setlk64()
2594 error = flock64_to_posix_lock(filp, file_lock, flock); in fcntl_setlk64()
2614 file_lock->fl_owner = filp; in fcntl_setlk64()
2623 file_lock->fl_owner = filp; in fcntl_setlk64()
2629 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2646 if (f != filp) { in fcntl_setlk64()
2648 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2664 void locks_remove_posix(struct file *filp, fl_owner_t owner) in locks_remove_posix() argument
2667 struct inode *inode = locks_inode(filp); in locks_remove_posix()
2687 lock.fl_file = filp; in locks_remove_posix()
2691 error = vfs_lock_file(filp, F_SETLK, &lock, NULL); in locks_remove_posix()
2701 locks_remove_flock(struct file *filp, struct file_lock_context *flctx) in locks_remove_flock() argument
2704 struct inode *inode = locks_inode(filp); in locks_remove_flock()
2709 flock_make_lock(filp, LOCK_UN, &fl); in locks_remove_flock()
2712 if (filp->f_op->flock) in locks_remove_flock()
2713 filp->f_op->flock(filp, F_SETLKW, &fl); in locks_remove_flock()
2723 locks_remove_lease(struct file *filp, struct file_lock_context *ctx) in locks_remove_lease() argument
2734 if (filp == fl->fl_file) in locks_remove_lease()
2745 void locks_remove_file(struct file *filp) in locks_remove_file() argument
2749 ctx = smp_load_acquire(&locks_inode(filp)->i_flctx); in locks_remove_file()
2754 locks_remove_posix(filp, filp); in locks_remove_file()
2757 locks_remove_flock(filp, ctx); in locks_remove_file()
2760 locks_remove_lease(filp, ctx); 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()
2776 int vfs_cancel_lock(struct file *filp, struct file_lock *fl) in vfs_cancel_lock() argument
2778 if (filp->f_op->lock) in vfs_cancel_lock()
2779 return filp->f_op->lock(filp, F_CANCELLK, fl); in vfs_cancel_lock()
2893 struct file *filp, struct files_struct *files) in __show_fd_locks() argument
2899 if (filp != fl->fl_file) in __show_fd_locks()
2902 fl->fl_owner != filp) in __show_fd_locks()
2912 struct file *filp, struct files_struct *files) in show_fd_locks() argument
2914 struct inode *inode = locks_inode(filp); 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()