aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/namei.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 68742e3cb98d..12ed29712b4e 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2274,22 +2274,23 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
2274 inode = path->dentry->d_inode; 2274 inode = path->dentry->d_inode;
2275 } 2275 }
2276 goto finish_lookup; 2276 goto finish_lookup;
2277 } 2277 } else {
2278 2278 /* create side of things */
2279 /* create side of things */ 2279 /*
2280 /* 2280 * This will *only* deal with leaving RCU mode - LOOKUP_JUMPED
2281 * This will *only* deal with leaving RCU mode - LOOKUP_JUMPED has been 2281 * has been cleared when we got to the last component we are
2282 * cleared when we got to the last component we are about to look up 2282 * about to look up
2283 */ 2283 */
2284 error = complete_walk(nd); 2284 error = complete_walk(nd);
2285 if (error) 2285 if (error)
2286 return ERR_PTR(error); 2286 return ERR_PTR(error);
2287 2287
2288 audit_inode(pathname, dir); 2288 audit_inode(pathname, dir);
2289 error = -EISDIR; 2289 error = -EISDIR;
2290 /* trailing slashes? */ 2290 /* trailing slashes? */
2291 if (nd->last.name[nd->last.len]) 2291 if (nd->last.name[nd->last.len])
2292 goto exit; 2292 goto exit;
2293 }
2293 2294
2294retry_lookup: 2295retry_lookup:
2295 mutex_lock(&dir->d_inode->i_mutex); 2296 mutex_lock(&dir->d_inode->i_mutex);
@@ -2305,7 +2306,7 @@ retry_lookup:
2305 path->mnt = nd->path.mnt; 2306 path->mnt = nd->path.mnt;
2306 2307
2307 /* Negative dentry, just create the file */ 2308 /* Negative dentry, just create the file */
2308 if (!dentry->d_inode) { 2309 if (!dentry->d_inode && (open_flag & O_CREAT)) {
2309 umode_t mode = op->mode; 2310 umode_t mode = op->mode;
2310 if (!IS_POSIXACL(dir->d_inode)) 2311 if (!IS_POSIXACL(dir->d_inode))
2311 mode &= ~current_umask(); 2312 mode &= ~current_umask();