]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
6440296f54e43e625795450e65018bf12cafa8a7
[thirdparty/kernel/stable-queue.git] /
1 From 757c4f6260febff982276818bb946df89c1105aa Mon Sep 17 00:00:00 2001
2 From: Jeff Layton <jlayton@redhat.com>
3 Date: Wed, 7 Aug 2013 10:29:08 -0400
4 Subject: cifs: don't instantiate new dentries in readdir for inodes that need to be revalidated immediately
5
6 From: Jeff Layton <jlayton@redhat.com>
7
8 commit 757c4f6260febff982276818bb946df89c1105aa upstream.
9
10 David reported that commit c2b93e06 (cifs: only set ops for inodes in
11 I_NEW state) caused a regression with mfsymlinks. Prior to that patch,
12 if a mfsymlink dentry was instantiated at readdir time, the inode would
13 get a new set of ops when it was revalidated. After that patch, this
14 did not occur.
15
16 This patch addresses this by simply skipping instantiating dentries in
17 the readdir codepath when we know that they will need to be immediately
18 revalidated. The next attempt to use that dentry will cause a new lookup
19 to occur (which is basically what we want to happen anyway).
20
21 Reported-and-Tested-by: David McBride <dwm37@cam.ac.uk>
22 Cc: "Stefan (metze) Metzmacher" <metze@samba.org>
23 Cc: Sachin Prabhu <sprabhu@redhat.com>
24 Signed-off-by: Jeff Layton <jlayton@redhat.com>
25 Signed-off-by: Steve French <smfrench@gmail.com>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27
28 ---
29 fs/cifs/readdir.c | 8 ++++++++
30 1 file changed, 8 insertions(+)
31
32 --- a/fs/cifs/readdir.c
33 +++ b/fs/cifs/readdir.c
34 @@ -111,6 +111,14 @@ cifs_prime_dcache(struct dentry *parent,
35 return;
36 }
37
38 + /*
39 + * If we know that the inode will need to be revalidated immediately,
40 + * then don't create a new dentry for it. We'll end up doing an on
41 + * the wire call either way and this spares us an invalidation.
42 + */
43 + if (fattr->cf_flags & CIFS_FATTR_NEED_REVAL)
44 + return;
45 +
46 dentry = d_alloc(parent, name);
47 if (!dentry)
48 return;