From 68359befef70822833c529d9d0b2bb398f1e034d Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 13 Oct 2022 18:53:24 -0700 Subject: [PATCH] mon/OSDMonitor: set FLAG_NOPGCHANGE for crimson pools, disallow unsetting it Signed-off-by: Samuel Just --- src/mon/OSDMonitor.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 4300633b2d7a..a358736d2160 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -8172,8 +8172,10 @@ int OSDMonitor::prepare_new_pool(string& name, pi->use_gmt_hitset = true; else pi->use_gmt_hitset = false; - if (crimson) + if (crimson) { pi->set_flag(pg_pool_t::FLAG_CRIMSON); + pi->set_flag(pg_pool_t::FLAG_NOPGCHANGE); + } pi->size = size; pi->min_size = min_size; @@ -8621,6 +8623,10 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap, if (val == "true" || (interr.empty() && n == 1)) { p.set_flag(flag); } else if (val == "false" || (interr.empty() && n == 0)) { + if (flag == pg_pool_t::FLAG_NOPGCHANGE && p.is_crimson()) { + ss << "cannot clear FLAG_NOPGCHANGE on a crimson pool"; + return -EINVAL; + } p.unset_flag(flag); } else { ss << "expecting value 'true', 'false', '0', or '1'"; -- 2.47.3