Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1380453
| From | Al Viro <viro@ZenIV.linux.org.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 09/15] lookup_slow(): bugger off on IS_DEADDIR() from the very beginning |
| Date | 2016-04-16 03:00 +0200 |
| Message-ID | <romKD-3oC-37@gated-at.bofh.it> (permalink) |
| References | <romKB-3oC-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
fs/namei.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index c0d551f..6fb33a7 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;
}
--
2.8.0.rc3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCHSET][RFC][CFT] parallel lookups Al Viro <viro@ZenIV.linux.org.uk> - 2016-04-16 03:00 +0200
[PATCH 01/15] security_d_instantiate(): move to the point prior to attaching dentry to inode Al Viro <viro@ZenIV.linux.org.uk> - 2016-04-16 03:00 +0200
[PATCH 09/15] lookup_slow(): bugger off on IS_DEADDIR() from the very beginning Al Viro <viro@ZenIV.linux.org.uk> - 2016-04-16 03:00 +0200
[PATCH 14/15] parallel lookups machinery, part 4 (and last) Al Viro <viro@ZenIV.linux.org.uk> - 2016-04-16 03:00 +0200
[PATCH 15/15] parallel lookups: actual switch to rwsem Al Viro <viro@ZenIV.linux.org.uk> - 2016-04-16 03:00 +0200
Re: [PATCH 15/15] parallel lookups: actual switch to rwsem Andreas Dilger <adilger@dilger.ca> - 2016-04-16 05:10 +0200
Re: [PATCH 15/15] parallel lookups: actual switch to rwsem Al Viro <viro@ZenIV.linux.org.uk> - 2016-04-16 05:40 +0200
Re: [PATCHSET][RFC][CFT] parallel lookups Andreas Dilger <adilger@dilger.ca> - 2016-04-16 05:10 +0200
Re: [PATCHSET][RFC][CFT] parallel lookups Al Viro <viro@ZenIV.linux.org.uk> - 2016-04-16 05:30 +0200
csiph-web