]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.14.44/d_walk-might-skip-too-much.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.14.44 / d_walk-might-skip-too-much.patch
CommitLineData
932dd8a6
GKH
1From 2159184ea01e4ae7d15f2017e296d4bc82d5aeb0 Mon Sep 17 00:00:00 2001
2From: Al Viro <viro@zeniv.linux.org.uk>
3Date: Thu, 28 May 2015 23:09:19 -0400
4Subject: d_walk() might skip too much
5
6From: Al Viro <viro@zeniv.linux.org.uk>
7
8commit 2159184ea01e4ae7d15f2017e296d4bc82d5aeb0 upstream.
9
10when we find that a child has died while we'd been trying to ascend,
11we should go into the first live sibling itself, rather than its sibling.
12
13Off-by-one in question had been introduced in "deal with deadlock in
14d_walk()" and the fix needs to be backported to all branches this one
15has been backported to.
16
17Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
18Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20---
21 fs/dcache.c | 8 ++++----
22 1 file changed, 4 insertions(+), 4 deletions(-)
23
24--- a/fs/dcache.c
25+++ b/fs/dcache.c
26@@ -1135,13 +1135,13 @@ ascend:
27 /* might go back up the wrong parent if we have had a rename. */
28 if (need_seqretry(&rename_lock, seq))
29 goto rename_retry;
30- next = child->d_child.next;
31- while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) {
32+ /* go into the first sibling still alive */
33+ do {
34+ next = child->d_child.next;
35 if (next == &this_parent->d_subdirs)
36 goto ascend;
37 child = list_entry(next, struct dentry, d_child);
38- next = next->next;
39- }
40+ } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED));
41 rcu_read_unlock();
42 goto resume;
43 }