From: Adam C. Emerson Date: Tue, 13 Jul 2021 20:05:47 +0000 (-0400) Subject: rgw: Don't segfault on datalog trim X-Git-Tag: v17.1.0~1401^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F42324%2Fhead;p=ceph.git rgw: Don't segfault on datalog trim Synchronous (or yielded, basically other-than AioCompletion trim) would try to dereference the past-the-end iterator if we were trimming to a point in the most recent generation. https://tracker.ceph.com/issues/51661 Signed-off-by: Adam C. Emerson --- diff --git a/src/rgw/rgw_datalog.cc b/src/rgw/rgw_datalog.cc index 1acb04d70928..ddc85802b30e 100644 --- a/src/rgw/rgw_datalog.cc +++ b/src/rgw/rgw_datalog.cc @@ -804,6 +804,8 @@ int DataLogBackends::trim_entries(const DoutPrefixProvider *dpp, int shard_id, s r = -ENODATA; if (r == -ENODATA && be->gen_id < target_gen) r = 0; + if (be->gen_id == target_gen) + break; l.lock(); }; return r;