Lines Matching refs:filp

266 locks_check_ctx_file_list(struct file *filp, struct list_head *list,  in locks_check_ctx_file_list()  argument
270 struct inode *inode = locks_inode(filp); in locks_check_ctx_file_list()
273 if (fl->fl_file == filp) in locks_check_ctx_file_list()
419 flock_make_lock(struct file *filp, unsigned int cmd) in flock_make_lock() argument
431 fl->fl_file = filp; in flock_make_lock()
432 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, long 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, long type) in lease_alloc() argument
578 error = lease_init(filp, type, fl); in lease_alloc()
813 posix_test_lock(struct file *filp, struct file_lock *fl) in posix_test_lock() argument
817 struct inode *inode = locks_inode(filp); in posix_test_lock()
1218 int posix_lock_file(struct file *filp, struct file_lock *fl, in posix_lock_file() argument
1221 return posix_lock_inode(locks_inode(filp), fl, conflock); in posix_lock_file()
1295 int locks_mandatory_area(struct inode *inode, struct file *filp, loff_t start, in locks_mandatory_area() argument
1304 fl.fl_file = filp; in locks_mandatory_area()
1306 if (filp && !(filp->f_flags & O_NONBLOCK)) in locks_mandatory_area()
1313 if (filp) { in locks_mandatory_area()
1314 fl.fl_owner = filp; in locks_mandatory_area()
1368 struct file *filp = fl->fl_file; in lease_modify() local
1370 f_delown(filp); in lease_modify()
1371 filp->f_owner.signum = 0; in lease_modify()
1602 int fcntl_getlease(struct file *filp) in fcntl_getlease() argument
1605 struct inode *inode = locks_inode(filp); in fcntl_getlease()
1616 if (fl->fl_file != filp) in fcntl_getlease()
1660 generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv) in generic_add_lease() argument
1663 struct dentry *dentry = filp->f_path.dentry; in generic_add_lease()
1713 if (fl->fl_file == filp && in generic_add_lease()
1776 static int generic_delete_lease(struct file *filp, void *owner) in generic_delete_lease() argument
1780 struct inode *inode = locks_inode(filp); in generic_delete_lease()
1793 if (fl->fl_file == filp && in generic_delete_lease()
1819 int generic_setlease(struct file *filp, long arg, struct file_lock **flp, in generic_setlease() argument
1822 struct inode *inode = locks_inode(filp); in generic_setlease()
1829 error = security_file_lock(filp, arg); in generic_setlease()
1835 return generic_delete_lease(filp, *priv); in generic_setlease()
1843 return generic_add_lease(filp, arg, flp, priv); in generic_setlease()
1868 vfs_setlease(struct file *filp, long arg, struct file_lock **lease, void **priv) in vfs_setlease() argument
1870 if (filp->f_op->setlease) in vfs_setlease()
1871 return filp->f_op->setlease(filp, arg, lease, priv); in vfs_setlease()
1873 return generic_setlease(filp, arg, lease, priv); in vfs_setlease()
1877 static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) in do_fcntl_add_lease() argument
1883 fl = lease_alloc(filp, arg); in do_fcntl_add_lease()
1894 error = vfs_setlease(filp, arg, &fl, (void **)&new); in do_fcntl_add_lease()
1912 int fcntl_setlease(unsigned int fd, struct file *filp, long arg) in fcntl_setlease() argument
1915 return vfs_setlease(filp, F_UNLCK, NULL, (void **)&filp); in fcntl_setlease()
1916 return do_fcntl_add_lease(fd, filp, arg); in fcntl_setlease()
2041 int vfs_test_lock(struct file *filp, struct file_lock *fl) in vfs_test_lock() argument
2043 if (filp->f_op->lock) in vfs_test_lock()
2044 return filp->f_op->lock(filp, F_GETLK, fl); in vfs_test_lock()
2045 posix_test_lock(filp, fl); in vfs_test_lock()
2117 int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock *flock) in fcntl_getlk() argument
2129 error = flock_to_posix_lock(filp, fl, flock); in fcntl_getlk()
2140 fl->fl_owner = filp; in fcntl_getlk()
2143 error = vfs_test_lock(filp, fl); in fcntl_getlk()
2191 int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) in vfs_lock_file() argument
2193 if (filp->f_op->lock) in vfs_lock_file()
2194 return filp->f_op->lock(filp, cmd, fl); in vfs_lock_file()
2196 return posix_lock_file(filp, fl, conf); in vfs_lock_file()
2200 static int do_lock_file_wait(struct file *filp, unsigned int cmd, in do_lock_file_wait() argument
2205 error = security_file_lock(filp, fl->fl_type); in do_lock_file_wait()
2210 error = vfs_lock_file(filp, cmd, fl, NULL); in do_lock_file_wait()
2243 int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk() argument
2247 struct inode *inode = locks_inode(filp); in fcntl_setlk()
2257 if (mandatory_lock(inode) && mapping_writably_mapped(filp->f_mapping)) { in fcntl_setlk()
2262 error = flock_to_posix_lock(filp, file_lock, flock); in fcntl_setlk()
2282 file_lock->fl_owner = filp; in fcntl_setlk()
2291 file_lock->fl_owner = filp; in fcntl_setlk()
2297 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2314 if (f != filp) { in fcntl_setlk()
2316 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2331 int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 *flock) in fcntl_getlk64() argument
2344 error = flock64_to_posix_lock(filp, fl, flock); in fcntl_getlk64()
2355 fl->fl_owner = filp; in fcntl_getlk64()
2358 error = vfs_test_lock(filp, fl); in fcntl_getlk64()
2374 int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk64() argument
2378 struct inode *inode = locks_inode(filp); in fcntl_setlk64()
2388 if (mandatory_lock(inode) && mapping_writably_mapped(filp->f_mapping)) { in fcntl_setlk64()
2393 error = flock64_to_posix_lock(filp, file_lock, flock); in fcntl_setlk64()
2413 file_lock->fl_owner = filp; in fcntl_setlk64()
2422 file_lock->fl_owner = filp; in fcntl_setlk64()
2428 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2445 if (f != filp) { in fcntl_setlk64()
2447 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2463 void locks_remove_posix(struct file *filp, fl_owner_t owner) in locks_remove_posix() argument
2466 struct inode *inode = locks_inode(filp); in locks_remove_posix()
2485 lock.fl_file = filp; in locks_remove_posix()
2489 error = vfs_lock_file(filp, F_SETLK, &lock, NULL); in locks_remove_posix()
2500 locks_remove_flock(struct file *filp, struct file_lock_context *flctx) in locks_remove_flock() argument
2503 .fl_owner = filp, in locks_remove_flock()
2505 .fl_file = filp, in locks_remove_flock()
2510 struct inode *inode = locks_inode(filp); in locks_remove_flock()
2515 if (filp->f_op->flock) in locks_remove_flock()
2516 filp->f_op->flock(filp, F_SETLKW, &fl); in locks_remove_flock()
2526 locks_remove_lease(struct file *filp, struct file_lock_context *ctx) in locks_remove_lease() argument
2537 if (filp == fl->fl_file) in locks_remove_lease()
2548 void locks_remove_file(struct file *filp) in locks_remove_file() argument
2552 ctx = smp_load_acquire(&locks_inode(filp)->i_flctx); in locks_remove_file()
2557 locks_remove_posix(filp, filp); in locks_remove_file()
2560 locks_remove_flock(filp, ctx); in locks_remove_file()
2563 locks_remove_lease(filp, ctx); in locks_remove_file()
2566 locks_check_ctx_file_list(filp, &ctx->flc_posix, "POSIX"); in locks_remove_file()
2567 locks_check_ctx_file_list(filp, &ctx->flc_flock, "FLOCK"); in locks_remove_file()
2568 locks_check_ctx_file_list(filp, &ctx->flc_lease, "LEASE"); in locks_remove_file()
2600 int vfs_cancel_lock(struct file *filp, struct file_lock *fl) in vfs_cancel_lock() argument
2602 if (filp->f_op->lock) in vfs_cancel_lock()
2603 return filp->f_op->lock(filp, F_CANCELLK, fl); in vfs_cancel_lock()
2718 struct file *filp, struct files_struct *files) in __show_fd_locks() argument
2724 if (filp != fl->fl_file) in __show_fd_locks()
2727 fl->fl_owner != filp) in __show_fd_locks()
2737 struct file *filp, struct files_struct *files) in show_fd_locks() argument
2739 struct inode *inode = locks_inode(filp); in show_fd_locks()
2748 __show_fd_locks(f, &ctx->flc_flock, &id, filp, files); in show_fd_locks()
2749 __show_fd_locks(f, &ctx->flc_posix, &id, filp, files); in show_fd_locks()
2750 __show_fd_locks(f, &ctx->flc_lease, &id, filp, files); in show_fd_locks()