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>
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