}
}
+RGWSimpleCoroutine::~RGWSimpleCoroutine()
+{
+ if (!called_cleanup) {
+ request_cleanup();
+ }
+}
+
+void RGWSimpleCoroutine::call_cleanup()
+{
+ called_cleanup = true;
+ request_cleanup();
+}
+
int RGWSimpleCoroutine::operate()
{
int ret = 0;
yield return state_request_complete();
yield return state_all_complete();
drain_all();
+ call_cleanup();
return set_state(RGWCoroutine_Done, ret);
}
return 0;
{
int ret = init();
if (ret < 0) {
+ call_cleanup();
return set_state(RGWCoroutine_Error, ret);
}
return 0;
{
int ret = send_request();
if (ret < 0) {
+ call_cleanup();
return set_state(RGWCoroutine_Error, ret);
}
return io_block(0);
{
int ret = request_complete();
if (ret < 0) {
+ call_cleanup();
return set_state(RGWCoroutine_Error, ret);
}
return 0;
{
int ret = finish();
if (ret < 0) {
+ call_cleanup();
return set_state(RGWCoroutine_Error, ret);
}
return 0;
RGWCoroutine *caller;
RGWAioCompletionNotifier *notifier;
- void *user_info;
int retcode;
bool done;
protected:
virtual int _send_request() = 0;
public:
- RGWAsyncRadosRequest(RGWCoroutine *_caller, RGWAioCompletionNotifier *_cn) : caller(_caller), notifier(_cn),
+ RGWAsyncRadosRequest(RGWCoroutine *_caller, RGWAioCompletionNotifier *_cn) : caller(_caller), notifier(_cn), retcode(0),
done(false), lock("RGWAsyncRadosRequest::lock") {
+ notifier->get();
caller->get();
}
virtual ~RGWAsyncRadosRequest() {
+ notifier->put();
caller->put();
}
void send_request() {
+ get();
retcode = _send_request();
{
Mutex::Locker l(lock);
notifier->cb();
}
}
+ put();
}
int get_ret_status() { return retcode; }
result(_result),
req(NULL) { }
- ~RGWSimpleRadosReadCR() {
+ void request_cleanup() {
if (req) {
req->finish();
}
pattrs(_pattrs),
req(NULL) { }
- ~RGWSimpleRadosReadAttrsCR() {
+ void request_cleanup() {
if (req) {
req->finish();
}
::encode(_data, bl);
}
- ~RGWSimpleRadosWriteCR() {
+ void request_cleanup() {
if (req) {
req->finish();
}
attrs(_attrs), req(NULL) {
}
- ~RGWSimpleRadosWriteAttrsCR() {
+ void request_cleanup() {
if (req) {
req->finish();
}
RGWRadosSetOmapKeysCR(RGWRados *_store,
rgw_bucket& _pool, const string& _oid,
map<string, bufferlist>& _entries);
+
~RGWRadosSetOmapKeysCR();
int send_request();
const rgw_bucket& _pool, const string& _oid,
const string& _marker,
map<string, bufferlist> *_entries, int _max_entries);
+
~RGWRadosGetOmapKeysCR();
int send_request();
const rgw_bucket& _pool, const string& _oid, const string& _lock_name,
const string& _cookie,
uint32_t _duration);
- ~RGWSimpleRadosLockCR();
+ void request_cleanup();
int send_request();
int request_complete();
RGWSimpleRadosUnlockCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
const rgw_bucket& _pool, const string& _oid, const string& _lock_name,
const string& _cookie);
- ~RGWSimpleRadosUnlockCR();
+ void request_cleanup();
int send_request();
int request_complete();
async_rados(_async_rados), lock(_lock), cond(_cond), secs(_secs), req(NULL) {
}
- ~RGWWaitCR() {
+ void request_cleanup() {
wakeup();
if (req) {
req->finish();
RGWBucketInfo *_bucket_info) : RGWSimpleCoroutine(_store->ctx()), async_rados(_async_rados), store(_store),
bucket_name(_bucket_name), bucket_id(_bucket_id),
bucket_info(_bucket_info), req(NULL) {}
- ~RGWGetBucketInstanceInfoCR() {
+ void request_cleanup() {
if (req) {
req->finish();
}
copy_if_newer(_if_newer), req(NULL) {}
- ~RGWFetchRemoteObjCR() {
+ void request_cleanup() {
if (req) {
req->finish();
}
}
}
- ~RGWRemoveObjCR() {
+ void request_cleanup() {
if (req) {
req->finish();
}
const rgw_obj& obj, uint64_t *psize = nullptr,
real_time* pmtime = nullptr, uint64_t *pepoch = nullptr,
RGWObjVersionTracker *objv_tracker = nullptr);
- ~RGWStatObjCR();
+ void request_cleanup();
int send_request() override;
int request_complete() override;