diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-06-14 19:01:42 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-14 08:35:02 -0400 |
commit | 79714f72d3b964611997de512cb29198c9f2dbbb (patch) | |
tree | 27560778736691d1edb8276897f4ed3b9411bcb2 /fs/namei.c | |
parent | 1acf0af9b981027f3e73e93f0d3f85abdc794f71 (diff) |
get rid of kern_path_parent()
all callers want the same thing, actually - a kinda-sorta analog of
kern_path_create(). I.e. they want parent vfsmount/dentry (with
->i_mutex held, to make sure the child dentry is still their child)
+ the child dentry.
Signed-off-by Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c index 5abab9176903..6b29a51bef5d 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1814,9 +1814,27 @@ static int do_path_lookup(int dfd, const char *name, | |||
1814 | return retval; | 1814 | return retval; |
1815 | } | 1815 | } |
1816 | 1816 | ||
1817 | int kern_path_parent(const char *name, struct nameidata *nd) | 1817 | /* does lookup, returns the object with parent locked */ |
1818 | struct dentry *kern_path_locked(const char *name, struct path *path) | ||
1818 | { | 1819 | { |
1819 | return do_path_lookup(AT_FDCWD, name, LOOKUP_PARENT, nd); | 1820 | struct nameidata nd; |
1821 | struct dentry *d; | ||
1822 | int err = do_path_lookup(AT_FDCWD, name, LOOKUP_PARENT, &nd); | ||
1823 | if (err) | ||
1824 | return ERR_PTR(err); | ||
1825 | if (nd.last_type != LAST_NORM) { | ||
1826 | path_put(&nd.path); | ||
1827 | return ERR_PTR(-EINVAL); | ||
1828 | } | ||
1829 | mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); | ||
1830 | d = lookup_one_len(nd.last.name, nd.path.dentry, nd.last.len); | ||
1831 | if (IS_ERR(d)) { | ||
1832 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | ||
1833 | path_put(&nd.path); | ||
1834 | return d; | ||
1835 | } | ||
1836 | *path = nd.path; | ||
1837 | return d; | ||
1820 | } | 1838 | } |
1821 | 1839 | ||
1822 | int kern_path(const char *name, unsigned int flags, struct path *path) | 1840 | int kern_path(const char *name, unsigned int flags, struct path *path) |