diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-05-28 23:09:19 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-05-28 23:45:30 -0400 |
commit | 2159184ea01e4ae7d15f2017e296d4bc82d5aeb0 (patch) | |
tree | b278dfe14562b9e312de8050df5a1733cbd622d6 /fs/dcache.c | |
parent | 030bbdbf4c833bc69f502eae58498bc5572db736 (diff) |
d_walk() might skip too much
when we find that a child has died while we'd been trying to ascend,
we should go into the first live sibling itself, rather than its sibling.
Off-by-one in question had been introduced in "deal with deadlock in
d_walk()" and the fix needs to be backported to all branches this one
has been backported to.
Cc: stable@vger.kernel.org # 3.2 and later
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 656ce522a218..37b5afdaf698 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -1239,13 +1239,13 @@ ascend: | |||
1239 | /* might go back up the wrong parent if we have had a rename. */ | 1239 | /* might go back up the wrong parent if we have had a rename. */ |
1240 | if (need_seqretry(&rename_lock, seq)) | 1240 | if (need_seqretry(&rename_lock, seq)) |
1241 | goto rename_retry; | 1241 | goto rename_retry; |
1242 | next = child->d_child.next; | 1242 | /* go into the first sibling still alive */ |
1243 | while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) { | 1243 | do { |
1244 | next = child->d_child.next; | ||
1244 | if (next == &this_parent->d_subdirs) | 1245 | if (next == &this_parent->d_subdirs) |
1245 | goto ascend; | 1246 | goto ascend; |
1246 | child = list_entry(next, struct dentry, d_child); | 1247 | child = list_entry(next, struct dentry, d_child); |
1247 | next = next->next; | 1248 | } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)); |
1248 | } | ||
1249 | rcu_read_unlock(); | 1249 | rcu_read_unlock(); |
1250 | goto resume; | 1250 | goto resume; |
1251 | } | 1251 | } |