summaryrefslogtreecommitdiffstats
path: root/src/mon
diff options
context:
space:
mode:
authorMatan Breizman <mbreizma@redhat.com>2022-12-15 18:05:15 +0100
committerMatan Breizman <mbreizma@redhat.com>2022-12-20 15:09:38 +0100
commita7c09bb82cc7749b05a0f60477c9407a177086d1 (patch)
tree044b23058f91872153e6a35d641e86b8b705096a /src/mon
parentmon/OSDMointor: Simplify check_pg_num() (diff)
downloadceph-a7c09bb82cc7749b05a0f60477c9407a177086d1.tar.xz
ceph-a7c09bb82cc7749b05a0f60477c9407a177086d1.zip
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 <mbreizma@redhat.com>
Diffstat (limited to 'src/mon')
-rw-r--r--src/mon/OSDMonitor.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index 22aa5d4b192..008fccdcc52 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -8332,9 +8332,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);