]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
666b1edcc20f8030d477f18e7c015548854e5a55
[thirdparty/kernel/stable-queue.git] /
1 From eb4a22ba43d91d58a35bc4fce11d8e6065bb4e1d 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 Cc: "Stefan (metze) Metzmacher" <metze@samba.org>
22 Cc: Sachin Prabhu <sprabhu@redhat.com>
23 Reported-and-Tested-by: David McBride <dwm37@cam.ac.uk>
24 Signed-off-by: Jeff Layton <jlayton@redhat.com>
25 Signed-off-by: Steve French <smfrench@gmail.com>
26 [bwh: Backported to 3.2: need to return NULL]
27 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
28 Cc: Rui Xiang <rui.xiang@huawei.com>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30
31 ---
32 fs/cifs/readdir.c | 8 ++++++++
33 1 file changed, 8 insertions(+)
34
35 --- a/fs/cifs/readdir.c
36 +++ b/fs/cifs/readdir.c
37 @@ -96,6 +96,14 @@ cifs_readdir_lookup(struct dentry *paren
38 dput(dentry);
39 }
40
41 + /*
42 + * If we know that the inode will need to be revalidated immediately,
43 + * then don't create a new dentry for it. We'll end up doing an on
44 + * the wire call either way and this spares us an invalidation.
45 + */
46 + if (fattr->cf_flags & CIFS_FATTR_NEED_REVAL)
47 + return NULL;
48 +
49 dentry = d_alloc(parent, name);
50 if (dentry == NULL)
51 return NULL;