Lines Matching refs:filp

233 locks_check_ctx_file_list(struct file *filp, struct list_head *list,  in locks_check_ctx_file_list()  argument
237 struct inode *inode = file_inode(filp); in locks_check_ctx_file_list()
240 if (fl->fl_file == filp) in locks_check_ctx_file_list()
429 static void flock_make_lock(struct file *filp, struct file_lock *fl, int type) in flock_make_lock() argument
433 fl->fl_file = filp; in flock_make_lock()
434 fl->fl_owner = filp; in flock_make_lock()
455 static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl, in flock64_to_posix_lock() argument
463 fl->fl_start = filp->f_pos; in flock64_to_posix_lock()
466 fl->fl_start = i_size_read(file_inode(filp)); in flock64_to_posix_lock()
494 fl->fl_file = filp; in flock64_to_posix_lock()
505 static int flock_to_posix_lock(struct file *filp, struct file_lock *fl, in flock_to_posix_lock() argument
515 return flock64_to_posix_lock(filp, fl, &ll); in flock_to_posix_lock()
529 struct file *filp = fl->fl_file; in lease_setup() local
537 if (!fasync_insert_entry(fa->fa_fd, filp, &fl->fl_fasync, fa)) in lease_setup()
540 __f_setown(filp, task_pid(current), PIDTYPE_TGID, 0); in lease_setup()
552 static int lease_init(struct file *filp, int type, struct file_lock *fl) in lease_init() argument
557 fl->fl_owner = filp; in lease_init()
560 fl->fl_file = filp; in lease_init()
570 static struct file_lock *lease_alloc(struct file *filp, int type) in lease_alloc() argument
578 error = lease_init(filp, type, fl); in lease_alloc()
902 posix_test_lock(struct file *filp, struct file_lock *fl) in posix_test_lock() argument
906 struct inode *inode = file_inode(filp); in posix_test_lock()
1346 int posix_lock_file(struct file *filp, struct file_lock *fl, in posix_lock_file() argument
1349 return posix_lock_inode(file_inode(filp), fl, conflock); in posix_lock_file()
1398 struct file *filp = fl->fl_file; in lease_modify() local
1400 f_delown(filp); in lease_modify()
1401 filp->f_owner.signum = 0; in lease_modify()
1645 int fcntl_getlease(struct file *filp) in fcntl_getlease() argument
1648 struct inode *inode = file_inode(filp); in fcntl_getlease()
1659 if (fl->fl_file != filp) in fcntl_getlease()
1684 check_conflicting_open(struct file *filp, const int arg, int flags) in check_conflicting_open() argument
1686 struct inode *inode = file_inode(filp); in check_conflicting_open()
1706 if (filp->f_mode & FMODE_WRITE) in check_conflicting_open()
1708 else if (filp->f_mode & FMODE_READ) in check_conflicting_open()
1719 generic_add_lease(struct file *filp, int arg, struct file_lock **flp, void **priv) in generic_add_lease() argument
1722 struct inode *inode = file_inode(filp); in generic_add_lease()
1750 error = check_conflicting_open(filp, arg, lease->fl_flags); in generic_add_lease()
1764 if (fl->fl_file == filp && in generic_add_lease()
1807 error = check_conflicting_open(filp, arg, lease->fl_flags); in generic_add_lease()
1827 static int generic_delete_lease(struct file *filp, void *owner) in generic_delete_lease() argument
1831 struct inode *inode = file_inode(filp); in generic_delete_lease()
1844 if (fl->fl_file == filp && in generic_delete_lease()
1870 int generic_setlease(struct file *filp, int arg, struct file_lock **flp, in generic_setlease() argument
1873 struct inode *inode = file_inode(filp); in generic_setlease()
1874 vfsuid_t vfsuid = i_uid_into_vfsuid(file_mnt_idmap(filp), inode); in generic_setlease()
1881 error = security_file_lock(filp, arg); in generic_setlease()
1887 return generic_delete_lease(filp, *priv); in generic_setlease()
1895 return generic_add_lease(filp, arg, flp, priv); in generic_setlease()
1953 vfs_setlease(struct file *filp, int arg, struct file_lock **lease, void **priv) in vfs_setlease() argument
1957 if (filp->f_op->setlease) in vfs_setlease()
1958 return filp->f_op->setlease(filp, arg, lease, priv); in vfs_setlease()
1960 return generic_setlease(filp, arg, lease, priv); in vfs_setlease()
1964 static int do_fcntl_add_lease(unsigned int fd, struct file *filp, int arg) in do_fcntl_add_lease() argument
1970 fl = lease_alloc(filp, arg); in do_fcntl_add_lease()
1981 error = vfs_setlease(filp, arg, &fl, (void **)&new); in do_fcntl_add_lease()
1999 int fcntl_setlease(unsigned int fd, struct file *filp, int arg) in fcntl_setlease() argument
2002 return vfs_setlease(filp, F_UNLCK, NULL, (void **)&filp); in fcntl_setlease()
2003 return do_fcntl_add_lease(fd, filp, arg); in fcntl_setlease()
2132 int vfs_test_lock(struct file *filp, struct file_lock *fl) in vfs_test_lock() argument
2134 WARN_ON_ONCE(filp != fl->fl_file); in vfs_test_lock()
2135 if (filp->f_op->lock) in vfs_test_lock()
2136 return filp->f_op->lock(filp, F_GETLK, fl); in vfs_test_lock()
2137 posix_test_lock(filp, fl); in vfs_test_lock()
2209 int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock *flock) in fcntl_getlk() argument
2222 error = flock_to_posix_lock(filp, fl, flock); in fcntl_getlk()
2232 fl->fl_owner = filp; in fcntl_getlk()
2235 error = vfs_test_lock(filp, fl); in fcntl_getlk()
2283 int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) in vfs_lock_file() argument
2285 WARN_ON_ONCE(filp != fl->fl_file); in vfs_lock_file()
2286 if (filp->f_op->lock) in vfs_lock_file()
2287 return filp->f_op->lock(filp, cmd, fl); in vfs_lock_file()
2289 return posix_lock_file(filp, fl, conf); in vfs_lock_file()
2293 static int do_lock_file_wait(struct file *filp, unsigned int cmd, in do_lock_file_wait() argument
2298 error = security_file_lock(filp, fl->fl_type); in do_lock_file_wait()
2303 error = vfs_lock_file(filp, cmd, fl, NULL); in do_lock_file_wait()
2335 int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk() argument
2339 struct inode *inode = file_inode(filp); in fcntl_setlk()
2346 error = flock_to_posix_lock(filp, file_lock, flock); in fcntl_setlk()
2366 file_lock->fl_owner = filp; in fcntl_setlk()
2375 file_lock->fl_owner = filp; in fcntl_setlk()
2381 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2399 if (f != filp) { in fcntl_setlk()
2401 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2416 int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 *flock) in fcntl_getlk64() argument
2430 error = flock64_to_posix_lock(filp, fl, flock); in fcntl_getlk64()
2440 fl->fl_owner = filp; in fcntl_getlk64()
2443 error = vfs_test_lock(filp, fl); in fcntl_getlk64()
2459 int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk64() argument
2469 error = flock64_to_posix_lock(filp, file_lock, flock); in fcntl_setlk64()
2489 file_lock->fl_owner = filp; in fcntl_setlk64()
2498 file_lock->fl_owner = filp; in fcntl_setlk64()
2504 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2522 if (f != filp) { in fcntl_setlk64()
2524 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2540 void locks_remove_posix(struct file *filp, fl_owner_t owner) in locks_remove_posix() argument
2543 struct inode *inode = file_inode(filp); in locks_remove_posix()
2563 lock.fl_file = filp; in locks_remove_posix()
2567 error = vfs_lock_file(filp, F_SETLK, &lock, NULL); in locks_remove_posix()
2577 locks_remove_flock(struct file *filp, struct file_lock_context *flctx) in locks_remove_flock() argument
2580 struct inode *inode = file_inode(filp); in locks_remove_flock()
2585 flock_make_lock(filp, &fl, F_UNLCK); in locks_remove_flock()
2588 if (filp->f_op->flock) in locks_remove_flock()
2589 filp->f_op->flock(filp, F_SETLKW, &fl); in locks_remove_flock()
2599 locks_remove_lease(struct file *filp, struct file_lock_context *ctx) in locks_remove_lease() argument
2610 if (filp == fl->fl_file) in locks_remove_lease()
2621 void locks_remove_file(struct file *filp) in locks_remove_file() argument
2625 ctx = locks_inode_context(file_inode(filp)); in locks_remove_file()
2630 locks_remove_posix(filp, filp); in locks_remove_file()
2633 locks_remove_flock(filp, ctx); in locks_remove_file()
2636 locks_remove_lease(filp, ctx); in locks_remove_file()
2639 locks_check_ctx_file_list(filp, &ctx->flc_posix, "POSIX"); in locks_remove_file()
2640 locks_check_ctx_file_list(filp, &ctx->flc_flock, "FLOCK"); in locks_remove_file()
2641 locks_check_ctx_file_list(filp, &ctx->flc_lease, "LEASE"); in locks_remove_file()
2652 int vfs_cancel_lock(struct file *filp, struct file_lock *fl) in vfs_cancel_lock() argument
2654 WARN_ON_ONCE(filp != fl->fl_file); in vfs_cancel_lock()
2655 if (filp->f_op->lock) in vfs_cancel_lock()
2656 return filp->f_op->lock(filp, F_CANCELLK, fl); in vfs_cancel_lock()
2829 struct file *filp, struct files_struct *files) in __show_fd_locks() argument
2835 if (filp != fl->fl_file) in __show_fd_locks()
2838 fl->fl_owner != filp) in __show_fd_locks()
2848 struct file *filp, struct files_struct *files) in show_fd_locks() argument
2850 struct inode *inode = file_inode(filp); in show_fd_locks()
2859 __show_fd_locks(f, &ctx->flc_flock, &id, filp, files); in show_fd_locks()
2860 __show_fd_locks(f, &ctx->flc_posix, &id, filp, files); in show_fd_locks()
2861 __show_fd_locks(f, &ctx->flc_lease, &id, filp, files); in show_fd_locks()