Lines Matching refs:filp
202 locks_check_ctx_file_list(struct file *filp, struct list_head *list, in locks_check_ctx_file_list() argument
206 struct inode *inode = locks_inode(filp); in locks_check_ctx_file_list()
209 if (fl->fl_file == filp) in locks_check_ctx_file_list()
371 flock_make_lock(struct file *filp, unsigned int cmd, struct file_lock *fl) in flock_make_lock() argument
386 fl->fl_file = filp; in flock_make_lock()
387 fl->fl_owner = filp; in flock_make_lock()
410 static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl, in flock64_to_posix_lock() argument
418 fl->fl_start = filp->f_pos; in flock64_to_posix_lock()
421 fl->fl_start = i_size_read(file_inode(filp)); in flock64_to_posix_lock()
449 fl->fl_file = filp; in flock64_to_posix_lock()
460 static int flock_to_posix_lock(struct file *filp, struct file_lock *fl, in flock_to_posix_lock() argument
470 return flock64_to_posix_lock(filp, fl, &ll); in flock_to_posix_lock()
484 struct file *filp = fl->fl_file; in lease_setup() local
492 if (!fasync_insert_entry(fa->fa_fd, filp, &fl->fl_fasync, fa)) in lease_setup()
495 __f_setown(filp, task_pid(current), PIDTYPE_TGID, 0); in lease_setup()
507 static int lease_init(struct file *filp, long type, struct file_lock *fl) in lease_init() argument
512 fl->fl_owner = filp; in lease_init()
515 fl->fl_file = filp; in lease_init()
525 static struct file_lock *lease_alloc(struct file *filp, long type) in lease_alloc() argument
533 error = lease_init(filp, type, fl); in lease_alloc()
842 posix_test_lock(struct file *filp, struct file_lock *fl) in posix_test_lock() argument
846 struct inode *inode = locks_inode(filp); in posix_test_lock()
1259 int posix_lock_file(struct file *filp, struct file_lock *fl, in posix_lock_file() argument
1262 return posix_lock_inode(locks_inode(filp), fl, conflock); in posix_lock_file()
1311 struct file *filp = fl->fl_file; in lease_modify() local
1313 f_delown(filp); in lease_modify()
1314 filp->f_owner.signum = 0; in lease_modify()
1558 int fcntl_getlease(struct file *filp) in fcntl_getlease() argument
1561 struct inode *inode = locks_inode(filp); in fcntl_getlease()
1572 if (fl->fl_file != filp) in fcntl_getlease()
1597 check_conflicting_open(struct file *filp, const long arg, int flags) in check_conflicting_open() argument
1599 struct inode *inode = locks_inode(filp); in check_conflicting_open()
1619 if (filp->f_mode & FMODE_WRITE) in check_conflicting_open()
1621 else if (filp->f_mode & FMODE_READ) in check_conflicting_open()
1632 generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv) in generic_add_lease() argument
1635 struct inode *inode = locks_inode(filp); in generic_add_lease()
1670 error = check_conflicting_open(filp, arg, lease->fl_flags); in generic_add_lease()
1684 if (fl->fl_file == filp && in generic_add_lease()
1727 error = check_conflicting_open(filp, arg, lease->fl_flags); in generic_add_lease()
1747 static int generic_delete_lease(struct file *filp, void *owner) in generic_delete_lease() argument
1751 struct inode *inode = locks_inode(filp); in generic_delete_lease()
1764 if (fl->fl_file == filp && in generic_delete_lease()
1790 int generic_setlease(struct file *filp, long arg, struct file_lock **flp, in generic_setlease() argument
1793 struct inode *inode = locks_inode(filp); in generic_setlease()
1800 error = security_file_lock(filp, arg); in generic_setlease()
1806 return generic_delete_lease(filp, *priv); in generic_setlease()
1814 return generic_add_lease(filp, arg, flp, priv); in generic_setlease()
1897 vfs_setlease(struct file *filp, long arg, struct file_lock **lease, void **priv) in vfs_setlease() argument
1901 if (filp->f_op->setlease) in vfs_setlease()
1902 return filp->f_op->setlease(filp, arg, lease, priv); in vfs_setlease()
1904 return generic_setlease(filp, arg, lease, priv); in vfs_setlease()
1908 static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) in do_fcntl_add_lease() argument
1914 fl = lease_alloc(filp, arg); in do_fcntl_add_lease()
1925 error = vfs_setlease(filp, arg, &fl, (void **)&new); in do_fcntl_add_lease()
1943 int fcntl_setlease(unsigned int fd, struct file *filp, long arg) in fcntl_setlease() argument
1946 return vfs_setlease(filp, F_UNLCK, NULL, (void **)&filp); in fcntl_setlease()
1947 return do_fcntl_add_lease(fd, filp, arg); in fcntl_setlease()
2082 int vfs_test_lock(struct file *filp, struct file_lock *fl) in vfs_test_lock() argument
2084 if (filp->f_op->lock) in vfs_test_lock()
2085 return filp->f_op->lock(filp, F_GETLK, fl); in vfs_test_lock()
2086 posix_test_lock(filp, fl); in vfs_test_lock()
2158 int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock *flock) in fcntl_getlk() argument
2170 error = flock_to_posix_lock(filp, fl, flock); in fcntl_getlk()
2180 fl->fl_owner = filp; in fcntl_getlk()
2183 error = vfs_test_lock(filp, fl); in fcntl_getlk()
2231 int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) in vfs_lock_file() argument
2233 if (filp->f_op->lock) in vfs_lock_file()
2234 return filp->f_op->lock(filp, cmd, fl); in vfs_lock_file()
2236 return posix_lock_file(filp, fl, conf); in vfs_lock_file()
2240 static int do_lock_file_wait(struct file *filp, unsigned int cmd, in do_lock_file_wait() argument
2245 error = security_file_lock(filp, fl->fl_type); in do_lock_file_wait()
2250 error = vfs_lock_file(filp, cmd, fl, NULL); in do_lock_file_wait()
2282 int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk() argument
2286 struct inode *inode = locks_inode(filp); in fcntl_setlk()
2293 error = flock_to_posix_lock(filp, file_lock, flock); in fcntl_setlk()
2313 file_lock->fl_owner = filp; in fcntl_setlk()
2322 file_lock->fl_owner = filp; in fcntl_setlk()
2328 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2346 if (f != filp) { in fcntl_setlk()
2348 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2363 int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 *flock) in fcntl_getlk64() argument
2376 error = flock64_to_posix_lock(filp, fl, flock); in fcntl_getlk64()
2387 fl->fl_owner = filp; in fcntl_getlk64()
2390 error = vfs_test_lock(filp, fl); in fcntl_getlk64()
2406 int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk64() argument
2416 error = flock64_to_posix_lock(filp, file_lock, flock); in fcntl_setlk64()
2436 file_lock->fl_owner = filp; in fcntl_setlk64()
2445 file_lock->fl_owner = filp; in fcntl_setlk64()
2451 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2469 if (f != filp) { in fcntl_setlk64()
2471 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2487 void locks_remove_posix(struct file *filp, fl_owner_t owner) in locks_remove_posix() argument
2490 struct inode *inode = locks_inode(filp); in locks_remove_posix()
2510 lock.fl_file = filp; in locks_remove_posix()
2514 error = vfs_lock_file(filp, F_SETLK, &lock, NULL); in locks_remove_posix()
2524 locks_remove_flock(struct file *filp, struct file_lock_context *flctx) in locks_remove_flock() argument
2527 struct inode *inode = locks_inode(filp); in locks_remove_flock()
2532 flock_make_lock(filp, LOCK_UN, &fl); in locks_remove_flock()
2535 if (filp->f_op->flock) in locks_remove_flock()
2536 filp->f_op->flock(filp, F_SETLKW, &fl); in locks_remove_flock()
2546 locks_remove_lease(struct file *filp, struct file_lock_context *ctx) in locks_remove_lease() argument
2557 if (filp == fl->fl_file) in locks_remove_lease()
2568 void locks_remove_file(struct file *filp) in locks_remove_file() argument
2572 ctx = smp_load_acquire(&locks_inode(filp)->i_flctx); in locks_remove_file()
2577 locks_remove_posix(filp, filp); in locks_remove_file()
2580 locks_remove_flock(filp, ctx); in locks_remove_file()
2583 locks_remove_lease(filp, ctx); in locks_remove_file()
2586 locks_check_ctx_file_list(filp, &ctx->flc_posix, "POSIX"); in locks_remove_file()
2587 locks_check_ctx_file_list(filp, &ctx->flc_flock, "FLOCK"); in locks_remove_file()
2588 locks_check_ctx_file_list(filp, &ctx->flc_lease, "LEASE"); in locks_remove_file()
2599 int vfs_cancel_lock(struct file *filp, struct file_lock *fl) in vfs_cancel_lock() argument
2601 if (filp->f_op->lock) in vfs_cancel_lock()
2602 return filp->f_op->lock(filp, F_CANCELLK, fl); in vfs_cancel_lock()
2752 struct file *filp, struct files_struct *files) in __show_fd_locks() argument
2758 if (filp != fl->fl_file) in __show_fd_locks()
2761 fl->fl_owner != filp) in __show_fd_locks()
2771 struct file *filp, struct files_struct *files) in show_fd_locks() argument
2773 struct inode *inode = locks_inode(filp); in show_fd_locks()
2782 __show_fd_locks(f, &ctx->flc_flock, &id, filp, files); in show_fd_locks()
2783 __show_fd_locks(f, &ctx->flc_posix, &id, filp, files); in show_fd_locks()
2784 __show_fd_locks(f, &ctx->flc_lease, &id, filp, files); in show_fd_locks()