mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
mon/OSDMonitor: reject pg_num -> 0
Otherwise it will finally crash the mgr process: ``` -2> 2018-09-11 16:23:31.272 7ff521d59700 -1 /clove/xxG/ceph/src/osd/osd_types.cc: In function 'pg_t pg_t::get_parent() const' thread 7ff521d59700 time 2018-09-11 16:23:31.272096 /clove/xxG/ceph/src/osd/osd_types.cc: 587: FAILED ceph_assert(bits) ``` Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
parent
cfa8591128
commit
6d8d20a55b
@ -2019,6 +2019,8 @@ function test_mon_osd_pool_set()
|
||||
ceph osd pool set $TEST_POOL_GETSET pg_num 10
|
||||
wait_for_clean
|
||||
ceph osd pool set $TEST_POOL_GETSET pgp_num 10
|
||||
expect_false ceph osd pool set $TEST_POOL_GETSET pg_num 0
|
||||
expect_false ceph osd pool set $TEST_POOL_GETSET pgp_num 0
|
||||
|
||||
old_pgs=$(ceph osd pool get $TEST_POOL_GETSET pg_num | sed -e 's/pg_num: //')
|
||||
new_pgs=$(($old_pgs + $(ceph osd stat --format json | jq '.num_osds') * 32))
|
||||
|
@ -6919,7 +6919,8 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
|
||||
if (n == (int)p.get_pg_num_target()) {
|
||||
return 0;
|
||||
}
|
||||
if (static_cast<uint64_t>(n) > g_conf().get_val<uint64_t>("mon_max_pool_pg_num")) {
|
||||
if (n <= 0 || static_cast<uint64_t>(n) >
|
||||
g_conf().get_val<uint64_t>("mon_max_pool_pg_num")) {
|
||||
ss << "'pg_num' must be greater than 0 and less than or equal to "
|
||||
<< g_conf().get_val<uint64_t>("mon_max_pool_pg_num")
|
||||
<< " (you may adjust 'mon max pool pg num' for higher values)";
|
||||
|
Loading…
Reference in New Issue
Block a user