Lines Matching refs:filp
42 * with a file pointer (filp). As a result they can be shared by a parent
308 locks_check_ctx_file_list(struct file *filp, struct list_head *list,
312 struct inode *inode = locks_inode(filp);
315 if (fl->fl_file == filp)
479 flock_make_lock(struct file *filp, unsigned int cmd, struct file_lock *fl)
494 fl->fl_file = filp;
495 fl->fl_owner = filp;
518 static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,
526 fl->fl_start = filp->f_pos;
529 fl->fl_start = i_size_read(file_inode(filp));
557 fl->fl_file = filp;
568 static int flock_to_posix_lock(struct file *filp, struct file_lock *fl,
578 return flock64_to_posix_lock(filp, fl, &ll);
592 struct file *filp = fl->fl_file;
600 if (!fasync_insert_entry(fa->fa_fd, filp, &fl->fl_fasync, fa))
603 __f_setown(filp, task_pid(current), PIDTYPE_TGID, 0);
615 static int lease_init(struct file *filp, long type, struct file_lock *fl)
620 fl->fl_owner = filp;
623 fl->fl_file = filp;
633 static struct file_lock *lease_alloc(struct file *filp, long type)
641 error = lease_init(filp, type, fl);
940 /* FLOCK locks referring to the same filp do not conflict with
952 posix_test_lock(struct file *filp, struct file_lock *fl)
956 struct inode *inode = locks_inode(filp);
1001 * For FL_OFDLCK locks, the owner is the filp, not the files_struct.
1052 /* Try to create a FLOCK lock on filp. We always insert new FLOCK locks
1357 * @filp: The file to apply the lock to
1369 int posix_lock_file(struct file *filp, struct file_lock *fl,
1372 return posix_lock_inode(locks_inode(filp), fl, conflock);
1438 * @filp: how the file was opened (if it was)
1445 int locks_mandatory_area(struct inode *inode, struct file *filp, loff_t start,
1454 fl.fl_file = filp;
1456 if (filp && !(filp->f_flags & O_NONBLOCK))
1463 if (filp) {
1464 fl.fl_owner = filp;
1518 struct file *filp = fl->fl_file;
1520 f_delown(filp);
1521 filp->f_owner.signum = 0;
1744 * @filp: the file
1765 int fcntl_getlease(struct file *filp)
1768 struct inode *inode = locks_inode(filp);
1779 if (fl->fl_file != filp)
1796 * @filp: file to check
1804 check_conflicting_open(struct file *filp, const long arg, int flags)
1806 struct inode *inode = locks_inode(filp);
1823 if (filp->f_mode & FMODE_WRITE)
1825 else if (filp->f_mode & FMODE_READ)
1836 generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv)
1839 struct inode *inode = locks_inode(filp);
1874 error = check_conflicting_open(filp, arg, lease->fl_flags);
1880 * lease on this file, then we hold it on this filp
1884 * except for this filp.
1888 if (fl->fl_file == filp &&
1931 error = check_conflicting_open(filp, arg, lease->fl_flags);
1951 static int generic_delete_lease(struct file *filp, void *owner)
1955 struct inode *inode = locks_inode(filp);
1968 if (fl->fl_file == filp &&
1985 * @filp: file pointer
1994 int generic_setlease(struct file *filp, long arg, struct file_lock **flp,
1997 struct inode *inode = locks_inode(filp);
2004 error = security_file_lock(filp, arg);
2010 return generic_delete_lease(filp, *priv);
2018 return generic_add_lease(filp, arg, flp, priv);
2085 * @filp: file pointer
2101 vfs_setlease(struct file *filp, long arg, struct file_lock **lease, void **priv)
2105 if (filp->f_op->setlease)
2106 return filp->f_op->setlease(filp, arg, lease, priv);
2108 return generic_setlease(filp, arg, lease, priv);
2112 static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg)
2118 fl = lease_alloc(filp, arg);
2129 error = vfs_setlease(filp, arg, &fl, (void **)&new);
2140 * @filp: file pointer
2147 int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
2150 return vfs_setlease(filp, F_UNLCK, NULL, (void **)&filp);
2151 return do_fcntl_add_lease(fd, filp, arg);
2269 * @filp: The file to test lock for
2275 int vfs_test_lock(struct file *filp, struct file_lock *fl)
2277 if (filp->f_op->lock)
2278 return filp->f_op->lock(filp, F_GETLK, fl);
2279 posix_test_lock(filp, fl);
2351 int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock *flock)
2363 error = flock_to_posix_lock(filp, fl, flock);
2374 fl->fl_owner = filp;
2377 error = vfs_test_lock(filp, fl);
2394 * @filp: The file to apply the lock to
2425 int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf)
2427 if (filp->f_op->lock)
2428 return filp->f_op->lock(filp, cmd, fl);
2430 return posix_lock_file(filp, fl, conf);
2434 static int do_lock_file_wait(struct file *filp, unsigned int cmd,
2439 error = security_file_lock(filp, fl->fl_type);
2444 error = vfs_lock_file(filp, cmd, fl, NULL);
2476 int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
2480 struct inode *inode = locks_inode(filp);
2490 if (mandatory_lock(inode) && mapping_writably_mapped(filp->f_mapping)) {
2495 error = flock_to_posix_lock(filp, file_lock, flock);
2515 file_lock->fl_owner = filp;
2524 file_lock->fl_owner = filp;
2530 error = do_lock_file_wait(filp, cmd, file_lock);
2549 if (f != filp) {
2550 locks_remove_posix(filp, files);
2564 int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 *flock)
2577 error = flock64_to_posix_lock(filp, fl, flock);
2588 fl->fl_owner = filp;
2591 error = vfs_test_lock(filp, fl);
2607 int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
2611 struct inode *inode = locks_inode(filp);
2621 if (mandatory_lock(inode) && mapping_writably_mapped(filp->f_mapping)) {
2626 error = flock64_to_posix_lock(filp, file_lock, flock);
2646 file_lock->fl_owner = filp;
2655 file_lock->fl_owner = filp;
2661 error = do_lock_file_wait(filp, cmd, file_lock);
2680 if (f != filp) {
2681 locks_remove_posix(filp, files);
2696 void locks_remove_posix(struct file *filp, fl_owner_t owner)
2699 struct inode *inode = locks_inode(filp);
2719 lock.fl_file = filp;
2723 error = vfs_lock_file(filp, F_SETLK, &lock, NULL);
2733 locks_remove_flock(struct file *filp, struct file_lock_context *flctx)
2736 struct inode *inode = locks_inode(filp);
2741 flock_make_lock(filp, LOCK_UN, &fl);
2744 if (filp->f_op->flock)
2745 filp->f_op->flock(filp, F_SETLKW, &fl);
2755 locks_remove_lease(struct file *filp, struct file_lock_context *ctx)
2766 if (filp == fl->fl_file)
2777 void locks_remove_file(struct file *filp)
2781 ctx = smp_load_acquire(&locks_inode(filp)->i_flctx);
2786 locks_remove_posix(filp, filp);
2789 locks_remove_flock(filp, ctx);
2792 locks_remove_lease(filp, ctx);
2795 locks_check_ctx_file_list(filp, &ctx->flc_posix, "POSIX");
2796 locks_check_ctx_file_list(filp, &ctx->flc_flock, "FLOCK");
2797 locks_check_ctx_file_list(filp, &ctx->flc_lease, "LEASE");
2803 * @filp: The file to apply the unblock to
2808 int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
2810 if (filp->f_op->lock)
2811 return filp->f_op->lock(filp, F_CANCELLK, fl);
2948 struct file *filp, struct files_struct *files)
2954 if (filp != fl->fl_file)
2957 fl->fl_owner != filp)
2967 struct file *filp, struct files_struct *files)
2969 struct inode *inode = locks_inode(filp);
2978 __show_fd_locks(f, &ctx->flc_flock, &id, filp, files);
2979 __show_fd_locks(f, &ctx->flc_posix, &id, filp, files);
2980 __show_fd_locks(f, &ctx->flc_lease, &id, filp, files);