[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    d_walk() might skip too much
From:       "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date:       2015-05-31 23:20:34
Message-ID: 20150531232034.3F6B666085E () gitolite ! kernel ! org
[Download RAW message or body]

Gitweb:     http://git.kernel.org/linus/;a=commit;h=2159184ea01e4ae7d15f2017e296d4bc82d5aeb0
Commit:     2159184ea01e4ae7d15f2017e296d4bc82d5aeb0
Parent:     030bbdbf4c833bc69f502eae58498bc5572db736
Refname:    refs/heads/master
Author:     Al Viro <viro@zeniv.linux.org.uk>
AuthorDate: Thu May 28 23:09:19 2015 -0400
Committer:  Al Viro <viro@zeniv.linux.org.uk>
CommitDate: Thu May 28 23:45:30 2015 -0400

    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>
---
 fs/dcache.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index 656ce52..37b5afd 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1239,13 +1239,13 @@ ascend:
 		/* might go back up the wrong parent if we have had a rename. */
 		if (need_seqretry(&rename_lock, seq))
 			goto rename_retry;
-		next = child->d_child.next;
-		while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) {
+		/* go into the first sibling still alive */
+		do {
+			next = child->d_child.next;
 			if (next == &this_parent->d_subdirs)
 				goto ascend;
 			child = list_entry(next, struct dentry, d_child);
-			next = next->next;
-		}
+		} while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED));
 		rcu_read_unlock();
 		goto resume;
 	}
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic