diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-19 19:37:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-19 19:37:45 -0400 |
commit | e23a5f66877d32f21a2ac15a200ad4a2b4c8b0ee (patch) | |
tree | f1eafaf4796abd3289fdc3384f124046f752b9d6 /fs/namei.c | |
parent | c9091f9e571386992c8c5badcec84d49753b9df1 (diff) | |
parent | e9baf6e59842285bcf9570f5094e4c27674a0f7c (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6:
[PATCH] return to old errno choice in mkdir() et.al.
[Patch] fs/binfmt_elf.c: fix wrong return values
[PATCH] get rid of leak in compat_execve()
[Patch] fs/binfmt_elf.c: fix a wrong free
[PATCH] avoid multiplication overflows and signedness issues for max_fds
[PATCH] dup_fd() part 4 - race fix
[PATCH] dup_fd() - part 3
[PATCH] dup_fd() part 2
[PATCH] dup_fd() fixes, part 1
[PATCH] take init_files to fs/file.c
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/namei.c b/fs/namei.c index 32fd9655485b..c7e43536c49a 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2003,18 +2003,22 @@ struct dentry *lookup_create(struct nameidata *nd, int is_dir) | |||
2003 | if (IS_ERR(dentry)) | 2003 | if (IS_ERR(dentry)) |
2004 | goto fail; | 2004 | goto fail; |
2005 | 2005 | ||
2006 | if (dentry->d_inode) | ||
2007 | goto eexist; | ||
2006 | /* | 2008 | /* |
2007 | * Special case - lookup gave negative, but... we had foo/bar/ | 2009 | * Special case - lookup gave negative, but... we had foo/bar/ |
2008 | * From the vfs_mknod() POV we just have a negative dentry - | 2010 | * From the vfs_mknod() POV we just have a negative dentry - |
2009 | * all is fine. Let's be bastards - you had / on the end, you've | 2011 | * all is fine. Let's be bastards - you had / on the end, you've |
2010 | * been asking for (non-existent) directory. -ENOENT for you. | 2012 | * been asking for (non-existent) directory. -ENOENT for you. |
2011 | */ | 2013 | */ |
2012 | if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode) | 2014 | if (unlikely(!is_dir && nd->last.name[nd->last.len])) { |
2013 | goto enoent; | 2015 | dput(dentry); |
2016 | dentry = ERR_PTR(-ENOENT); | ||
2017 | } | ||
2014 | return dentry; | 2018 | return dentry; |
2015 | enoent: | 2019 | eexist: |
2016 | dput(dentry); | 2020 | dput(dentry); |
2017 | dentry = ERR_PTR(-ENOENT); | 2021 | dentry = ERR_PTR(-EEXIST); |
2018 | fail: | 2022 | fail: |
2019 | return dentry; | 2023 | return dentry; |
2020 | } | 2024 | } |