From 25004d961fca0d99f67f80df9ffa3a321386cd06 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Tue, 13 Jul 2021 16:05:47 -0400 Subject: [PATCH] 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 (cherry picked from commit 97305f03c16db1cfaceef04a74ee510bc1fc1e80) https://tracker.ceph.com/issues/51675 Signed-off-by: Adam C. Emerson --- src/rgw/rgw_datalog.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rgw/rgw_datalog.cc b/src/rgw/rgw_datalog.cc index 64d13270ac04..fbfcf087922e 100644 --- a/src/rgw/rgw_datalog.cc +++ b/src/rgw/rgw_datalog.cc @@ -805,6 +805,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; -- 2.47.3