path: root/fs
diff options
authorJeff Layton <>2013-08-07 10:29:08 -0400
committerGreg Kroah-Hartman <>2013-08-14 22:59:09 -0700
commitd1e8adc0865d7091f3c437d984a8527259b80378 (patch)
tree747487c1126b98005760eadff38d94b5ae2b5403 /fs
parent4350018a57c333907db092beeb9fa65a82a258ed (diff)
cifs: don't instantiate new dentries in readdir for inodes that need to be revalidated immediately
commit 757c4f6260febff982276818bb946df89c1105aa upstream. David reported that commit c2b93e06 (cifs: only set ops for inodes in I_NEW state) caused a regression with mfsymlinks. Prior to that patch, if a mfsymlink dentry was instantiated at readdir time, the inode would get a new set of ops when it was revalidated. After that patch, this did not occur. This patch addresses this by simply skipping instantiating dentries in the readdir codepath when we know that they will need to be immediately revalidated. The next attempt to use that dentry will cause a new lookup to occur (which is basically what we want to happen anyway). Reported-and-Tested-by: David McBride <> Cc: "Stefan (metze) Metzmacher" <> Cc: Sachin Prabhu <> Signed-off-by: Jeff Layton <> Signed-off-by: Steve French <> Signed-off-by: Greg Kroah-Hartman <>
Diffstat (limited to 'fs')
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 770d5a9781c1..036279c064ff 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -111,6 +111,14 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
+ /*
+ * If we know that the inode will need to be revalidated immediately,
+ * then don't create a new dentry for it. We'll end up doing an on
+ * the wire call either way and this spares us an invalidation.
+ */
+ if (fattr->cf_flags & CIFS_FATTR_NEED_REVAL)
+ return;
dentry = d_alloc(parent, name);
if (!dentry)