Skip to content

Commit

Permalink
osd: don't crash on empty snapset
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
Signed-off-by: Mykola Golub <mgolub@suse.com>
  • Loading branch information
trociny committed Mar 28, 2018
1 parent 618f549 commit 61c546a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/osd/PrimaryLogPG.cc
Expand Up @@ -10871,6 +10871,11 @@ int PrimaryLogPG::find_object_context(const hobject_t& oid,
snapid_t first, last;
auto p = obc->ssc->snapset.clone_snaps.find(soid.snap);
assert(p != obc->ssc->snapset.clone_snaps.end());
if (p->second.empty()) {
dout(1) << __func__ << " " << soid << " empty snapset -- DNE" << dendl;
assert(!cct->_conf->osd_debug_verify_snaps);
return -ENOENT;
}
first = p->second.back();
last = p->second.front();
if (first <= oid.snap) {
Expand Down
5 changes: 4 additions & 1 deletion src/osd/SnapMapper.cc
Expand Up @@ -155,7 +155,10 @@ int SnapMapper::get_snaps(
bufferlist::iterator bp = got.begin()->second.begin();
decode(*out, bp);
dout(20) << __func__ << " " << oid << " " << out->snaps << dendl;
assert(!out->snaps.empty());
if (out->snaps.empty()) {
dout(1) << __func__ << " " << oid << " empty snapset" << dendl;
assert(!cct->_conf->osd_debug_verify_snaps);
}
} else {
dout(20) << __func__ << " " << oid << " (out == NULL)" << dendl;
}
Expand Down

0 comments on commit 61c546a

Please sign in to comment.