]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: Skip check_pg_num on pool size decrease
authorMatan Breizman <mbreizma@redhat.com>
Thu, 15 Dec 2022 17:05:15 +0000 (17:05 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Thu, 9 Mar 2023 13:20:20 +0000 (13:20 +0000)
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 <mbreizma@redhat.com>
(cherry picked from commit a7c09bb82cc7749b05a0f60477c9407a177086d1)

src/mon/OSDMonitor.cc

index 6d20ffd87febce715d8ff27ce33d91080659f892..c74a8a49c166d232acb963558a802fc2fda40d0b 100644 (file)
@@ -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);