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: RGWCoroutine::call(nullptr) sets retcode=0 #29856

Merged
merged 1 commit into from Sep 3, 2019

Conversation

cbodley
Copy link
Contributor

@cbodley cbodley commented Aug 23, 2019

callers generally expect 'yield call(...);' to set retcode with the
result of the given coroutine. it's valid to call() a nullptr, but
that's not always clear at the call site - for example, this critical
piece of code in RGWBucketSyncSingleEntryCR::operate():

  if (sync_status == 0) {
    /* update marker */
    set_status() << "calling marker_tracker->finish(" << entry_marker << ")";
    yield call(marker_tracker->finish(entry_marker));
    sync_status = retcode;
  }

marker_tracker->finish() only returns a coroutine when it needs to flush
the marker; otherwise it returns a nullptr. as a result, 'retcode' may
not be assigned as expected by the call(), and a previous value is
mistakenly returned up the stack

Fixes: https://tracker.ceph.com/issues/41412

callers generally expect 'yield call(...);' to set retcode with the
result of the given coroutine. it's valid to call() a nullptr, but
that's not always clear at the call site - for example, this critical
piece of code in RGWBucketSyncSingleEntryCR::operate():

      if (sync_status == 0) {
        /* update marker */
        set_status() << "calling marker_tracker->finish(" << entry_marker << ")";
        yield call(marker_tracker->finish(entry_marker));
        sync_status = retcode;
      }

marker_tracker->finish() only returns a coroutine when it needs to flush
the marker; otherwise it returns a nullptr. as a result, 'retcode' may
not be assigned as expected by the call(), and a previous value is
mistakenly returned up the stack

Fixes: https://tracker.ceph.com/issues/41412

Signed-off-by: Casey Bodley <cbodley@redhat.com>
Copy link
Member

@yehudasa yehudasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@cbodley
Copy link
Contributor Author

cbodley commented Sep 3, 2019

@cbodley
Copy link
Contributor Author

cbodley commented Sep 3, 2019

jenkins test this please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants