mds: don't crash when missing oldparent
From: Alexandre Oliva <oliva@gnu.org>
If we can't find oldparent, skip creating the snapshot.
Signed-off-by: Alexandre Oliva <oliva@gnu.org>
---
src/mds/snap.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
@@ -170,7 +170,8 @@ void SnapRealm::build_snap_set(set<snapid_t> &s,
p != srnode.past_parents.end() && p->first >= first && p->second.first <= last;
p++) {
CInode *oldparent = mdcache->get_inode(p->second.ino);
- assert(oldparent); // call open_parents first!
+ if (!oldparent)
+ continue;
assert(oldparent->snaprealm);
oldparent->snaprealm->build_snap_set(s, max_seq, max_last_created, max_last_destroyed,
MAX(first, p->second.first),