Lines Matching refs:filp
237 locks_check_ctx_file_list(struct file *filp, struct list_head *list, char *list_type) in locks_check_ctx_file_list() argument
240 struct inode *inode = file_inode(filp); in locks_check_ctx_file_list()
243 if (flc->flc_file == filp) in locks_check_ctx_file_list()
465 static void flock_make_lock(struct file *filp, struct file_lock *fl, int type) in flock_make_lock() argument
469 fl->c.flc_file = filp; in flock_make_lock()
470 fl->c.flc_owner = filp; in flock_make_lock()
491 static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl, in flock64_to_posix_lock() argument
499 fl->fl_start = filp->f_pos; in flock64_to_posix_lock()
502 fl->fl_start = i_size_read(file_inode(filp)); in flock64_to_posix_lock()
530 fl->c.flc_file = filp; in flock64_to_posix_lock()
541 static int flock_to_posix_lock(struct file *filp, struct file_lock *fl, in flock_to_posix_lock() argument
551 return flock64_to_posix_lock(filp, fl, &ll); in flock_to_posix_lock()
565 struct file *filp = fl->c.flc_file; in lease_setup() local
573 if (!fasync_insert_entry(fa->fa_fd, filp, &fl->fl_fasync, fa)) in lease_setup()
576 __f_setown(filp, task_pid(current), PIDTYPE_TGID, 0); in lease_setup()
588 static int lease_init(struct file *filp, int type, struct file_lease *fl) in lease_init() argument
593 fl->c.flc_owner = filp; in lease_init()
596 fl->c.flc_file = filp; in lease_init()
603 static struct file_lease *lease_alloc(struct file *filp, int type) in lease_alloc() argument
611 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 = file_inode(filp); in posix_test_lock()
1399 int posix_lock_file(struct file *filp, struct file_lock *fl, in posix_lock_file() argument
1402 return posix_lock_inode(file_inode(filp), fl, conflock); in posix_lock_file()
1451 struct file *filp = fl->c.flc_file; in lease_modify() local
1453 f_delown(filp); in lease_modify()
1454 file_f_owner(filp)->signum = 0; in lease_modify()
1700 int fcntl_getlease(struct file *filp) in fcntl_getlease() argument
1703 struct inode *inode = file_inode(filp); in fcntl_getlease()
1714 if (fl->c.flc_file != filp) in fcntl_getlease()
1739 check_conflicting_open(struct file *filp, const int arg, int flags) in check_conflicting_open() argument
1741 struct inode *inode = file_inode(filp); in check_conflicting_open()
1761 if (filp->f_mode & FMODE_WRITE) in check_conflicting_open()
1763 else if (filp->f_mode & FMODE_READ) in check_conflicting_open()
1774 generic_add_lease(struct file *filp, int arg, struct file_lease **flp, void **priv) in generic_add_lease() argument
1777 struct inode *inode = file_inode(filp); in generic_add_lease()
1786 error = file_f_owner_allocate(filp); in generic_add_lease()
1809 error = check_conflicting_open(filp, arg, lease->c.flc_flags); in generic_add_lease()
1823 if (fl->c.flc_file == filp && in generic_add_lease()
1866 error = check_conflicting_open(filp, arg, lease->c.flc_flags); in generic_add_lease()
1886 static int generic_delete_lease(struct file *filp, void *owner) in generic_delete_lease() argument
1890 struct inode *inode = file_inode(filp); in generic_delete_lease()
1903 if (fl->c.flc_file == filp && in generic_delete_lease()
1929 int generic_setlease(struct file *filp, int arg, struct file_lease **flp, in generic_setlease() argument
1934 return generic_delete_lease(filp, *priv); in generic_setlease()
1942 return generic_add_lease(filp, arg, flp, priv); in generic_setlease()
1984 kernel_setlease(struct file *filp, int arg, struct file_lease **lease, void **priv) in kernel_setlease() argument
1988 if (filp->f_op->setlease) in kernel_setlease()
1989 return filp->f_op->setlease(filp, arg, lease, priv); in kernel_setlease()
1991 return generic_setlease(filp, arg, lease, priv); in kernel_setlease()
2013 vfs_setlease(struct file *filp, int arg, struct file_lease **lease, void **priv) in vfs_setlease() argument
2015 struct inode *inode = file_inode(filp); in vfs_setlease()
2016 vfsuid_t vfsuid = i_uid_into_vfsuid(file_mnt_idmap(filp), inode); in vfs_setlease()
2023 error = security_file_lock(filp, arg); in vfs_setlease()
2026 return kernel_setlease(filp, arg, lease, priv); in vfs_setlease()
2030 static int do_fcntl_add_lease(unsigned int fd, struct file *filp, int arg) in do_fcntl_add_lease() argument
2036 fl = lease_alloc(filp, arg); in do_fcntl_add_lease()
2047 error = vfs_setlease(filp, arg, &fl, (void **)&new); in do_fcntl_add_lease()
2065 int fcntl_setlease(unsigned int fd, struct file *filp, int arg) in fcntl_setlease() argument
2068 return vfs_setlease(filp, F_UNLCK, NULL, (void **)&filp); in fcntl_setlease()
2069 return do_fcntl_add_lease(fd, filp, arg); in fcntl_setlease()
2193 int vfs_test_lock(struct file *filp, struct file_lock *fl) in vfs_test_lock() argument
2195 WARN_ON_ONCE(filp != fl->c.flc_file); in vfs_test_lock()
2196 if (filp->f_op->lock) in vfs_test_lock()
2197 return filp->f_op->lock(filp, F_GETLK, fl); in vfs_test_lock()
2198 posix_test_lock(filp, fl); in vfs_test_lock()
2273 int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock *flock) in fcntl_getlk() argument
2286 error = flock_to_posix_lock(filp, fl, flock); in fcntl_getlk()
2296 fl->c.flc_owner = filp; in fcntl_getlk()
2299 error = vfs_test_lock(filp, fl); in fcntl_getlk()
2349 int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) in vfs_lock_file() argument
2351 WARN_ON_ONCE(filp != fl->c.flc_file); in vfs_lock_file()
2352 if (filp->f_op->lock) in vfs_lock_file()
2353 return filp->f_op->lock(filp, cmd, fl); in vfs_lock_file()
2355 return posix_lock_file(filp, fl, conf); in vfs_lock_file()
2359 static int do_lock_file_wait(struct file *filp, unsigned int cmd, in do_lock_file_wait() argument
2364 error = security_file_lock(filp, fl->c.flc_type); in do_lock_file_wait()
2369 error = vfs_lock_file(filp, cmd, fl, NULL); in do_lock_file_wait()
2401 int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk() argument
2405 struct inode *inode = file_inode(filp); in fcntl_setlk()
2412 error = flock_to_posix_lock(filp, file_lock, flock); in fcntl_setlk()
2432 file_lock->c.flc_owner = filp; in fcntl_setlk()
2441 file_lock->c.flc_owner = filp; in fcntl_setlk()
2447 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2466 if (f != filp) { in fcntl_setlk()
2467 locks_remove_posix(filp, files); in fcntl_setlk()
2481 int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 *flock) in fcntl_getlk64() argument
2495 error = flock64_to_posix_lock(filp, fl, flock); in fcntl_getlk64()
2505 fl->c.flc_owner = filp; in fcntl_getlk64()
2508 error = vfs_test_lock(filp, fl); in fcntl_getlk64()
2524 int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk64() argument
2534 error = flock64_to_posix_lock(filp, file_lock, flock); in fcntl_setlk64()
2554 file_lock->c.flc_owner = filp; in fcntl_setlk64()
2563 file_lock->c.flc_owner = filp; in fcntl_setlk64()
2569 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2588 if (f != filp) { in fcntl_setlk64()
2589 locks_remove_posix(filp, files); in fcntl_setlk64()
2604 void locks_remove_posix(struct file *filp, fl_owner_t owner) in locks_remove_posix() argument
2607 struct inode *inode = file_inode(filp); in locks_remove_posix()
2627 lock.c.flc_file = filp; in locks_remove_posix()
2631 error = vfs_lock_file(filp, F_SETLK, &lock, NULL); in locks_remove_posix()
2641 locks_remove_flock(struct file *filp, struct file_lock_context *flctx) in locks_remove_flock() argument
2644 struct inode *inode = file_inode(filp); in locks_remove_flock()
2649 flock_make_lock(filp, &fl, F_UNLCK); in locks_remove_flock()
2652 if (filp->f_op->flock) in locks_remove_flock()
2653 filp->f_op->flock(filp, F_SETLKW, &fl); in locks_remove_flock()
2663 locks_remove_lease(struct file *filp, struct file_lock_context *ctx) in locks_remove_lease() argument
2674 if (filp == fl->c.flc_file) in locks_remove_lease()
2685 void locks_remove_file(struct file *filp) in locks_remove_file() argument
2689 ctx = locks_inode_context(file_inode(filp)); in locks_remove_file()
2694 locks_remove_posix(filp, filp); in locks_remove_file()
2697 locks_remove_flock(filp, ctx); in locks_remove_file()
2700 locks_remove_lease(filp, ctx); in locks_remove_file()
2703 locks_check_ctx_file_list(filp, &ctx->flc_posix, "POSIX"); in locks_remove_file()
2704 locks_check_ctx_file_list(filp, &ctx->flc_flock, "FLOCK"); in locks_remove_file()
2705 locks_check_ctx_file_list(filp, &ctx->flc_lease, "LEASE"); in locks_remove_file()
2716 int vfs_cancel_lock(struct file *filp, struct file_lock *fl) in vfs_cancel_lock() argument
2718 WARN_ON_ONCE(filp != fl->c.flc_file); in vfs_cancel_lock()
2719 if (filp->f_op->lock) in vfs_cancel_lock()
2720 return filp->f_op->lock(filp, F_CANCELLK, fl); in vfs_cancel_lock()
2899 struct file *filp, struct files_struct *files) in __show_fd_locks() argument
2905 if (filp != fl->flc_file) in __show_fd_locks()
2907 if (fl->flc_owner != files && fl->flc_owner != filp) in __show_fd_locks()
2917 struct file *filp, struct files_struct *files) in show_fd_locks() argument
2919 struct inode *inode = file_inode(filp); in show_fd_locks()
2928 __show_fd_locks(f, &ctx->flc_flock, &id, filp, files); in show_fd_locks()
2929 __show_fd_locks(f, &ctx->flc_posix, &id, filp, files); in show_fd_locks()
2930 __show_fd_locks(f, &ctx->flc_lease, &id, filp, files); in show_fd_locks()