]>
Commit | Line | Data |
---|---|---|
932dd8a6 GKH |
1 | From 2159184ea01e4ae7d15f2017e296d4bc82d5aeb0 Mon Sep 17 00:00:00 2001 |
2 | From: Al Viro <viro@zeniv.linux.org.uk> | |
3 | Date: Thu, 28 May 2015 23:09:19 -0400 | |
4 | Subject: d_walk() might skip too much | |
5 | ||
6 | From: Al Viro <viro@zeniv.linux.org.uk> | |
7 | ||
8 | commit 2159184ea01e4ae7d15f2017e296d4bc82d5aeb0 upstream. | |
9 | ||
10 | when we find that a child has died while we'd been trying to ascend, | |
11 | we should go into the first live sibling itself, rather than its sibling. | |
12 | ||
13 | Off-by-one in question had been introduced in "deal with deadlock in | |
14 | d_walk()" and the fix needs to be backported to all branches this one | |
15 | has been backported to. | |
16 | ||
17 | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> | |
18 | Signed-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 | } |