]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix iterator adjustment in readdir assimilation
authorSage Weil <sage@newdream.net>
Tue, 30 Aug 2011 17:09:56 +0000 (10:09 -0700)
committerSage Weil <sage@newdream.net>
Tue, 30 Aug 2011 20:14:56 +0000 (13:14 -0700)
We need to move past the item we already had or else we'll remove it again
during the next iteration of the loop.

Signed-off-by: Sage Weil <sage@newdream.net>
src/client/Client.cc

index 353c166d0a4128111d1fa24d56d8ae64d29519c8..99cc025517804db82b46a024f3fa44969ae62d0c 100644 (file)
@@ -837,13 +837,14 @@ Inode* Client::insert_trace(MetaRequest *request, int mds)
        Dentry *olddn = pd->second;
        if (pd->second->inode != in) {
          // replace incorrect dentry
-         pd++;
+         pd++;  // we are about to unlink this guy, move past it.
          unlink(olddn, true);
          dn = link(dir, dname, in, NULL);
        } else {
          // keep existing dn
          dn = olddn;
          touch_dn(dn);
+         pd++;  // move past the dentry we just touched.
        }
       } else {
        // new dn