From 3578b1193d497373db14d040ff7f0fc9e06e5ac2 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Wed, 3 Sep 2014 15:49:47 -0700 Subject: [PATCH] ReplicatedPG: create max hitset size Otherwise, hit_set_create could create an unbounded size hitset object. Fixes: #9339 Backport: firefly Signed-off-by: Samuel Just --- src/common/config_opts.h | 1 + src/osd/ReplicatedPG.cc | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index a065a772f9b13..e65ecf8db2724 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -441,6 +441,7 @@ OPTION(osd_pool_default_cache_target_full_ratio, OPT_FLOAT, .8) OPTION(osd_pool_default_cache_min_flush_age, OPT_INT, 0) // seconds OPTION(osd_pool_default_cache_min_evict_age, OPT_INT, 0) // seconds OPTION(osd_hit_set_min_size, OPT_INT, 1000) // min target size for a HitSet +OPTION(osd_hit_set_max_size, OPT_INT, 100000) // max target size for a HitSet OPTION(osd_hit_set_namespace, OPT_STR, ".ceph-internal") // rados namespace for hit_set tracking OPTION(osd_tier_default_cache_mode, OPT_STR, "writeback") diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 95b61a3112246..675da2af910cd 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -10680,6 +10680,9 @@ void ReplicatedPG::hit_set_create() if (p->target_size < static_cast(g_conf->osd_hit_set_min_size)) p->target_size = g_conf->osd_hit_set_min_size; + if (p->target_size > static_cast(g_conf->osd_hit_set_max_size)) + p->target_size = g_conf->osd_hit_set_max_size; + p->seed = now.sec(); dout(10) << __func__ << " target_size " << p->target_size -- 2.47.3