We just want the code in this if block to execute if the previous if block did.
But the previous if block unlinked destdnl, so the comparison always fails! Use
a bool and set it appropriately to fix.
// target inode
if (!linkmerge && oldin) {
+ bool dest_primary = false;
if (destdnl->is_primary()) {
+ dest_primary = true;
assert(straydn);
dout(10) << "straydn is " << *straydn << dendl;
destdn->get_dir()->unlink_inode(destdn);
destdn->get_dir()->unlink_inode(destdn);
}
// nlink-- targeti
- if (oldin->is_auth() && destdnl->is_primary()) {
+ if (oldin->is_auth() && dest_primary) {
bool hadrealm = (oldin->snaprealm ? true : false);
oldin->pop_and_dirty_projected_inode(mdr->ls);
if (oldin->snaprealm && !hadrealm)