aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/dcache.c3
-rw-r--r--fs/namei.c6
2 files changed, 4 insertions, 5 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 40707d88a945..494a9def5dce 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1647,8 +1647,7 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode)
1647 unsigned add_flags = d_flags_for_inode(inode); 1647 unsigned add_flags = d_flags_for_inode(inode);
1648 1648
1649 spin_lock(&dentry->d_lock); 1649 spin_lock(&dentry->d_lock);
1650 dentry->d_flags &= ~DCACHE_ENTRY_TYPE; 1650 __d_set_type(dentry, add_flags);
1651 dentry->d_flags |= add_flags;
1652 if (inode) 1651 if (inode)
1653 hlist_add_head(&dentry->d_alias, &inode->i_dentry); 1652 hlist_add_head(&dentry->d_alias, &inode->i_dentry);
1654 dentry->d_inode = inode; 1653 dentry->d_inode = inode;
diff --git a/fs/namei.c b/fs/namei.c
index c6157c894fce..80168273396b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1542,7 +1542,7 @@ static inline int walk_component(struct nameidata *nd, struct path *path,
1542 inode = path->dentry->d_inode; 1542 inode = path->dentry->d_inode;
1543 } 1543 }
1544 err = -ENOENT; 1544 err = -ENOENT;
1545 if (!inode) 1545 if (!inode || d_is_negative(path->dentry))
1546 goto out_path_put; 1546 goto out_path_put;
1547 1547
1548 if (should_follow_link(path->dentry, follow)) { 1548 if (should_follow_link(path->dentry, follow)) {
@@ -2249,7 +2249,7 @@ mountpoint_last(struct nameidata *nd, struct path *path)
2249 mutex_unlock(&dir->d_inode->i_mutex); 2249 mutex_unlock(&dir->d_inode->i_mutex);
2250 2250
2251done: 2251done:
2252 if (!dentry->d_inode) { 2252 if (!dentry->d_inode || d_is_negative(dentry)) {
2253 error = -ENOENT; 2253 error = -ENOENT;
2254 dput(dentry); 2254 dput(dentry);
2255 goto out; 2255 goto out;
@@ -2994,7 +2994,7 @@ retry_lookup:
2994finish_lookup: 2994finish_lookup:
2995 /* we _can_ be in RCU mode here */ 2995 /* we _can_ be in RCU mode here */
2996 error = -ENOENT; 2996 error = -ENOENT;
2997 if (d_is_negative(path->dentry)) { 2997 if (!inode || d_is_negative(path->dentry)) {
2998 path_to_nameidata(path, nd); 2998 path_to_nameidata(path, nd);
2999 goto out; 2999 goto out;
3000 } 3000 }