summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-04-15 01:33:34 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2016-05-03 01:47:26 +0200
commit1936386ea96591c27ae4b70caef9591c41e6290f (patch)
tree1cb793a9f7621bff82219d64c7f9813a23ebee69 /fs/namei.c
parentnfs: missing wakeup in nfs_unblock_sillyrename() (diff)
downloadlinux-1936386ea96591c27ae4b70caef9591c41e6290f.tar.xz
linux-1936386ea96591c27ae4b70caef9591c41e6290f.zip
lookup_slow(): bugger off on IS_DEADDIR() from the very beginning
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c
index bdcea8a018b8..c275635c4b9e 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1603,8 +1603,15 @@ static struct dentry *lookup_slow(const struct qstr *name,
struct dentry *dir,
unsigned int flags)
{
- struct dentry *dentry;
- inode_lock(dir->d_inode);
+ struct dentry *dentry, *old;
+ struct inode *inode = dir->d_inode;
+
+ inode_lock(inode);
+ /* Don't go there if it's already dead */
+ if (unlikely(IS_DEADDIR(inode))) {
+ inode_unlock(inode);
+ return ERR_PTR(-ENOENT);
+ }
dentry = d_lookup(dir, name);
if (unlikely(dentry)) {
if ((dentry->d_flags & DCACHE_OP_REVALIDATE) &&
@@ -1618,17 +1625,21 @@ static struct dentry *lookup_slow(const struct qstr *name,
}
}
if (dentry) {
- inode_unlock(dir->d_inode);
+ inode_unlock(inode);
return dentry;
}
}
dentry = d_alloc(dir, name);
if (unlikely(!dentry)) {
- inode_unlock(dir->d_inode);
+ inode_unlock(inode);
return ERR_PTR(-ENOMEM);
}
- dentry = lookup_real(dir->d_inode, dentry, flags);
- inode_unlock(dir->d_inode);
+ old = inode->i_op->lookup(inode, dentry, flags);
+ if (unlikely(old)) {
+ dput(dentry);
+ dentry = old;
+ }
+ inode_unlock(inode);
return dentry;
}