]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgwlc: avoid front() on empty lc entry vector
authorMatt Benjamin <mbenjamin@redhat.com>
Fri, 18 Feb 2022 14:31:06 +0000 (09:31 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Thu, 17 Mar 2022 15:07:43 +0000 (11:07 -0400)
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 <mbenjamin@redhat.com>
src/rgw/rgw_lc.cc

index e1fbe374e8fb5b7982c0248a927fd0b001804d7e..620576a9a496c67d60919745703ba3409fb84561 100644 (file)
@@ -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 "