diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-19 17:15:31 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-29 13:24:13 -0400 |
commit | 921a1650de9eed40dd64d681aba4a4d98856f289 (patch) | |
tree | c4740f5ee8de85ebbb1b519acf2b8e249bce0c56 /fs/namei.c | |
parent | 25b2692a8ace4c2684d3899a0bfe55f8c4248899 (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.c | 24 |
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: | |||
2893 | } | 2893 | } |
2894 | EXPORT_SYMBOL(kern_path_create); | 2894 | EXPORT_SYMBOL(kern_path_create); |
2895 | 2895 | ||
2896 | void done_path_create(struct path *path, struct dentry *dentry) | ||
2897 | { | ||
2898 | dput(dentry); | ||
2899 | mutex_unlock(&path->dentry->d_inode->i_mutex); | ||
2900 | path_put(path); | ||
2901 | } | ||
2902 | EXPORT_SYMBOL(done_path_create); | ||
2903 | |||
2896 | struct dentry *user_path_create(int dfd, const char __user *pathname, struct path *path, int is_dir) | 2904 | struct dentry *user_path_create(int dfd, const char __user *pathname, struct path *path, int is_dir) |
2897 | { | 2905 | { |
2898 | char *tmp = getname(pathname); | 2906 | char *tmp = getname(pathname); |
@@ -2989,9 +2997,7 @@ SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, umode_t, mode, | |||
2989 | out_drop_write: | 2997 | out_drop_write: |
2990 | mnt_drop_write(path.mnt); | 2998 | mnt_drop_write(path.mnt); |
2991 | out_dput: | 2999 | out_dput: |
2992 | dput(dentry); | 3000 | done_path_create(&path, dentry); |
2993 | mutex_unlock(&path.dentry->d_inode->i_mutex); | ||
2994 | path_put(&path); | ||
2995 | 3001 | ||
2996 | return error; | 3002 | return error; |
2997 | } | 3003 | } |
@@ -3048,9 +3054,7 @@ SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, umode_t, mode) | |||
3048 | out_drop_write: | 3054 | out_drop_write: |
3049 | mnt_drop_write(path.mnt); | 3055 | mnt_drop_write(path.mnt); |
3050 | out_dput: | 3056 | out_dput: |
3051 | dput(dentry); | 3057 | done_path_create(&path, dentry); |
3052 | mutex_unlock(&path.dentry->d_inode->i_mutex); | ||
3053 | path_put(&path); | ||
3054 | return error; | 3058 | return error; |
3055 | } | 3059 | } |
3056 | 3060 | ||
@@ -3334,9 +3338,7 @@ SYSCALL_DEFINE3(symlinkat, const char __user *, oldname, | |||
3334 | out_drop_write: | 3338 | out_drop_write: |
3335 | mnt_drop_write(path.mnt); | 3339 | mnt_drop_write(path.mnt); |
3336 | out_dput: | 3340 | out_dput: |
3337 | dput(dentry); | 3341 | done_path_create(&path, dentry); |
3338 | mutex_unlock(&path.dentry->d_inode->i_mutex); | ||
3339 | path_put(&path); | ||
3340 | out_putname: | 3342 | out_putname: |
3341 | putname(from); | 3343 | putname(from); |
3342 | return error; | 3344 | return error; |
@@ -3446,9 +3448,7 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname, | |||
3446 | out_drop_write: | 3448 | out_drop_write: |
3447 | mnt_drop_write(new_path.mnt); | 3449 | mnt_drop_write(new_path.mnt); |
3448 | out_dput: | 3450 | out_dput: |
3449 | dput(new_dentry); | 3451 | done_path_create(&new_path, new_dentry); |
3450 | mutex_unlock(&new_path.dentry->d_inode->i_mutex); | ||
3451 | path_put(&new_path); | ||
3452 | out: | 3452 | out: |
3453 | path_put(&old_path); | 3453 | path_put(&old_path); |
3454 | 3454 | ||