Lines Matching refs:filp

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