If osd_pg_max_concurrent_snap_trims is zero, we mistakenly clear
the snaptrim queue. Require it to be > 0.
Fixes: https://tracker.ceph.com/issues/54396
Signed-off-by: Dan van der Ster <daniel.vanderster@cern.ch>
(cherry picked from commit
29545b617b3b0324f9b0b20e032e3e38557115eb)
Conflicts:
src/common/options/global.yaml.in
- This file does not exist in Pacific; rather, global options are defined in src/common/options.cc.
Option("osd_pg_max_concurrent_snap_trims", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
.set_default(2)
+ .set_min(1)
.set_description(""),
Option("osd_max_trimming_pgs", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
vector<hobject_t> to_trim;
unsigned max = pg->cct->_conf->osd_pg_max_concurrent_snap_trims;
+ // we need to look for at least 1 snaptrim, otherwise we'll misinterpret
+ // the ENOENT below and erase snap_to_trim.
+ ceph_assert(max > 0);
to_trim.reserve(max);
int r = pg->snap_mapper.get_next_objects_to_trim(
snap_to_trim,
{
ceph_assert(out);
ceph_assert(out->empty());
+
+ // if max would be 0, we return ENOENT and the caller would mistakenly
+ // trim the snaptrim queue
+ ceph_assert(max > 0);
int r = 0;
for (set<string>::iterator i = prefixes.begin();
i != prefixes.end() && out->size() < max && r == 0;