mirror of
https://github.com/ceph/ceph
synced 2025-01-10 13:10:46 +00:00
rgw: cloud sync: fix crash due to objs on cr stack
Fixes: https://tracker.ceph.com/issues/57306 When passing objects that are declared on the stack (as ref / ptr), called cr can't access them (other than for initialization), as the yield destroys them. We now keep these objects as class members. Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
parent
123b8a3db7
commit
ae67726441
@ -1594,6 +1594,13 @@ class RGWAWSHandleRemoteObjCBCR: public RGWStatRemoteObjCBCR {
|
||||
}
|
||||
} result;
|
||||
|
||||
rgw_bucket target_bucket;
|
||||
std::unique_ptr<rgw::sal::RadosBucket> bucket;
|
||||
std::unique_ptr<rgw::sal::RadosObject> src_obj;
|
||||
std::unique_ptr<rgw::sal::RadosBucket> dest_bucket;
|
||||
std::unique_ptr<rgw::sal::RadosObject> dest_obj;
|
||||
|
||||
|
||||
public:
|
||||
RGWAWSHandleRemoteObjCBCR(RGWDataSyncCtx *_sc,
|
||||
rgw_bucket_sync_pipe& _sync_pipe,
|
||||
@ -1672,16 +1679,14 @@ public:
|
||||
}
|
||||
|
||||
yield {
|
||||
rgw::sal::RadosBucket bucket(sync_env->store, src_bucket);
|
||||
rgw::sal::RadosObject src_obj(sync_env->store, key, &bucket);
|
||||
bucket.reset(new rgw::sal::RadosBucket(sync_env->store, src_bucket));
|
||||
src_obj.reset(new rgw::sal::RadosObject(sync_env->store, key, bucket.get()));
|
||||
|
||||
/* init output */
|
||||
rgw_bucket target_bucket;
|
||||
target_bucket.name = target_bucket_name; /* this is only possible because we only use bucket name for
|
||||
uri resolution */
|
||||
rgw::sal::RadosBucket dest_bucket(sync_env->store, target_bucket);
|
||||
rgw::sal::RadosObject dest_obj(sync_env->store, rgw_obj_key(target_obj_name), &dest_bucket);
|
||||
|
||||
dest_bucket.reset(new rgw::sal::RadosBucket(sync_env->store, target_bucket));
|
||||
dest_obj.reset(new rgw::sal::RadosObject(sync_env->store, rgw_obj_key(target_obj_name), dest_bucket.get()));
|
||||
|
||||
rgw_sync_aws_src_obj_properties src_properties;
|
||||
src_properties.mtime = mtime;
|
||||
@ -1691,10 +1696,10 @@ public:
|
||||
src_properties.versioned_epoch = versioned_epoch;
|
||||
|
||||
if (size < instance.conf.s3.multipart_sync_threshold) {
|
||||
call(new RGWAWSStreamObjToCloudPlainCR(sc, source_conn, &src_obj,
|
||||
call(new RGWAWSStreamObjToCloudPlainCR(sc, source_conn, src_obj.get(),
|
||||
src_properties,
|
||||
target,
|
||||
&dest_obj));
|
||||
dest_obj.get()));
|
||||
} else {
|
||||
rgw_rest_obj rest_obj;
|
||||
rest_obj.init(key);
|
||||
@ -1702,8 +1707,8 @@ public:
|
||||
ldpp_dout(dpp, 0) << "ERROR: failed to decode rest obj out of headers=" << headers << ", attrs=" << attrs << dendl;
|
||||
return set_cr_error(-EINVAL);
|
||||
}
|
||||
call(new RGWAWSStreamObjToCloudMultipartCR(sc, sync_pipe, instance.conf, source_conn, &src_obj,
|
||||
target, &dest_obj, size, src_properties, rest_obj));
|
||||
call(new RGWAWSStreamObjToCloudMultipartCR(sc, sync_pipe, instance.conf, source_conn, src_obj.get(),
|
||||
target, dest_obj.get(), size, src_properties, rest_obj));
|
||||
}
|
||||
}
|
||||
if (retcode < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user