]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix error_repo segfault in data sync 10523/head
authorCasey Bodley <cbodley@redhat.com>
Wed, 6 Jul 2016 13:15:29 +0000 (09:15 -0400)
committerAbhishek Varshney <abhishek.varshney@flipkart.com>
Mon, 1 Aug 2016 08:12:19 +0000 (13:42 +0530)
RGWDataSyncShardCR will only allocate an error_repo if it's doing
incremental sync, so RGWDataSyncSingleEntryCR needs to guard against a
null error_repo

also, RGWDataSyncShardCR::stop_spawned_services() was dropping the last
reference to the error_repo before calling drain_all(), which meant that
RGWDataSyncSingleEntryCR could still be holding a pointer. now uses a
boost::intrusive_ptr in RGWDataSyncSingleEntryCR to account for its
reference

Fixes: http://tracker.ceph.com/issues/16603
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 28609029cf1be2fc9f8c8e3f47320636db29014a)

src/rgw/rgw_data_sync.cc

index 434e0f37014a0a56fbbc6413355db899c84d4614..a9c2361c42bcb34292ede1a6034963ca081f0511 100644 (file)
@@ -785,7 +785,7 @@ class RGWDataSyncSingleEntryCR : public RGWCoroutine {
 
   RGWDataSyncShardMarkerTrack *marker_tracker;
 
-  RGWOmapAppend *error_repo;
+  boost::intrusive_ptr<RGWOmapAppend> error_repo;
   bool remove_from_repo;
 
   set<string> keys;
@@ -826,10 +826,10 @@ public:
         if (retcode < 0) {
           ldout(sync_env->store->ctx(), 0) << "ERROR: failed to log sync failure: retcode=" << retcode << dendl;
         }
-        if (!error_repo->append(raw_key)) {
+        if (error_repo && !error_repo->append(raw_key)) {
           ldout(sync_env->store->ctx(), 0) << "ERROR: failed to log sync failure in error repo: retcode=" << retcode << dendl;
         }
-      } else if (remove_from_repo) {
+      } else if (error_repo && remove_from_repo) {
         keys = {raw_key};
         yield call(new RGWRadosRemoveOmapKeysCR(sync_env->store, error_repo->get_pool(), error_repo->get_oid(), keys));
         if (retcode < 0) {