Lines Matching refs:mnt
377 static inline int do_inode_permission(struct vfsmount *mnt, struct inode *inode, int mask) in do_inode_permission() argument
380 if (likely(mnt && inode->i_op->permission2)) in do_inode_permission()
381 return inode->i_op->permission2(mnt, inode, mask); in do_inode_permission()
405 int __inode_permission2(struct vfsmount *mnt, struct inode *inode, int mask) in __inode_permission2() argument
417 retval = do_inode_permission(mnt, inode, mask); in __inode_permission2()
468 int inode_permission2(struct vfsmount *mnt, struct inode *inode, int mask) in inode_permission2() argument
475 return __inode_permission2(mnt, inode, mask); in inode_permission2()
493 mntget(path->mnt); in path_get()
507 mntput(path->mnt); in path_put()
588 struct vfsmount *mnt = path->mnt; in path_connected() local
589 struct super_block *sb = mnt->mnt_sb; in path_connected()
592 if (!(sb->s_iflags & SB_I_MULTIROOT) && (mnt->mnt_root == sb->s_root)) in path_connected()
595 return is_subdir(path->dentry, mnt->mnt_root); in path_connected()
628 if (nd->root.mnt && !(nd->flags & LOOKUP_ROOT)) { in terminate_walk()
630 nd->root.mnt = NULL; in terminate_walk()
635 nd->root.mnt = NULL; in terminate_walk()
645 int res = __legitimize_mnt(path->mnt, nd->m_seq); in legitimize_path()
648 path->mnt = NULL; in legitimize_path()
706 if (unlikely(!legitimize_mnt(nd->path.mnt, nd->m_seq))) in unlazy_walk()
737 if (nd->root.mnt && !(nd->flags & LOOKUP_ROOT)) { in unlazy_walk()
753 nd->path.mnt = NULL; in unlazy_walk()
760 nd->root.mnt = NULL; in unlazy_walk()
770 nd->path.mnt = NULL; in unlazy_link()
773 nd->root.mnt = NULL; in unlazy_link()
804 nd->root.mnt = NULL; in complete_walk()
845 if (path->mnt != nd->path.mnt) in path_put_conditional()
846 mntput(path->mnt); in path_put_conditional()
854 if (nd->path.mnt != path->mnt) in path_to_nameidata()
855 mntput(nd->path.mnt); in path_to_nameidata()
857 nd->path.mnt = path->mnt; in path_to_nameidata()
1081 if (!nd->root.mnt) in get_link()
1090 if (!nd->root.mnt) in get_link()
1118 struct mount *mnt = real_mount(path->mnt); in follow_up() local
1123 parent = mnt->mnt_parent; in follow_up()
1124 if (parent == mnt) { in follow_up()
1128 mntget(&parent->mnt); in follow_up()
1129 mountpoint = dget(mnt->mnt_mountpoint); in follow_up()
1133 mntput(path->mnt); in follow_up()
1134 path->mnt = &parent->mnt; in follow_up()
1147 struct vfsmount *mnt; in follow_automount() local
1173 mnt = path->dentry->d_op->d_automount(path); in follow_automount()
1174 if (IS_ERR(mnt)) { in follow_automount()
1184 if (PTR_ERR(mnt) == -EISDIR && (nd->flags & LOOKUP_PARENT)) in follow_automount()
1186 return PTR_ERR(mnt); in follow_automount()
1189 if (!mnt) /* mount collision */ in follow_automount()
1194 mntget(path->mnt); in follow_automount()
1197 err = finish_automount(mnt, path); in follow_automount()
1205 path->mnt = mnt; in follow_automount()
1206 path->dentry = dget(mnt->mnt_root); in follow_automount()
1226 struct vfsmount *mnt = path->mnt; /* held by caller, must be left alone */ in follow_managed() local
1253 mntput(path->mnt); in follow_managed()
1254 path->mnt = mounted; in follow_managed()
1278 if (need_mntput && path->mnt == mnt) in follow_managed()
1279 mntput(path->mnt); in follow_managed()
1296 mntput(path->mnt); in follow_down_one()
1297 path->mnt = mounted; in follow_down_one()
1337 mounted = __lookup_mnt(path->mnt, path->dentry); in __follow_mount_rcu()
1340 path->mnt = &mounted->mnt; in __follow_mount_rcu()
1341 path->dentry = mounted->mnt.mnt_root; in __follow_mount_rcu()
1358 if (!nd->root.mnt) in follow_dotdot_rcu()
1364 if (nd->path.dentry != nd->path.mnt->mnt_root) { in follow_dotdot_rcu()
1379 struct mount *mnt = real_mount(nd->path.mnt); in follow_dotdot_rcu() local
1380 struct mount *mparent = mnt->mnt_parent; in follow_dotdot_rcu()
1381 struct dentry *mountpoint = mnt->mnt_mountpoint; in follow_dotdot_rcu()
1386 if (&mparent->mnt == nd->path.mnt) in follow_dotdot_rcu()
1390 nd->path.mnt = &mparent->mnt; in follow_dotdot_rcu()
1397 mounted = __lookup_mnt(nd->path.mnt, nd->path.dentry); in follow_dotdot_rcu()
1402 nd->path.mnt = &mounted->mnt; in follow_dotdot_rcu()
1403 nd->path.dentry = mounted->mnt.mnt_root; in follow_dotdot_rcu()
1448 mntput(path->mnt); in follow_down()
1449 path->mnt = mounted; in follow_down()
1471 mntput(path->mnt); in follow_mount()
1472 path->mnt = mounted; in follow_mount()
1479 if (!nd->root.mnt) in follow_dotdot()
1486 nd->path.mnt == nd->root.mnt) { in follow_dotdot()
1489 if (nd->path.dentry != nd->path.mnt->mnt_root) { in follow_dotdot()
1593 struct vfsmount *mnt = nd->path.mnt; in lookup_fast() local
1645 path->mnt = mnt; in lookup_fast()
1675 path->mnt = mnt; in lookup_fast()
1699 path->mnt = nd->path.mnt; in lookup_slow()
1707 int err = inode_permission2(nd->path.mnt, nd->inode, MAY_EXEC|MAY_NOT_BLOCK); in may_lookup()
1713 return inode_permission2(nd->path.mnt, nd->inode, MAY_EXEC); in may_lookup()
1737 if (link->mnt == nd->path.mnt) in pick_link()
1738 mntget(link->mnt); in pick_link()
2070 struct vfsmount *mnt = nd->root.mnt; in path_init() local
2075 retval = inode_permission2(mnt, inode, MAY_EXEC); in path_init()
2092 nd->root.mnt = NULL; in path_init()
2156 nd->root.mnt = NULL; in path_init()
2211 nd->path.mnt = NULL; in path_lookupat()
2256 nd->path.mnt = NULL; in path_parentat()
2332 int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, in vfs_path_lookup() argument
2336 struct path root = {.mnt = mnt, .dentry = dentry}; in vfs_path_lookup()
2353 struct dentry *lookup_one_len2(const char *name, struct vfsmount *mnt, struct dentry *base, int len) in lookup_one_len2() argument
2387 err = inode_permission2(mnt, base->d_inode, MAY_EXEC); in lookup_one_len2()
2506 path->mnt = nd->path.mnt; in mountpoint_last()
2511 mntget(path->mnt); in mountpoint_last()
2625 static int may_delete(struct vfsmount *mnt, struct inode *dir, struct dentry *victim, bool isdir) in may_delete() argument
2637 error = inode_permission2(mnt, dir, MAY_WRITE | MAY_EXEC); in may_delete()
2668 static inline int may_create(struct vfsmount *mnt, struct inode *dir, struct dentry *child) in may_create() argument
2675 return inode_permission2(mnt, dir, MAY_WRITE | MAY_EXEC); in may_create()
2722 int vfs_create2(struct vfsmount *mnt, struct inode *dir, struct dentry *dentry, in vfs_create2() argument
2725 int error = may_create(mnt, dir, dentry); in vfs_create2()
2753 struct vfsmount *mnt = path->mnt; in may_open() local
2773 if (path->mnt->mnt_flags & MNT_NODEV) in may_open()
2782 error = inode_permission2(mnt, inode, acc_mode); in may_open()
2817 error = do_truncate2(path->mnt, path->dentry, 0, in handle_truncate()
2838 error = inode_permission2(dir->mnt, dir->dentry->d_inode, MAY_WRITE | MAY_EXEC); in may_o_create()
2931 file->f_path.mnt = nd->path.mnt; in atomic_open()
2996 path->mnt = nd->path.mnt; in atomic_open()
3024 struct vfsmount *mnt = nd->path.mnt; in lookup_open() local
3072 error = vfs_create2(mnt, dir->d_inode, dentry, mode, in lookup_open()
3079 path->mnt = nd->path.mnt; in lookup_open()
3103 struct path save_parent = { .dentry = NULL, .mnt = NULL }; in do_last()
3149 error = mnt_want_write(nd->path.mnt); in do_last()
3195 mnt_drop_write(nd->path.mnt); in do_last()
3223 if ((nd->flags & LOOKUP_RCU) || nd->path.mnt != path.mnt) { in do_last()
3227 save_parent.mnt = mntget(path.mnt); in do_last()
3261 error = mnt_want_write(nd->path.mnt); in do_last()
3299 mnt_drop_write(nd->path.mnt); in do_last()
3316 save_parent.mnt = NULL; in do_last()
3319 mnt_drop_write(nd->path.mnt); in do_last()
3337 error = mnt_want_write(path.mnt); in do_tmpfile()
3342 error = inode_permission2(path.mnt, dir, MAY_WRITE | MAY_EXEC); in do_tmpfile()
3364 file->f_path.mnt = path.mnt; in do_tmpfile()
3378 mnt_drop_write(path.mnt); in do_tmpfile()
3452 struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt, in do_file_open_root() argument
3460 nd.root.mnt = mnt; in do_file_open_root()
3509 err2 = mnt_want_write(path->mnt); in filename_create()
3545 mnt_drop_write(path->mnt); in filename_create()
3564 mnt_drop_write(path->mnt); in done_path_create()
3576 int vfs_mknod2(struct vfsmount *mnt, struct inode *dir, struct dentry *dentry, umode_t mode, dev_t … in vfs_mknod2() argument
3578 int error = may_create(mnt, dir, dentry); in vfs_mknod2()
3650 error = vfs_create2(path.mnt, path.dentry->d_inode,dentry,mode,true); in SYSCALL_DEFINE4()
3653 error = vfs_mknod2(path.mnt, path.dentry->d_inode,dentry,mode, in SYSCALL_DEFINE4()
3674 int vfs_mkdir2(struct vfsmount *mnt, struct inode *dir, struct dentry *dentry, umode_t mode) in vfs_mkdir2() argument
3676 int error = may_create(mnt, dir, dentry); in vfs_mkdir2()
3722 error = vfs_mkdir2(path.mnt, path.dentry->d_inode, dentry, mode); in SYSCALL_DEFINE3()
3761 int vfs_rmdir2(struct vfsmount *mnt, struct inode *dir, struct dentry *dentry) in vfs_rmdir2() argument
3763 int error = may_delete(mnt, dir, dentry, 1); in vfs_rmdir2()
3833 error = mnt_want_write(path.mnt); in do_rmdir()
3849 error = vfs_rmdir2(path.mnt, path.dentry->d_inode, dentry); in do_rmdir()
3854 mnt_drop_write(path.mnt); in do_rmdir()
3888 int vfs_unlink2(struct vfsmount *mnt, struct inode *dir, struct dentry *dentry, struct inode **dele… in vfs_unlink2() argument
3891 int error = may_delete(mnt, dir, dentry, 0); in vfs_unlink2()
3961 error = mnt_want_write(path.mnt); in do_unlinkat()
3979 error = vfs_unlink2(path.mnt, path.dentry->d_inode, dentry, &delegated_inode); in do_unlinkat()
3992 mnt_drop_write(path.mnt); in do_unlinkat()
4029 int vfs_symlink2(struct vfsmount *mnt, struct inode *dir, struct dentry *dentry, const char *oldnam… in vfs_symlink2() argument
4031 int error = may_create(mnt, dir, dentry); in vfs_symlink2()
4076 error = vfs_symlink2(path.mnt, path.dentry->d_inode, dentry, from->name); in SYSCALL_DEFINE3()
4111 int vfs_link2(struct vfsmount *mnt, struct dentry *old_dentry, struct inode *dir, struct dentry *ne… in vfs_link2() argument
4120 error = may_create(mnt, dir, new_dentry); in vfs_link2()
4216 if (old_path.mnt != new_path.mnt) in SYSCALL_DEFINE5()
4224 …error = vfs_link2(old_path.mnt, old_path.dentry, new_path.dentry->d_inode, new_dentry, &delegated_… in SYSCALL_DEFINE5()
4299 int vfs_rename2(struct vfsmount *mnt, in vfs_rename2() argument
4319 error = may_delete(mnt, old_dir, old_dentry, is_dir); in vfs_rename2()
4324 error = may_create(mnt, new_dir, new_dentry); in vfs_rename2()
4329 error = may_delete(mnt, new_dir, new_dentry, is_dir); in vfs_rename2()
4331 error = may_delete(mnt, new_dir, new_dentry, new_is_dir); in vfs_rename2()
4348 error = inode_permission2(mnt, source, MAY_WRITE); in vfs_rename2()
4353 error = inode_permission2(mnt, target, MAY_WRITE); in vfs_rename2()
4490 if (old_path.mnt != new_path.mnt) in SYSCALL_DEFINE5()
4502 error = mnt_want_write(old_path.mnt); in SYSCALL_DEFINE5()
4557 error = vfs_rename2(old_path.mnt, old_path.dentry->d_inode, old_dentry, in SYSCALL_DEFINE5()
4571 mnt_drop_write(old_path.mnt); in SYSCALL_DEFINE5()