diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-03-09 00:17:27 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-03-14 09:15:26 -0400 |
commit | 9b44f1b3928b6f41532c9a1dc9a6fc665989ad5b (patch) | |
tree | ffa1a492cc767c3c3e561c206131fa1762747833 | |
parent | 0f9d1a10c341020617e5b1c7f9c16f6a070438ec (diff) |
move may_open() from __open_name_create() to do_last()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/namei.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/namei.c b/fs/namei.c index 1f561dc495a1..def63e7c058d 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2069,11 +2069,7 @@ out_unlock: | |||
2069 | mutex_unlock(&dir->d_inode->i_mutex); | 2069 | mutex_unlock(&dir->d_inode->i_mutex); |
2070 | dput(nd->path.dentry); | 2070 | dput(nd->path.dentry); |
2071 | nd->path.dentry = path->dentry; | 2071 | nd->path.dentry = path->dentry; |
2072 | 2072 | return error; | |
2073 | if (error) | ||
2074 | return error; | ||
2075 | /* Don't check for write permission, don't truncate */ | ||
2076 | return may_open(&nd->path, 0, open_flag & ~O_TRUNC); | ||
2077 | } | 2073 | } |
2078 | 2074 | ||
2079 | /* | 2075 | /* |
@@ -2239,6 +2235,12 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
2239 | mnt_drop_write(nd->path.mnt); | 2235 | mnt_drop_write(nd->path.mnt); |
2240 | goto exit; | 2236 | goto exit; |
2241 | } | 2237 | } |
2238 | /* Don't check for write permission, don't truncate */ | ||
2239 | error = may_open(&nd->path, 0, op->open_flag & ~O_TRUNC); | ||
2240 | if (error) { | ||
2241 | mnt_drop_write(nd->path.mnt); | ||
2242 | goto exit; | ||
2243 | } | ||
2242 | filp = nameidata_to_filp(nd); | 2244 | filp = nameidata_to_filp(nd); |
2243 | mnt_drop_write(nd->path.mnt); | 2245 | mnt_drop_write(nd->path.mnt); |
2244 | path_put(&nd->path); | 2246 | path_put(&nd->path); |