]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: Don't segfault on datalog trim
authorAdam C. Emerson <aemerson@redhat.com>
Tue, 13 Jul 2021 20:05:47 +0000 (16:05 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Wed, 14 Jul 2021 12:43:32 +0000 (08:43 -0400)
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 <aemerson@redhat.com>
src/rgw/rgw_datalog.cc

index 1acb04d70928064cdd50160be1ea26bb17e9f224..ddc85802b30e0a02a4ac5df2142194a150da85ac 100644 (file)
@@ -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;