diff options
author | Paul Mackerras <paulus@samba.org> | 2008-05-23 16:53:23 +1000 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-05-23 16:53:23 +1000 |
commit | acf464817d5e7be9fb67aec4027dbee0ac9be17a (patch) | |
tree | 39fd061c0a91a11d3ae4ff19b7fe179325e39bbf /fs/namei.c | |
parent | 80d267f9aee6f1b5df602b5a19fb7b4923f17db2 (diff) | |
parent | 8962cadbe7cbc4ed0fff94f56ebab505a10afd2e (diff) | |
download | blackbird-op-linux-acf464817d5e7be9fb67aec4027dbee0ac9be17a.tar.gz blackbird-op-linux-acf464817d5e7be9fb67aec4027dbee0ac9be17a.zip |
Merge branch 'merge' into powerpc-next
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) if (IS_ERR(dentry)) goto fail; + if (dentry->d_inode) + goto eexist; /* * Special case - lookup gave negative, but... we had foo/bar/ * From the vfs_mknod() POV we just have a negative dentry - * all is fine. Let's be bastards - you had / on the end, you've * been asking for (non-existent) directory. -ENOENT for you. */ - if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode) - goto enoent; + if (unlikely(!is_dir && nd->last.name[nd->last.len])) { + dput(dentry); + dentry = ERR_PTR(-ENOENT); + } return dentry; -enoent: +eexist: dput(dentry); - dentry = ERR_PTR(-ENOENT); + dentry = ERR_PTR(-EEXIST); fail: return dentry; } |