Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: fix error_repo segfault in data sync #10157

Merged
merged 1 commit into from Jul 8, 2016

Conversation

cbodley
Copy link
Contributor

@cbodley cbodley commented Jul 6, 2016

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

Fixes: http://tracker.ceph.com/issues/16603

Signed-off-by: Casey Bodley cbodley@redhat.com

@yehudasa
Copy link
Member

yehudasa commented Jul 6, 2016

@cbodley need to make sure that we aren't implicitly cross holding a reference (check that error_repo is not holding a reference to the caller via the cr infrastructure), otherwise neither error_repo is going to be freed, or RGWDataSyncSingleEntryCR

@cbodley
Copy link
Contributor Author

cbodley commented Jul 6, 2016

@yehudasa i see. probably easier for RGWDataSyncShardCR to hold the error_repo reference until it destructs, i.e.:

   void stop_spawned_services() {
     lease_cr->go_down();
     if (error_repo) {
       error_repo->finish();
-      error_repo->put();
-      error_repo = NULL;
     }
   }

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>
@yehudasa
Copy link
Member

yehudasa commented Jul 8, 2016

@cbodley lgtm

@cbodley cbodley merged commit 0273d55 into ceph:master Jul 8, 2016
@cbodley cbodley deleted the wip-rgw-sync-error-repo branch July 8, 2016 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants