From: Matt Benjamin Date: Fri, 18 Feb 2022 14:31:06 +0000 (-0500) Subject: rgwlc: avoid front() on empty lc entry vector X-Git-Tag: v18.0.0~1240^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d83540235e315be4c12ced8cbccd79f81e10b7bd;p=ceph.git rgwlc: avoid front() on empty lc entry vector Conveniently, this arose after removing all lifecycle shards from RADOS, proving it could be done safely. A restart is currently needed to recognize new lifecycle shards, if rgw_gc_max_objs also changed. Signed-off-by: Matt Benjamin --- diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index e1fbe374e8fb..620576a9a496 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -2155,9 +2155,11 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker, << "entries) returned error ret==" << ret << dendl; goto exit; } - entry = entries.front(); - head.marker = entry.bucket; - head.start_date = now; + if (entries.size() > 0) { + entry = entries.front(); + head.marker = entry.bucket; + head.start_date = now; + } } else { ldpp_dout(this, 0) << "RGWLC::process() head.marker !empty() at START for shard==" << lc_shard << " head last stored at "