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()
952 posix_test_lock(struct file *filp, struct file_lock *fl) in posix_test_lock() argument
956 struct inode *inode = locks_inode(filp); in posix_test_lock()
1369 int posix_lock_file(struct file *filp, struct file_lock *fl, in posix_lock_file() argument
1372 return posix_lock_inode(locks_inode(filp), fl, conflock); in posix_lock_file()
1445 int locks_mandatory_area(struct inode *inode, struct file *filp, loff_t start, in locks_mandatory_area() argument
1454 fl.fl_file = filp; in locks_mandatory_area()
1456 if (filp && !(filp->f_flags & O_NONBLOCK)) in locks_mandatory_area()
1463 if (filp) { in locks_mandatory_area()
1464 fl.fl_owner = filp; in locks_mandatory_area()
1518 struct file *filp = fl->fl_file; in lease_modify() local
1520 f_delown(filp); in lease_modify()
1521 filp->f_owner.signum = 0; in lease_modify()
1765 int fcntl_getlease(struct file *filp) in fcntl_getlease() argument
1768 struct inode *inode = locks_inode(filp); in fcntl_getlease()
1779 if (fl->fl_file != filp) in fcntl_getlease()
1804 check_conflicting_open(struct file *filp, const long arg, int flags) in check_conflicting_open() argument
1806 struct inode *inode = locks_inode(filp); in check_conflicting_open()
1823 if (filp->f_mode & FMODE_WRITE) in check_conflicting_open()
1825 else if (filp->f_mode & FMODE_READ) in check_conflicting_open()
1836 generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv) in generic_add_lease() argument
1839 struct inode *inode = locks_inode(filp); in generic_add_lease()
1874 error = check_conflicting_open(filp, arg, lease->fl_flags); in generic_add_lease()
1888 if (fl->fl_file == filp && in generic_add_lease()
1931 error = check_conflicting_open(filp, arg, lease->fl_flags); in generic_add_lease()
1951 static int generic_delete_lease(struct file *filp, void *owner) in generic_delete_lease() argument
1955 struct inode *inode = locks_inode(filp); in generic_delete_lease()
1968 if (fl->fl_file == filp && in generic_delete_lease()
1994 int generic_setlease(struct file *filp, long arg, struct file_lock **flp, in generic_setlease() argument
1997 struct inode *inode = locks_inode(filp); in generic_setlease()
2004 error = security_file_lock(filp, arg); in generic_setlease()
2010 return generic_delete_lease(filp, *priv); in generic_setlease()
2018 return generic_add_lease(filp, arg, flp, priv); in generic_setlease()
2101 vfs_setlease(struct file *filp, long arg, struct file_lock **lease, void **priv) in vfs_setlease() argument
2105 if (filp->f_op->setlease) in vfs_setlease()
2106 return filp->f_op->setlease(filp, arg, lease, priv); in vfs_setlease()
2108 return generic_setlease(filp, arg, lease, priv); in vfs_setlease()
2112 static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) in do_fcntl_add_lease() argument
2118 fl = lease_alloc(filp, arg); in do_fcntl_add_lease()
2129 error = vfs_setlease(filp, arg, &fl, (void **)&new); in do_fcntl_add_lease()
2147 int fcntl_setlease(unsigned int fd, struct file *filp, long arg) in fcntl_setlease() argument
2150 return vfs_setlease(filp, F_UNLCK, NULL, (void **)&filp); in fcntl_setlease()
2151 return do_fcntl_add_lease(fd, filp, arg); in fcntl_setlease()
2275 int vfs_test_lock(struct file *filp, struct file_lock *fl) in vfs_test_lock() argument
2277 if (filp->f_op->lock) in vfs_test_lock()
2278 return filp->f_op->lock(filp, F_GETLK, fl); in vfs_test_lock()
2279 posix_test_lock(filp, fl); in vfs_test_lock()
2351 int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock *flock) in fcntl_getlk() argument
2363 error = flock_to_posix_lock(filp, fl, flock); in fcntl_getlk()
2374 fl->fl_owner = filp; in fcntl_getlk()
2377 error = vfs_test_lock(filp, fl); in fcntl_getlk()
2425 int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) in vfs_lock_file() argument
2427 if (filp->f_op->lock) in vfs_lock_file()
2428 return filp->f_op->lock(filp, cmd, fl); in vfs_lock_file()
2430 return posix_lock_file(filp, fl, conf); in vfs_lock_file()
2434 static int do_lock_file_wait(struct file *filp, unsigned int cmd, in do_lock_file_wait() argument
2439 error = security_file_lock(filp, fl->fl_type); in do_lock_file_wait()
2444 error = vfs_lock_file(filp, cmd, fl, NULL); in do_lock_file_wait()
2476 int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk() argument
2480 struct inode *inode = locks_inode(filp); in fcntl_setlk()
2490 if (mandatory_lock(inode) && mapping_writably_mapped(filp->f_mapping)) { in fcntl_setlk()
2495 error = flock_to_posix_lock(filp, file_lock, flock); in fcntl_setlk()
2515 file_lock->fl_owner = filp; in fcntl_setlk()
2524 file_lock->fl_owner = filp; in fcntl_setlk()
2530 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2547 if (f != filp) { in fcntl_setlk()
2549 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2564 int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 *flock) in fcntl_getlk64() argument
2577 error = flock64_to_posix_lock(filp, fl, flock); in fcntl_getlk64()
2588 fl->fl_owner = filp; in fcntl_getlk64()
2591 error = vfs_test_lock(filp, fl); in fcntl_getlk64()
2607 int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk64() argument
2611 struct inode *inode = locks_inode(filp); in fcntl_setlk64()
2621 if (mandatory_lock(inode) && mapping_writably_mapped(filp->f_mapping)) { in fcntl_setlk64()
2626 error = flock64_to_posix_lock(filp, file_lock, flock); in fcntl_setlk64()
2646 file_lock->fl_owner = filp; in fcntl_setlk64()
2655 file_lock->fl_owner = filp; in fcntl_setlk64()
2661 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2678 if (f != filp) { in fcntl_setlk64()
2680 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2696 void locks_remove_posix(struct file *filp, fl_owner_t owner) in locks_remove_posix() argument
2699 struct inode *inode = locks_inode(filp); in locks_remove_posix()
2719 lock.fl_file = filp; in locks_remove_posix()
2723 error = vfs_lock_file(filp, F_SETLK, &lock, NULL); in locks_remove_posix()
2733 locks_remove_flock(struct file *filp, struct file_lock_context *flctx) in locks_remove_flock() argument
2736 struct inode *inode = locks_inode(filp); in locks_remove_flock()
2741 flock_make_lock(filp, LOCK_UN, &fl); in locks_remove_flock()
2744 if (filp->f_op->flock) in locks_remove_flock()
2745 filp->f_op->flock(filp, F_SETLKW, &fl); in locks_remove_flock()
2755 locks_remove_lease(struct file *filp, struct file_lock_context *ctx) in locks_remove_lease() argument
2766 if (filp == fl->fl_file) in locks_remove_lease()
2777 void locks_remove_file(struct file *filp) in locks_remove_file() argument
2781 ctx = smp_load_acquire(&locks_inode(filp)->i_flctx); in locks_remove_file()
2786 locks_remove_posix(filp, filp); in locks_remove_file()
2789 locks_remove_flock(filp, ctx); in locks_remove_file()
2792 locks_remove_lease(filp, ctx); in locks_remove_file()
2795 locks_check_ctx_file_list(filp, &ctx->flc_posix, "POSIX"); in locks_remove_file()
2796 locks_check_ctx_file_list(filp, &ctx->flc_flock, "FLOCK"); in locks_remove_file()
2797 locks_check_ctx_file_list(filp, &ctx->flc_lease, "LEASE"); in locks_remove_file()
2808 int vfs_cancel_lock(struct file *filp, struct file_lock *fl) in vfs_cancel_lock() argument
2810 if (filp->f_op->lock) in vfs_cancel_lock()
2811 return filp->f_op->lock(filp, F_CANCELLK, fl); in vfs_cancel_lock()
2925 struct file *filp, struct files_struct *files) in __show_fd_locks() argument
2931 if (filp != fl->fl_file) in __show_fd_locks()
2934 fl->fl_owner != filp) in __show_fd_locks()
2944 struct file *filp, struct files_struct *files) in show_fd_locks() argument
2946 struct inode *inode = locks_inode(filp); in show_fd_locks()
2955 __show_fd_locks(f, &ctx->flc_flock, &id, filp, files); in show_fd_locks()
2956 __show_fd_locks(f, &ctx->flc_posix, &id, filp, files); in show_fd_locks()
2957 __show_fd_locks(f, &ctx->flc_lease, &id, filp, files); in show_fd_locks()