Commit 1936386e authored by Al Viro's avatar Al Viro

lookup_slow(): bugger off on IS_DEADDIR() from the very beginning

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent d2caaa0a
...@@ -1603,8 +1603,15 @@ static struct dentry *lookup_slow(const struct qstr *name, ...@@ -1603,8 +1603,15 @@ static struct dentry *lookup_slow(const struct qstr *name,
struct dentry *dir, struct dentry *dir,
unsigned int flags) unsigned int flags)
{ {
struct dentry *dentry; struct dentry *dentry, *old;
inode_lock(dir->d_inode); 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); dentry = d_lookup(dir, name);
if (unlikely(dentry)) { if (unlikely(dentry)) {
if ((dentry->d_flags & DCACHE_OP_REVALIDATE) && if ((dentry->d_flags & DCACHE_OP_REVALIDATE) &&
...@@ -1618,17 +1625,21 @@ static struct dentry *lookup_slow(const struct qstr *name, ...@@ -1618,17 +1625,21 @@ static struct dentry *lookup_slow(const struct qstr *name,
} }
} }
if (dentry) { if (dentry) {
inode_unlock(dir->d_inode); inode_unlock(inode);
return dentry; return dentry;
} }
} }
dentry = d_alloc(dir, name); dentry = d_alloc(dir, name);
if (unlikely(!dentry)) { if (unlikely(!dentry)) {
inode_unlock(dir->d_inode); inode_unlock(inode);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
dentry = lookup_real(dir->d_inode, dentry, flags); old = inode->i_op->lookup(inode, dentry, flags);
inode_unlock(dir->d_inode); if (unlikely(old)) {
dput(dentry);
dentry = old;
}
inode_unlock(inode);
return dentry; return dentry;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment