From: Matan Breizman Date: Thu, 15 Dec 2022 17:05:15 +0000 (+0000) Subject: mon/OSDMonitor: Skip check_pg_num on pool size decrease X-Git-Tag: v17.2.6~16^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=08c4de3c6575745f972924d1885f1d669e12262f;p=ceph.git mon/OSDMonitor: Skip check_pg_num on pool size decrease When changing the pool size we use check_pg_num to not exceed `mon_max_pg_per_osd` value. This check should only be applied when increasing the size to avoid underflows. (Same already applied when changing pg_num) Signed-off-by: Matan Breizman (cherry picked from commit a7c09bb82cc7749b05a0f60477c9407a177086d1) --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 6d20ffd87febc..c74a8a49c166d 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -8353,9 +8353,12 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap, ss << "crush rule " << p.get_crush_rule() << " type does not match pool"; return -EINVAL; } - int r = check_pg_num(pool, p.get_pg_num(), n, p.get_crush_rule(), &ss); - if (r < 0) { - return r; + if (n > p.size) { + // only when increasing pool size + int r = check_pg_num(pool, p.get_pg_num(), n, p.get_crush_rule(), &ss); + if (r < 0) { + return r; + } } p.size = n; p.min_size = g_conf().get_osd_pool_default_min_size(p.size);