New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
luminous: osd: do not crash on empty snapset #21638
Conversation
src/osd/PrimaryLogPG.cc
Outdated
@@ -10190,6 +10190,11 @@ int PrimaryLogPG::find_object_context(const hobject_t& oid, | |||
first = p->second.back(); | |||
last = p->second.front(); | |||
} | |||
if (p->second.empty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smithfarm this needs to be inside the above "else" block. Before first = p->second.back()
-- we need to check that we can safely use p->second.back()
and p->second.front()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trociny Oh, right. Fixing.
d02872b
to
f070422
Compare
src/osd/PrimaryLogPG.cc
Outdated
@@ -10189,6 +10189,11 @@ int PrimaryLogPG::find_object_context(const hobject_t& oid, | |||
assert(p != obc->ssc->snapset.clone_snaps.end()); | |||
first = p->second.back(); | |||
last = p->second.front(); | |||
if (p->second.empty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smithfarm It should be before first = p->second.back()
. Because if p->second
is empty, p->second.back()
and p->second.front()
will trigger segfault.
f070422
to
c34983c
Compare
Ouch! I was not giving this PR the attention it deserved. Sorry for the trouble! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
http://tracker.ceph.com/issues/23852