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
[RFC] include/interval_set: iterate until p->first < start #53063
Conversation
there are a couple of crash trackers where assertion fails at Existing code does decrement by one in case the key is gt than https://tracker.ceph.com/issues/62356 |
if (p->first + p->second <= start) | ||
++p; // it doesn't. | ||
while (p != m.begin()) { | ||
if (p->first <= start) { |
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.
This is buggy. Old code will make sure that the p
won't be .end()
, but yours seems will crash ?
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.
so if we dont hit this if {}
then it assume either p->first > start
or p==m.end()
, so in this case we decrement --p
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.
i.e. it wont hit end()
here either
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.
Won't the m.lower_bound()
return .end()
if it couldn't find any item ?
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.
okay so you're implying that we should just return directly in case we dont find anything in the map, right? you're correct, i need to handle this edge case. decrementing in case there is nothing would be disastrous
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.
Yeah, the corner edge case.
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.
check now
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.
In erase()
it will check ceph_assert(p != m.end());
. Your above change could return .end()
.
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
60ddf0c
to
0a5d593
Compare
This PR doesn't make sense now, the working of This doesn't mean the interval_set code is entirely perfect, the |
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "pacific"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
Checklist
Show available Jenkins commands
jenkins retest this please
jenkins test classic perf
jenkins test crimson perf
jenkins test signed
jenkins test make check
jenkins test make check arm64
jenkins test submodules
jenkins test dashboard
jenkins test dashboard cephadm
jenkins test api
jenkins test docs
jenkins render docs
jenkins test ceph-volume all
jenkins test ceph-volume tox
jenkins test windows