mirror of
https://github.com/ceph/ceph
synced 2025-02-26 12:33:41 +00:00
Merge pull request #41587 from cfsnyder/bugfix_47738
mgr/DaemonServer.cc: prevent mgr crashes caused by integer underflow that is triggered by large increases to pg_num/pgp_num Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
commit
04fd0002a3
@ -2831,8 +2831,12 @@ void DaemonServer::adjust_pgs()
|
||||
max_misplaced / 2.0);
|
||||
unsigned estmax = std::max<unsigned>(
|
||||
(double)p.get_pg_num() * room, 1u);
|
||||
unsigned next_min = 0;
|
||||
if (p.get_pgp_num() > estmax) {
|
||||
next_min = p.get_pgp_num() - estmax;
|
||||
}
|
||||
next = std::clamp(target,
|
||||
p.get_pgp_num() - estmax,
|
||||
next_min,
|
||||
p.get_pgp_num() + estmax);
|
||||
dout(20) << " room " << room << " estmax " << estmax
|
||||
<< " delta " << (target-p.get_pgp_num())
|
||||
|
Loading…
Reference in New Issue
Block a user