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, unsigned int flags, 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, unsigned int flags, int type) in lease_alloc() argument
611 error = lease_init(filp, flags, 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()
1707 static int __fcntl_getlease(struct file *filp, unsigned int flavor) in __fcntl_getlease() argument
1710 struct inode *inode = file_inode(filp); in __fcntl_getlease()
1721 if (fl->c.flc_file != filp) in __fcntl_getlease()
1735 int fcntl_getlease(struct file *filp) in fcntl_getlease() argument
1737 return __fcntl_getlease(filp, FL_LEASE); in fcntl_getlease()
1740 int fcntl_getdeleg(struct file *filp, struct delegation *deleg) in fcntl_getdeleg() argument
1744 deleg->d_type = __fcntl_getlease(filp, FL_DELEG); in fcntl_getdeleg()
1760 check_conflicting_open(struct file *filp, const int arg, int flags) in check_conflicting_open() argument
1762 struct inode *inode = file_inode(filp); in check_conflicting_open()
1782 if (filp->f_mode & FMODE_WRITE) in check_conflicting_open()
1784 else if (filp->f_mode & FMODE_READ) in check_conflicting_open()
1795 generic_add_lease(struct file *filp, int arg, struct file_lease **flp, void **priv) in generic_add_lease() argument
1798 struct inode *inode = file_inode(filp); in generic_add_lease()
1807 error = file_f_owner_allocate(filp); in generic_add_lease()
1830 error = check_conflicting_open(filp, arg, lease->c.flc_flags); in generic_add_lease()
1844 if (fl->c.flc_file == filp && in generic_add_lease()
1887 error = check_conflicting_open(filp, arg, lease->c.flc_flags); in generic_add_lease()
1907 static int generic_delete_lease(struct file *filp, void *owner) in generic_delete_lease() argument
1911 struct inode *inode = file_inode(filp); in generic_delete_lease()
1924 if (fl->c.flc_file == filp && in generic_delete_lease()
1950 int generic_setlease(struct file *filp, int arg, struct file_lease **flp, in generic_setlease() argument
1953 struct inode *inode = file_inode(filp); in generic_setlease()
1960 return generic_delete_lease(filp, *priv); in generic_setlease()
1971 return generic_add_lease(filp, arg, flp, priv); in generic_setlease()
2013 kernel_setlease(struct file *filp, int arg, struct file_lease **lease, void **priv) in kernel_setlease() argument
2017 if (filp->f_op->setlease) in kernel_setlease()
2018 return filp->f_op->setlease(filp, arg, lease, priv); in kernel_setlease()
2020 return generic_setlease(filp, arg, lease, priv); in kernel_setlease()
2042 vfs_setlease(struct file *filp, int arg, struct file_lease **lease, void **priv) in vfs_setlease() argument
2044 struct inode *inode = file_inode(filp); in vfs_setlease()
2045 vfsuid_t vfsuid = i_uid_into_vfsuid(file_mnt_idmap(filp), inode); in vfs_setlease()
2050 error = security_file_lock(filp, arg); in vfs_setlease()
2053 return kernel_setlease(filp, arg, lease, priv); in vfs_setlease()
2057 static int do_fcntl_add_lease(unsigned int fd, struct file *filp, unsigned int flavor, int arg) in do_fcntl_add_lease() argument
2063 fl = lease_alloc(filp, flavor, arg); in do_fcntl_add_lease()
2074 error = vfs_setlease(filp, arg, &fl, (void **)&new); in do_fcntl_add_lease()
2092 int fcntl_setlease(unsigned int fd, struct file *filp, int arg) in fcntl_setlease() argument
2094 if (S_ISDIR(file_inode(filp)->i_mode)) in fcntl_setlease()
2098 return vfs_setlease(filp, F_UNLCK, NULL, (void **)&filp); in fcntl_setlease()
2099 return do_fcntl_add_lease(fd, filp, FL_LEASE, arg); in fcntl_setlease()
2112 int fcntl_setdeleg(unsigned int fd, struct file *filp, struct delegation *deleg) in fcntl_setdeleg() argument
2119 return vfs_setlease(filp, F_UNLCK, NULL, (void **)&filp); in fcntl_setdeleg()
2120 return do_fcntl_add_lease(fd, filp, FL_DELEG, deleg->d_type); in fcntl_setdeleg()
2251 int vfs_test_lock(struct file *filp, struct file_lock *fl) in vfs_test_lock() argument
2254 WARN_ON_ONCE(filp != fl->c.flc_file); in vfs_test_lock()
2255 if (filp->f_op->lock) in vfs_test_lock()
2256 return filp->f_op->lock(filp, F_GETLK, fl); in vfs_test_lock()
2257 posix_test_lock(filp, fl); in vfs_test_lock()
2332 int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock *flock) in fcntl_getlk() argument
2345 error = flock_to_posix_lock(filp, fl, flock); in fcntl_getlk()
2355 fl->c.flc_owner = filp; in fcntl_getlk()
2358 error = vfs_test_lock(filp, fl); in fcntl_getlk()
2408 int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) in vfs_lock_file() argument
2410 WARN_ON_ONCE(filp != fl->c.flc_file); in vfs_lock_file()
2411 if (filp->f_op->lock) in vfs_lock_file()
2412 return filp->f_op->lock(filp, cmd, fl); in vfs_lock_file()
2414 return posix_lock_file(filp, fl, conf); in vfs_lock_file()
2418 static int do_lock_file_wait(struct file *filp, unsigned int cmd, in do_lock_file_wait() argument
2423 error = security_file_lock(filp, fl->c.flc_type); in do_lock_file_wait()
2428 error = vfs_lock_file(filp, cmd, fl, NULL); in do_lock_file_wait()
2460 int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk() argument
2464 struct inode *inode = file_inode(filp); in fcntl_setlk()
2471 error = flock_to_posix_lock(filp, file_lock, flock); in fcntl_setlk()
2491 file_lock->c.flc_owner = filp; in fcntl_setlk()
2500 file_lock->c.flc_owner = filp; in fcntl_setlk()
2506 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2525 if (f != filp) { in fcntl_setlk()
2526 locks_remove_posix(filp, files); in fcntl_setlk()
2540 int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 *flock) in fcntl_getlk64() argument
2554 error = flock64_to_posix_lock(filp, fl, flock); in fcntl_getlk64()
2564 fl->c.flc_owner = filp; in fcntl_getlk64()
2567 error = vfs_test_lock(filp, fl); in fcntl_getlk64()
2583 int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk64() argument
2593 error = flock64_to_posix_lock(filp, file_lock, flock); in fcntl_setlk64()
2613 file_lock->c.flc_owner = filp; in fcntl_setlk64()
2622 file_lock->c.flc_owner = filp; in fcntl_setlk64()
2628 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2647 if (f != filp) { in fcntl_setlk64()
2648 locks_remove_posix(filp, files); in fcntl_setlk64()
2663 void locks_remove_posix(struct file *filp, fl_owner_t owner) in locks_remove_posix() argument
2666 struct inode *inode = file_inode(filp); in locks_remove_posix()
2686 lock.c.flc_file = filp; in locks_remove_posix()
2690 error = vfs_lock_file(filp, F_SETLK, &lock, NULL); in locks_remove_posix()
2700 locks_remove_flock(struct file *filp, struct file_lock_context *flctx) in locks_remove_flock() argument
2703 struct inode *inode = file_inode(filp); in locks_remove_flock()
2708 flock_make_lock(filp, &fl, F_UNLCK); in locks_remove_flock()
2711 if (filp->f_op->flock) in locks_remove_flock()
2712 filp->f_op->flock(filp, F_SETLKW, &fl); in locks_remove_flock()
2722 locks_remove_lease(struct file *filp, struct file_lock_context *ctx) in locks_remove_lease() argument
2733 if (filp == fl->c.flc_file) in locks_remove_lease()
2744 void locks_remove_file(struct file *filp) in locks_remove_file() argument
2748 ctx = locks_inode_context(file_inode(filp)); in locks_remove_file()
2753 locks_remove_posix(filp, filp); in locks_remove_file()
2756 locks_remove_flock(filp, ctx); in locks_remove_file()
2759 locks_remove_lease(filp, ctx); in locks_remove_file()
2762 locks_check_ctx_file_list(filp, &ctx->flc_posix, "POSIX"); in locks_remove_file()
2763 locks_check_ctx_file_list(filp, &ctx->flc_flock, "FLOCK"); in locks_remove_file()
2764 locks_check_ctx_file_list(filp, &ctx->flc_lease, "LEASE"); in locks_remove_file()
2775 int vfs_cancel_lock(struct file *filp, struct file_lock *fl) in vfs_cancel_lock() argument
2777 WARN_ON_ONCE(filp != fl->c.flc_file); in vfs_cancel_lock()
2778 if (filp->f_op->lock) in vfs_cancel_lock()
2779 return filp->f_op->lock(filp, F_CANCELLK, fl); in vfs_cancel_lock()
2958 struct file *filp, struct files_struct *files) in __show_fd_locks() argument
2964 if (filp != fl->flc_file) in __show_fd_locks()
2966 if (fl->flc_owner != files && fl->flc_owner != filp) in __show_fd_locks()
2976 struct file *filp, struct files_struct *files) in show_fd_locks() argument
2978 struct inode *inode = file_inode(filp); in show_fd_locks()
2987 __show_fd_locks(f, &ctx->flc_flock, &id, filp, files); in show_fd_locks()
2988 __show_fd_locks(f, &ctx->flc_posix, &id, filp, files); in show_fd_locks()
2989 __show_fd_locks(f, &ctx->flc_lease, &id, filp, files); in show_fd_locks()