aboutsummaryrefslogtreecommitdiff
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-07-20 01:15:31 +0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-29 21:24:13 +0400
commit921a1650de9eed40dd64d681aba4a4d98856f289 (patch)
treec4740f5ee8de85ebbb1b519acf2b8e249bce0c56 /fs/namei.c
parent25b2692a8ace4c2684d3899a0bfe55f8c4248899 (diff)
new helper: done_path_create()
releases what needs to be released after {kern,user}_path_create() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 2ccc35c4dc24..5bc6f3d1dc8a 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2893,6 +2893,14 @@ out:
}
EXPORT_SYMBOL(kern_path_create);
+void done_path_create(struct path *path, struct dentry *dentry)
+{
+ dput(dentry);
+ mutex_unlock(&path->dentry->d_inode->i_mutex);
+ path_put(path);
+}
+EXPORT_SYMBOL(done_path_create);
+
struct dentry *user_path_create(int dfd, const char __user *pathname, struct path *path, int is_dir)
{
char *tmp = getname(pathname);
@@ -2989,9 +2997,7 @@ SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, umode_t, mode,
out_drop_write:
mnt_drop_write(path.mnt);
out_dput:
- dput(dentry);
- mutex_unlock(&path.dentry->d_inode->i_mutex);
- path_put(&path);
+ done_path_create(&path, dentry);
return error;
}
@@ -3048,9 +3054,7 @@ SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, umode_t, mode)
out_drop_write:
mnt_drop_write(path.mnt);
out_dput:
- dput(dentry);
- mutex_unlock(&path.dentry->d_inode->i_mutex);
- path_put(&path);
+ done_path_create(&path, dentry);
return error;
}
@@ -3334,9 +3338,7 @@ SYSCALL_DEFINE3(symlinkat, const char __user *, oldname,
out_drop_write:
mnt_drop_write(path.mnt);
out_dput:
- dput(dentry);
- mutex_unlock(&path.dentry->d_inode->i_mutex);
- path_put(&path);
+ done_path_create(&path, dentry);
out_putname:
putname(from);
return error;
@@ -3446,9 +3448,7 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
out_drop_write:
mnt_drop_write(new_path.mnt);
out_dput:
- dput(new_dentry);
- mutex_unlock(&new_path.dentry->d_inode->i_mutex);
- path_put(&new_path);
+ done_path_create(&new_path, new_dentry);
out:
path_put(&old_path);