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()
1421 struct file *filp = fl->fl_file; in lease_modify() local
1423 f_delown(filp); in lease_modify()
1424 filp->f_owner.signum = 0; in lease_modify()
1668 int fcntl_getlease(struct file *filp) in fcntl_getlease() argument
1671 struct inode *inode = locks_inode(filp); in fcntl_getlease()
1682 if (fl->fl_file != filp) in fcntl_getlease()
1707 check_conflicting_open(struct file *filp, const long arg, int flags) in check_conflicting_open() argument
1709 struct inode *inode = locks_inode(filp); in check_conflicting_open()
1729 if (filp->f_mode & FMODE_WRITE) in check_conflicting_open()
1731 else if (filp->f_mode & FMODE_READ) in check_conflicting_open()
1742 generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv) in generic_add_lease() argument
1745 struct inode *inode = locks_inode(filp); in generic_add_lease()
1780 error = check_conflicting_open(filp, arg, lease->fl_flags); in generic_add_lease()
1794 if (fl->fl_file == filp && in generic_add_lease()
1837 error = check_conflicting_open(filp, arg, lease->fl_flags); in generic_add_lease()
1857 static int generic_delete_lease(struct file *filp, void *owner) in generic_delete_lease() argument
1861 struct inode *inode = locks_inode(filp); in generic_delete_lease()
1874 if (fl->fl_file == filp && in generic_delete_lease()
1900 int generic_setlease(struct file *filp, long arg, struct file_lock **flp, in generic_setlease() argument
1903 struct inode *inode = locks_inode(filp); in generic_setlease()
1910 error = security_file_lock(filp, arg); in generic_setlease()
1916 return generic_delete_lease(filp, *priv); in generic_setlease()
1924 return generic_add_lease(filp, arg, flp, priv); in generic_setlease()
2007 vfs_setlease(struct file *filp, long arg, struct file_lock **lease, void **priv) in vfs_setlease() argument
2011 if (filp->f_op->setlease) in vfs_setlease()
2012 return filp->f_op->setlease(filp, arg, lease, priv); in vfs_setlease()
2014 return generic_setlease(filp, arg, lease, priv); in vfs_setlease()
2018 static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) in do_fcntl_add_lease() argument
2024 fl = lease_alloc(filp, arg); in do_fcntl_add_lease()
2035 error = vfs_setlease(filp, arg, &fl, (void **)&new); in do_fcntl_add_lease()
2053 int fcntl_setlease(unsigned int fd, struct file *filp, long arg) in fcntl_setlease() argument
2056 return vfs_setlease(filp, F_UNLCK, NULL, (void **)&filp); in fcntl_setlease()
2057 return do_fcntl_add_lease(fd, filp, arg); in fcntl_setlease()
2181 int vfs_test_lock(struct file *filp, struct file_lock *fl) in vfs_test_lock() argument
2183 if (filp->f_op->lock) in vfs_test_lock()
2184 return filp->f_op->lock(filp, F_GETLK, fl); in vfs_test_lock()
2185 posix_test_lock(filp, fl); in vfs_test_lock()
2257 int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock *flock) in fcntl_getlk() argument
2269 error = flock_to_posix_lock(filp, fl, flock); in fcntl_getlk()
2279 fl->fl_owner = filp; in fcntl_getlk()
2282 error = vfs_test_lock(filp, fl); in fcntl_getlk()
2330 int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) in vfs_lock_file() argument
2332 if (filp->f_op->lock) in vfs_lock_file()
2333 return filp->f_op->lock(filp, cmd, fl); in vfs_lock_file()
2335 return posix_lock_file(filp, fl, conf); in vfs_lock_file()
2339 static int do_lock_file_wait(struct file *filp, unsigned int cmd, in do_lock_file_wait() argument
2344 error = security_file_lock(filp, fl->fl_type); in do_lock_file_wait()
2349 error = vfs_lock_file(filp, cmd, fl, NULL); in do_lock_file_wait()
2381 int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk() argument
2385 struct inode *inode = locks_inode(filp); in fcntl_setlk()
2392 error = flock_to_posix_lock(filp, file_lock, flock); in fcntl_setlk()
2412 file_lock->fl_owner = filp; in fcntl_setlk()
2421 file_lock->fl_owner = filp; in fcntl_setlk()
2427 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2445 if (f != filp) { in fcntl_setlk()
2447 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2462 int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 *flock) in fcntl_getlk64() argument
2475 error = flock64_to_posix_lock(filp, fl, flock); in fcntl_getlk64()
2486 fl->fl_owner = filp; in fcntl_getlk64()
2489 error = vfs_test_lock(filp, fl); in fcntl_getlk64()
2505 int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk64() argument
2515 error = flock64_to_posix_lock(filp, file_lock, flock); in fcntl_setlk64()
2535 file_lock->fl_owner = filp; in fcntl_setlk64()
2544 file_lock->fl_owner = filp; in fcntl_setlk64()
2550 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2568 if (f != filp) { in fcntl_setlk64()
2570 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2586 void locks_remove_posix(struct file *filp, fl_owner_t owner) in locks_remove_posix() argument
2589 struct inode *inode = locks_inode(filp); in locks_remove_posix()
2609 lock.fl_file = filp; in locks_remove_posix()
2613 error = vfs_lock_file(filp, F_SETLK, &lock, NULL); in locks_remove_posix()
2623 locks_remove_flock(struct file *filp, struct file_lock_context *flctx) in locks_remove_flock() argument
2626 struct inode *inode = locks_inode(filp); in locks_remove_flock()
2631 flock_make_lock(filp, LOCK_UN, &fl); in locks_remove_flock()
2634 if (filp->f_op->flock) in locks_remove_flock()
2635 filp->f_op->flock(filp, F_SETLKW, &fl); in locks_remove_flock()
2645 locks_remove_lease(struct file *filp, struct file_lock_context *ctx) in locks_remove_lease() argument
2656 if (filp == fl->fl_file) in locks_remove_lease()
2667 void locks_remove_file(struct file *filp) in locks_remove_file() argument
2671 ctx = smp_load_acquire(&locks_inode(filp)->i_flctx); in locks_remove_file()
2676 locks_remove_posix(filp, filp); in locks_remove_file()
2679 locks_remove_flock(filp, ctx); in locks_remove_file()
2682 locks_remove_lease(filp, ctx); in locks_remove_file()
2685 locks_check_ctx_file_list(filp, &ctx->flc_posix, "POSIX"); in locks_remove_file()
2686 locks_check_ctx_file_list(filp, &ctx->flc_flock, "FLOCK"); in locks_remove_file()
2687 locks_check_ctx_file_list(filp, &ctx->flc_lease, "LEASE"); in locks_remove_file()
2698 int vfs_cancel_lock(struct file *filp, struct file_lock *fl) in vfs_cancel_lock() argument
2700 if (filp->f_op->lock) in vfs_cancel_lock()
2701 return filp->f_op->lock(filp, F_CANCELLK, fl); in vfs_cancel_lock()
2861 struct file *filp, struct files_struct *files) in __show_fd_locks() argument
2867 if (filp != fl->fl_file) in __show_fd_locks()
2870 fl->fl_owner != filp) in __show_fd_locks()
2880 struct file *filp, struct files_struct *files) in show_fd_locks() argument
2882 struct inode *inode = locks_inode(filp); in show_fd_locks()
2891 __show_fd_locks(f, &ctx->flc_flock, &id, filp, files); in show_fd_locks()
2892 __show_fd_locks(f, &ctx->flc_posix, &id, filp, files); in show_fd_locks()
2893 __show_fd_locks(f, &ctx->flc_lease, &id, filp, files); in show_fd_locks()