Skip to content
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

osd: fix crash caused by divide by zero in heartbeat code #21373

Merged
merged 2 commits into from Apr 15, 2018

Conversation

branch-predictor
Copy link
Contributor

If the osd_heartbeat_interval is set to 0 or anything above 86400, the osd will crash because of divide by zero in loadavg gathering code. This PR fixes this and adds run-time config boundaries for osd_heartbeat_interval.

Signed-off-by: Piotr Dałek piotr.dalek@corp.ovh.com

As nothing prevents osd heartbeat interval from being 0 or less, it's
possible to crash single OSD/entire cluster using rogue injectargs.
It can crash if it's set to anything above 86400, too.
This fixes the code so it doesn't crash anymore.

Signed-off-by: Piotr Dałek <piotr.dalek@corp.ovh.com>
Previously this var was unbounded, meaning that rogue injectargs
could kill the cluster. Also, add a description to it and to
osd_heartbeat_min_size.

Signed-off-by: Piotr Dałek <piotr.dalek@corp.ovh.com>
@@ -2862,7 +2862,8 @@ std::vector<Option> get_global_options() {

Option("osd_heartbeat_interval", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(6)
.set_description(""),
.set_min_max(1, 86400)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tchaikov tchaikov merged commit ed8bdf1 into ceph:master Apr 15, 2018
@branch-predictor branch-predictor deleted the bp-hb-divbyzero branch November 22, 2018 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants