mirror of
https://github.com/ceph/ceph
synced 2025-02-18 00:17:37 +00:00
mon: fix divide by zero when pg_num adjusted and no osds
Fixes: #9052 Backport: firefly, dumpling Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
c5687b1310
commit
239401db7b
@ -3592,7 +3592,7 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
|
||||
ss << "splits in cache pools must be followed by scrubs and leave sufficient free space to avoid overfilling. use --yes-i-really-mean-it to force.";
|
||||
return -EPERM;
|
||||
}
|
||||
int expected_osds = MIN(p.get_pg_num(), osdmap.get_num_osds());
|
||||
int expected_osds = MAX(1, MIN(p.get_pg_num(), osdmap.get_num_osds()));
|
||||
int64_t new_pgs = n - p.get_pg_num();
|
||||
int64_t pgs_per_osd = new_pgs / expected_osds;
|
||||
if (pgs_per_osd > g_conf->mon_osd_max_split_count) {
|
||||
|
Loading…
Reference in New Issue
Block a user