summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/common/tracer.h19
-rw-r--r--src/rgw/driver/d4n/rgw_sal_d4n.cc8
-rw-r--r--src/rgw/driver/d4n/rgw_sal_d4n.h2
-rw-r--r--src/rgw/driver/daos/rgw_sal_daos.cc2
-rw-r--r--src/rgw/driver/daos/rgw_sal_daos.h2
-rw-r--r--src/rgw/driver/motr/rgw_sal_motr.cc2
-rw-r--r--src/rgw/driver/motr/rgw_sal_motr.h2
-rw-r--r--src/rgw/driver/posix/rgw_sal_posix.cc18
-rw-r--r--src/rgw/driver/posix/rgw_sal_posix.h4
-rw-r--r--src/rgw/driver/rados/rgw_cr_rados.cc5
-rw-r--r--src/rgw/driver/rados/rgw_putobj_processor.cc28
-rw-r--r--src/rgw/driver/rados/rgw_putobj_processor.h6
-rw-r--r--src/rgw/driver/rados/rgw_rados.cc160
-rw-r--r--src/rgw/driver/rados/rgw_rados.h13
-rw-r--r--src/rgw/driver/rados/rgw_sal_rados.cc27
-rw-r--r--src/rgw/driver/rados/rgw_sal_rados.h8
-rw-r--r--src/rgw/driver/rados/rgw_tools.cc3
-rw-r--r--src/rgw/rgw_file.cc3
-rw-r--r--src/rgw/rgw_lc.cc4
-rw-r--r--src/rgw/rgw_op.cc9
-rw-r--r--src/rgw/rgw_req_context.h18
-rw-r--r--src/rgw/rgw_sal.h5
-rw-r--r--src/rgw/rgw_sal_dbstore.cc8
-rw-r--r--src/rgw/rgw_sal_dbstore.h8
-rw-r--r--src/rgw/rgw_sal_filter.cc4
-rw-r--r--src/rgw/rgw_sal_filter.h2
-rw-r--r--src/test/rgw/test_d4n_filter.cc11
27 files changed, 209 insertions, 172 deletions
diff --git a/src/common/tracer.h b/src/common/tracer.h
index 8a19db39021..94efedbed6e 100644
--- a/src/common/tracer.h
+++ b/src/common/tracer.h
@@ -67,7 +67,8 @@ struct jspan_context {
jspan_context(bool sampled_flag, bool is_remote) {}
};
-struct span_stub {
+namespace opentelemetry::trace {
+struct Span {
jspan_context _ctx;
template <typename T>
void SetAttribute(std::string_view key, const T& value) const noexcept {}
@@ -78,17 +79,21 @@ struct span_stub {
void UpdateName(std::string_view) {}
bool IsRecording() { return false; }
};
+}
class jspan {
- span_stub span;
- public:
- span_stub& operator*() { return span; }
- const span_stub& operator*() const { return span; }
+ opentelemetry::trace::Span span;
+public:
+ opentelemetry::trace::Span& operator*() { return span; }
+ const opentelemetry::trace::Span& operator*() const { return span; }
- span_stub* operator->() { return &span; }
- const span_stub* operator->() const { return &span; }
+ opentelemetry::trace::Span* operator->() { return &span; }
+ const opentelemetry::trace::Span* operator->() const { return &span; }
operator bool() const { return false; }
+
+ opentelemetry::trace::Span* get() { return &span; }
+ const opentelemetry::trace::Span* get() const { return &span; }
};
namespace tracing {
diff --git a/src/rgw/driver/d4n/rgw_sal_d4n.cc b/src/rgw/driver/d4n/rgw_sal_d4n.cc
index ff2ed7d9a20..3195d87eac4 100644
--- a/src/rgw/driver/d4n/rgw_sal_d4n.cc
+++ b/src/rgw/driver/d4n/rgw_sal_d4n.cc
@@ -445,7 +445,7 @@ int D4NFilterWriter::complete(size_t accounted_size, const std::string& etag,
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y)
+ const req_context& rctx)
{
cache_block* temp_cache_block = filter->get_cache_block();
RGWBlockDirectory* temp_block_dir = filter->get_block_dir();
@@ -467,9 +467,9 @@ int D4NFilterWriter::complete(size_t accounted_size, const std::string& etag,
RGWObjState* astate;
int ret = next->complete(accounted_size, etag, mtime, set_mtime, attrs,
delete_at, if_match, if_nomatch, user_data, zones_trace,
- canceled, y);
- obj->get_obj_attrs(y, save_dpp, NULL);
- obj->get_obj_state(save_dpp, &astate, y);
+ canceled, rctx);
+ obj->get_obj_attrs(rctx.y, save_dpp, NULL);
+ obj->get_obj_state(save_dpp, &astate, rctx.y);
/* Append additional metadata to attributes */
rgw::sal::Attrs baseAttrs = obj->get_attrs();
diff --git a/src/rgw/driver/d4n/rgw_sal_d4n.h b/src/rgw/driver/d4n/rgw_sal_d4n.h
index 62c13f0abed..5a2cd88896d 100644
--- a/src/rgw/driver/d4n/rgw_sal_d4n.h
+++ b/src/rgw/driver/d4n/rgw_sal_d4n.h
@@ -191,7 +191,7 @@ class D4NFilterWriter : public FilterWriter {
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) override;
+ const req_context& rctx) override;
bool is_atomic() { return atomic; };
const DoutPrefixProvider* dpp() { return save_dpp; }
};
diff --git a/src/rgw/driver/daos/rgw_sal_daos.cc b/src/rgw/driver/daos/rgw_sal_daos.cc
index 46db3dd654c..73eec5b3e09 100644
--- a/src/rgw/driver/daos/rgw_sal_daos.cc
+++ b/src/rgw/driver/daos/rgw_sal_daos.cc
@@ -2047,7 +2047,7 @@ int DaosMultipartWriter::complete(
ceph::real_time set_mtime, std::map<std::string, bufferlist>& attrs,
ceph::real_time delete_at, const char* if_match, const char* if_nomatch,
const std::string* user_data, rgw_zone_set* zones_trace, bool* canceled,
- optional_yield y) {
+ const req_context& rctx) {
ldpp_dout(dpp, 20) << "DaosMultipartWriter::complete(): enter part="
<< part_num_str << dendl;
diff --git a/src/rgw/driver/daos/rgw_sal_daos.h b/src/rgw/driver/daos/rgw_sal_daos.h
index 0eaf495d2e2..429c6160488 100644
--- a/src/rgw/driver/daos/rgw_sal_daos.h
+++ b/src/rgw/driver/daos/rgw_sal_daos.h
@@ -748,7 +748,7 @@ class DaosAtomicWriter : public StoreWriter {
ceph::real_time delete_at, const char* if_match,
const char* if_nomatch, const std::string* user_data,
rgw_zone_set* zones_trace, bool* canceled,
- optional_yield y) override;
+ const req_context& rctx) override;
};
class DaosMultipartWriter : public StoreWriter {
diff --git a/src/rgw/driver/motr/rgw_sal_motr.cc b/src/rgw/driver/motr/rgw_sal_motr.cc
index 06df127594e..83c6153a92a 100644
--- a/src/rgw/driver/motr/rgw_sal_motr.cc
+++ b/src/rgw/driver/motr/rgw_sal_motr.cc
@@ -2355,7 +2355,7 @@ int MotrAtomicWriter::complete(size_t accounted_size, const std::string& etag,
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y)
+ const req_context& rctx)
{
int rc = 0;
diff --git a/src/rgw/driver/motr/rgw_sal_motr.h b/src/rgw/driver/motr/rgw_sal_motr.h
index eee843d7eff..ce5fc2b95b1 100644
--- a/src/rgw/driver/motr/rgw_sal_motr.h
+++ b/src/rgw/driver/motr/rgw_sal_motr.h
@@ -814,7 +814,7 @@ class MotrAtomicWriter : public StoreWriter {
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) override;
+ const req_context& rctx) override;
unsigned populate_bvec(unsigned len, bufferlist::iterator &bi);
void cleanup();
diff --git a/src/rgw/driver/posix/rgw_sal_posix.cc b/src/rgw/driver/posix/rgw_sal_posix.cc
index 052471562e4..40091d06d0f 100644
--- a/src/rgw/driver/posix/rgw_sal_posix.cc
+++ b/src/rgw/driver/posix/rgw_sal_posix.cc
@@ -2914,7 +2914,7 @@ int POSIXMultipartWriter::complete(size_t accounted_size, const std::string& eta
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y)
+ const req_context& rctx)
{
int ret;
POSIXUploadPartInfo info;
@@ -2945,16 +2945,16 @@ int POSIXMultipartWriter::complete(size_t accounted_size, const std::string& eta
attrs[RGW_POSIX_ATTR_MPUPLOAD] = bl;
for (auto& attr : attrs) {
- ret = obj->write_attr(dpp, y, attr.first, attr.second);
+ ret = obj->write_attr(rctx.dpp, rctx.y, attr.first, attr.second);
if (ret < 0) {
- ldpp_dout(dpp, 20) << "ERROR: failed writing attr " << attr.first << dendl;
+ ldpp_dout(rctx.dpp, 20) << "ERROR: failed writing attr " << attr.first << dendl;
return ret;
}
}
ret = obj->close();
if (ret < 0) {
- ldpp_dout(dpp, 20) << "ERROR: failed closing file" << dendl;
+ ldpp_dout(rctx.dpp, 20) << "ERROR: failed closing file" << dendl;
return ret;
}
@@ -2981,7 +2981,7 @@ int POSIXAtomicWriter::complete(size_t accounted_size, const std::string& etag,
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y)
+ const req_context& rctx)
{
int ret;
@@ -3023,14 +3023,14 @@ int POSIXAtomicWriter::complete(size_t accounted_size, const std::string& etag,
attrs[RGW_POSIX_ATTR_OWNER] = bl;
for (auto attr : attrs) {
- ret = obj.write_attr(dpp, y, attr.first, attr.second);
+ ret = obj.write_attr(rctx.dpp, rctx.y, attr.first, attr.second);
if (ret < 0) {
- ldpp_dout(dpp, 20) << "ERROR: POSIXAtomicWriter failed writing attr " << attr.first << dendl;
+ ldpp_dout(rctx.dpp, 20) << "ERROR: POSIXAtomicWriter failed writing attr " << attr.first << dendl;
return ret;
}
}
- ret = obj.link_temp_file(dpp, y);
+ ret = obj.link_temp_file(rctx.dpp, rctx.y);
if (ret < 0) {
ldpp_dout(dpp, 20) << "ERROR: POSIXAtomicWriter failed writing temp file" << dendl;
return ret;
@@ -3038,7 +3038,7 @@ int POSIXAtomicWriter::complete(size_t accounted_size, const std::string& etag,
ret = obj.close();
if (ret < 0) {
- ldpp_dout(dpp, 20) << "ERROR: POSIXAtomicWriter failed closing file" << dendl;
+ ldpp_dout(rctx.dpp, 20) << "ERROR: POSIXAtomicWriter failed closing file" << dendl;
return ret;
}
diff --git a/src/rgw/driver/posix/rgw_sal_posix.h b/src/rgw/driver/posix/rgw_sal_posix.h
index a2a5e5fdda9..739e7ef7a61 100644
--- a/src/rgw/driver/posix/rgw_sal_posix.h
+++ b/src/rgw/driver/posix/rgw_sal_posix.h
@@ -625,7 +625,7 @@ public:
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) override;
+ const req_context& rctx) override;
};
class POSIXMultipartWriter : public StoreWriter {
@@ -664,7 +664,7 @@ public:
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) override;
+ const req_context& rctx) override;
};
diff --git a/src/rgw/driver/rados/rgw_cr_rados.cc b/src/rgw/driver/rados/rgw_cr_rados.cc
index 6556d116b8f..1baff16ff42 100644
--- a/src/rgw/driver/rados/rgw_cr_rados.cc
+++ b/src/rgw/driver/rados/rgw_cr_rados.cc
@@ -752,6 +752,7 @@ int RGWAsyncFetchRemoteObj::_send_request(const DoutPrefixProvider *dpp)
std::string etag;
std::optional<uint64_t> bytes_transferred;
+ const req_context rctx{dpp, null_yield, nullptr};
int r = store->getRados()->fetch_remote_obj(obj_ctx,
user_id.value_or(rgw_user()),
NULL, /* req_info */
@@ -778,8 +779,8 @@ int RGWAsyncFetchRemoteObj::_send_request(const DoutPrefixProvider *dpp)
&etag, /* string *petag, */
NULL, /* void (*progress_cb)(off_t, void *), */
NULL, /* void *progress_data*); */
- dpp,
- filter.get(), null_yield,
+ rctx,
+ filter.get(),
stat_follow_olh,
stat_dest_obj,
source_trace_entry,
diff --git a/src/rgw/driver/rados/rgw_putobj_processor.cc b/src/rgw/driver/rados/rgw_putobj_processor.cc
index 9eb2ef26668..65fbd5791d5 100644
--- a/src/rgw/driver/rados/rgw_putobj_processor.cc
+++ b/src/rgw/driver/rados/rgw_putobj_processor.cc
@@ -341,7 +341,8 @@ int AtomicObjectProcessor::complete(size_t accounted_size,
const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace,
- bool *pcanceled, optional_yield y)
+ bool *pcanceled,
+ const req_context& rctx)
{
int r = writer.drain();
if (r < 0) {
@@ -378,7 +379,7 @@ int AtomicObjectProcessor::complete(size_t accounted_size,
read_cloudtier_info_from_attrs(attrs, obj_op.meta.category, manifest);
- r = obj_op.write_meta(dpp, actual_size, accounted_size, attrs, y);
+ r = obj_op.write_meta(actual_size, accounted_size, attrs, rctx);
if (r < 0) {
if (r == -ETIMEDOUT) {
// The head object write may eventually succeed, clear the set of objects for deletion. if it
@@ -482,7 +483,8 @@ int MultipartObjectProcessor::complete(size_t accounted_size,
const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace,
- bool *pcanceled, optional_yield y)
+ bool *pcanceled,
+ const req_context& rctx)
{
int r = writer.drain();
if (r < 0) {
@@ -506,7 +508,7 @@ int MultipartObjectProcessor::complete(size_t accounted_size,
obj_op.meta.zones_trace = zones_trace;
obj_op.meta.modify_tail = true;
- r = obj_op.write_meta(dpp, actual_size, accounted_size, attrs, y);
+ r = obj_op.write_meta(actual_size, accounted_size, attrs, rctx);
if (r < 0)
return r;
@@ -531,7 +533,7 @@ int MultipartObjectProcessor::complete(size_t accounted_size,
bool compressed;
r = rgw_compression_info_from_attrset(attrs, compressed, info.cs_info);
if (r < 0) {
- ldpp_dout(dpp, 1) << "cannot get compression info" << dendl;
+ ldpp_dout(rctx.dpp, 1) << "cannot get compression info" << dendl;
return r;
}
@@ -543,16 +545,16 @@ int MultipartObjectProcessor::complete(size_t accounted_size,
store->obj_to_raw(bucket_info.placement_rule, meta_obj, &meta_raw_obj);
rgw_rados_ref meta_obj_ref;
- r = store->get_raw_obj_ref(dpp, meta_raw_obj, &meta_obj_ref);
+ r = store->get_raw_obj_ref(rctx.dpp, meta_raw_obj, &meta_obj_ref);
if (r < 0) {
- ldpp_dout(dpp, -1) << "ERROR: failed to get obj ref of meta obj with ret=" << r << dendl;
+ ldpp_dout(rctx.dpp, -1) << "ERROR: failed to get obj ref of meta obj with ret=" << r << dendl;
return r;
}
librados::ObjectWriteOperation op;
cls_rgw_mp_upload_part_info_update(op, p, info);
- r = rgw_rados_operate(dpp, meta_obj_ref.pool.ioctx(), meta_obj_ref.obj.oid, &op, y);
- ldpp_dout(dpp, 20) << "Update meta: " << meta_obj_ref.obj.oid << " part " << p << " prefix " << info.manifest.get_prefix() << " return " << r << dendl;
+ r = rgw_rados_operate(rctx.dpp, meta_obj_ref.pool.ioctx(), meta_obj_ref.obj.oid, &op, rctx.y);
+ ldpp_dout(rctx.dpp, 20) << "Update meta: " << meta_obj_ref.obj.oid << " part " << p << " prefix " << info.manifest.get_prefix() << " return " << r << dendl;
if (r == -EOPNOTSUPP) {
// New CLS call to update part info is not yet supported. Fall back to the old handling.
@@ -565,7 +567,7 @@ int MultipartObjectProcessor::complete(size_t accounted_size,
op = librados::ObjectWriteOperation{};
op.assert_exists(); // detect races with abort
op.omap_set(m);
- r = rgw_rados_operate(dpp, meta_obj_ref.pool.ioctx(), meta_obj_ref.obj.oid, &op, y);
+ r = rgw_rados_operate(rctx.dpp, meta_obj_ref.pool.ioctx(), meta_obj_ref.obj.oid, &op, rctx.y);
}
if (r < 0) {
return r == -ENOENT ? -ERR_NO_SUCH_UPLOAD : r;
@@ -686,7 +688,7 @@ int AppendObjectProcessor::complete(size_t accounted_size, const string &etag, c
ceph::real_time set_mtime, rgw::sal::Attrs& attrs,
ceph::real_time delete_at, const char *if_match, const char *if_nomatch,
const string *user_data, rgw_zone_set *zones_trace, bool *pcanceled,
- optional_yield y)
+ const req_context& rctx)
{
int r = writer.drain();
if (r < 0)
@@ -742,9 +744,9 @@ int AppendObjectProcessor::complete(size_t accounted_size, const string &etag, c
etag_bl.append(final_etag_str, strlen(final_etag_str) + 1);
attrs[RGW_ATTR_ETAG] = etag_bl;
}
- r = obj_op.write_meta(dpp, actual_size + cur_size,
+ r = obj_op.write_meta(actual_size + cur_size,
accounted_size + *cur_accounted_size,
- attrs, y);
+ attrs, rctx);
if (r < 0) {
return r;
}
diff --git a/src/rgw/driver/rados/rgw_putobj_processor.h b/src/rgw/driver/rados/rgw_putobj_processor.h
index fa9200f32da..9a21c0c793a 100644
--- a/src/rgw/driver/rados/rgw_putobj_processor.h
+++ b/src/rgw/driver/rados/rgw_putobj_processor.h
@@ -191,7 +191,7 @@ class AtomicObjectProcessor : public ManifestObjectProcessor {
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) override;
+ const req_context& rctx) override;
};
@@ -238,7 +238,7 @@ class MultipartObjectProcessor : public ManifestObjectProcessor {
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) override;
+ const req_context& rctx) override;
};
@@ -274,7 +274,7 @@ class MultipartObjectProcessor : public ManifestObjectProcessor {
std::map<std::string, bufferlist>& attrs, ceph::real_time delete_at,
const char *if_match, const char *if_nomatch, const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) override;
+ const req_context& rctx) override;
};
} // namespace putobj
diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc
index 8814c5a1fba..5437d12d4b7 100644
--- a/src/rgw/driver/rados/rgw_rados.cc
+++ b/src/rgw/driver/rados/rgw_rados.cc
@@ -2665,8 +2665,8 @@ int RGWRados::fix_tail_obj_locator(const DoutPrefixProvider *dpp,
RGWObjState *astate = nullptr;
RGWObjManifest* manifest = nullptr;
- RGWObjectCtx rctx(this->driver);
- r = get_obj_state(dpp, &rctx, bucket_info, obj, &astate, &manifest, false, y);
+ RGWObjectCtx octx(this->driver);
+ r = get_obj_state(dpp, &octx, bucket_info, obj, &astate, &manifest, false, y);
if (r < 0)
return r;
@@ -3047,11 +3047,10 @@ int RGWRados::swift_versioning_restore(RGWObjectCtx& obj_ctx,
handler, y);
}
-int RGWRados::Object::Write::_do_write_meta(const DoutPrefixProvider *dpp,
- uint64_t size, uint64_t accounted_size,
+int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_size,
map<string, bufferlist>& attrs,
bool assume_noent, bool modify_tail,
- void *_index_op, optional_yield y)
+ void *_index_op, const req_context& rctx)
{
RGWRados::Bucket::UpdateIndex *index_op = static_cast<RGWRados::Bucket::UpdateIndex *>(_index_op);
RGWRados *store = target->get_store();
@@ -3070,19 +3069,19 @@ int RGWRados::Object::Write::_do_write_meta(const DoutPrefixProvider *dpp,
RGWObjState *state;
RGWObjManifest *manifest = nullptr;
- int r = target->get_state(dpp, &state, &manifest, false, y, assume_noent);
+ int r = target->get_state(rctx.dpp, &state, &manifest, false, rctx.y, assume_noent);
if (r < 0)
return r;
rgw_obj& obj = target->get_obj();
if (obj.get_oid().empty()) {
- ldpp_dout(dpp, 0) << "ERROR: " << __func__ << "(): cannot write object with empty name" << dendl;
+ ldpp_dout(rctx.dpp, 0) << "ERROR: " << __func__ << "(): cannot write object with empty name" << dendl;
return -EIO;
}
rgw_rados_ref ref;
- r = store->get_obj_head_ref(dpp, target->get_meta_placement_rule(), obj, &ref);
+ r = store->get_obj_head_ref(rctx.dpp, target->get_meta_placement_rule(), obj, &ref);
if (r < 0)
return r;
@@ -3094,7 +3093,7 @@ int RGWRados::Object::Write::_do_write_meta(const DoutPrefixProvider *dpp,
if (!ptag && !index_op->get_optag()->empty()) {
ptag = index_op->get_optag();
}
- r = target->prepare_atomic_modification(dpp, op, reset_obj, ptag, meta.if_match, meta.if_nomatch, false, modify_tail, y);
+ r = target->prepare_atomic_modification(rctx.dpp, op, reset_obj, ptag, meta.if_match, meta.if_nomatch, false, modify_tail, rctx.y);
if (r < 0)
return r;
@@ -3217,7 +3216,7 @@ int RGWRados::Object::Write::_do_write_meta(const DoutPrefixProvider *dpp,
if (!index_op->is_prepared()) {
tracepoint(rgw_rados, prepare_enter, req_id.c_str());
- r = index_op->prepare(dpp, CLS_RGW_OP_ADD, &state->write_tag, y);
+ r = index_op->prepare(rctx.dpp, CLS_RGW_OP_ADD, &state->write_tag, rctx.y);
tracepoint(rgw_rados, prepare_exit, req_id.c_str());
if (r < 0)
return r;
@@ -3226,7 +3225,7 @@ int RGWRados::Object::Write::_do_write_meta(const DoutPrefixProvider *dpp,
auto& ioctx = ref.pool.ioctx();
tracepoint(rgw_rados, operate_enter, req_id.c_str());
- r = rgw_rados_operate(dpp, ref.pool.ioctx(), ref.obj.oid, &op, y);
+ r = rgw_rados_operate(rctx.dpp, ref.pool.ioctx(), ref.obj.oid, &op, rctx.y);
tracepoint(rgw_rados, operate_exit, req_id.c_str());
if (r < 0) { /* we can expect to get -ECANCELED if object was replaced under,
or -ENOENT if was removed, or -EEXIST if it did not exist
@@ -3241,16 +3240,16 @@ int RGWRados::Object::Write::_do_write_meta(const DoutPrefixProvider *dpp,
epoch = ioctx.get_last_version();
poolid = ioctx.get_id();
- r = target->complete_atomic_modification(dpp, y);
+ r = target->complete_atomic_modification(rctx.dpp, rctx.y);
if (r < 0) {
- ldpp_dout(dpp, 0) << "ERROR: complete_atomic_modification returned r=" << r << dendl;
+ ldpp_dout(rctx.dpp, 0) << "ERROR: complete_atomic_modification returned r=" << r << dendl;
}
tracepoint(rgw_rados, complete_enter, req_id.c_str());
- r = index_op->complete(dpp, poolid, epoch, size, accounted_size,
+ r = index_op->complete(rctx.dpp, poolid, epoch, size, accounted_size,
meta.set_mtime, etag, content_type,
storage_class, &acl_bl,
- meta.category, meta.remove_objs, y,
+ meta.category, meta.remove_objs, rctx.y,
meta.user_data, meta.appendable);
tracepoint(rgw_rados, complete_exit, req_id.c_str());
if (r < 0)
@@ -3265,7 +3264,7 @@ int RGWRados::Object::Write::_do_write_meta(const DoutPrefixProvider *dpp,
state = NULL;
if (versioned_op && meta.olh_epoch) {
- r = store->set_olh(dpp, target->get_ctx(), target->get_bucket_info(), obj, false, NULL, *meta.olh_epoch, real_time(), false, y, meta.zones_trace);
+ r = store->set_olh(rctx.dpp, target->get_ctx(), target->get_bucket_info(), obj, false, NULL, *meta.olh_epoch, real_time(), false, rctx.y, meta.zones_trace);
if (r < 0) {
return r;
}
@@ -3275,10 +3274,10 @@ int RGWRados::Object::Write::_do_write_meta(const DoutPrefixProvider *dpp,
rgw_obj_index_key obj_key;
obj.key.get_index_key(&obj_key);
- r = store->obj_expirer->hint_add(dpp, meta.delete_at, obj.bucket.tenant, obj.bucket.name,
+ r = store->obj_expirer->hint_add(rctx.dpp, meta.delete_at, obj.bucket.tenant, obj.bucket.name,
obj.bucket.bucket_id, obj_key);
if (r < 0) {
- ldpp_dout(dpp, 0) << "ERROR: objexp_hint_add() returned r=" << r << ", object will not get removed" << dendl;
+ ldpp_dout(rctx.dpp, 0) << "ERROR: objexp_hint_add() returned r=" << r << ", object will not get removed" << dendl;
/* ignoring error, nothing we can do at this point */
}
}
@@ -3296,9 +3295,9 @@ int RGWRados::Object::Write::_do_write_meta(const DoutPrefixProvider *dpp,
return 0;
done_cancel:
- int ret = index_op->cancel(dpp, meta.remove_objs, y);
+ int ret = index_op->cancel(rctx.dpp, meta.remove_objs, rctx.y);
if (ret < 0) {
- ldpp_dout(dpp, 0) << "ERROR: index_op.cancel() returned ret=" << ret << dendl;
+ ldpp_dout(rctx.dpp, 0) << "ERROR: index_op.cancel() returned ret=" << ret << dendl;
}
meta.canceled = true;
@@ -3340,8 +3339,8 @@ done_cancel:
return r;
}
-int RGWRados::Object::Write::write_meta(const DoutPrefixProvider *dpp, uint64_t size, uint64_t accounted_size,
- map<string, bufferlist>& attrs, optional_yield y)
+int RGWRados::Object::Write::write_meta(uint64_t size, uint64_t accounted_size,
+ map<string, bufferlist>& attrs, const req_context& rctx)
{
RGWBucketInfo& bucket_info = target->get_bucket_info();
@@ -3352,13 +3351,13 @@ int RGWRados::Object::Write::write_meta(const DoutPrefixProvider *dpp, uint64_t
bool assume_noent = (meta.if_match == NULL && meta.if_nomatch == NULL);
int r;
if (assume_noent) {
- r = _do_write_meta(dpp, size, accounted_size, attrs, assume_noent, meta.modify_tail, (void *)&index_op, y);
+ r = _do_write_meta(size, accounted_size, attrs, assume_noent, meta.modify_tail, (void *)&index_op, rctx);
if (r == -EEXIST) {
assume_noent = false;
}
}
if (!assume_noent) {
- r = _do_write_meta(dpp, size, accounted_size, attrs, assume_noent, meta.modify_tail, (void *)&index_op, y);
+ r = _do_write_meta(size, accounted_size, attrs, assume_noent, meta.modify_tail, (void *)&index_op, rctx);
}
return r;
}
@@ -3624,11 +3623,11 @@ static void set_copy_attrs(map<string, bufferlist>& src_attrs,
int RGWRados::rewrite_obj(RGWBucketInfo& dest_bucket_info, const rgw_obj& obj, const DoutPrefixProvider *dpp, optional_yield y)
{
- RGWObjectCtx rctx(this->driver);
+ RGWObjectCtx octx(this->driver);
rgw::sal::Attrs attrset;
uint64_t obj_size;
ceph::real_time mtime;
- RGWRados::Object op_target(this, dest_bucket_info, rctx, obj);
+ RGWRados::Object op_target(this, dest_bucket_info, octx, obj);
RGWRados::Object::Read read_op(&op_target);
read_op.params.attrs = &attrset;
@@ -3643,7 +3642,7 @@ int RGWRados::rewrite_obj(RGWBucketInfo& dest_bucket_info, const rgw_obj& obj, c
attrset.erase(RGW_ATTR_TAIL_TAG);
attrset.erase(RGW_ATTR_STORAGE_CLASS);
- return copy_obj_data(rctx, dest_bucket_info, dest_bucket_info.placement_rule,
+ return copy_obj_data(octx, dest_bucket_info, dest_bucket_info.placement_rule,
read_op, obj_size - 1, obj, NULL, mtime,
attrset, 0, real_time(), NULL, dpp, y);
}
@@ -4138,8 +4137,8 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
string *petag,
void (*progress_cb)(off_t, void *),
void *progress_data,
- const DoutPrefixProvider *dpp,
- RGWFetchObjFilter *filter, optional_yield y,
+ const req_context& rctx,
+ RGWFetchObjFilter *filter,
bool stat_follow_olh,
const rgw_obj& stat_dest_obj,
const rgw_zone_set_entry& source_trace_entry,
@@ -4160,7 +4159,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
using namespace rgw::putobj;
AtomicObjectProcessor processor(&aio, this, dest_bucket_info, nullptr,
user_id, obj_ctx, dest_obj, olh_epoch,
- tag, dpp, y);
+ tag, rctx.dpp, rctx.y);
RGWRESTConn *conn;
auto& zone_conn_map = svc.zone->get_zone_conn_map();
auto& zonegroup_conn_map = svc.zone->get_zonegroup_conn_map();
@@ -4171,7 +4170,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
} else {
map<string, RGWRESTConn *>::iterator iter = zonegroup_conn_map.find(src_bucket_info->zonegroup);
if (iter == zonegroup_conn_map.end()) {
- ldpp_dout(dpp, 0) << "could not find zonegroup connection to zonegroup: " << source_zone << dendl;
+ ldpp_dout(rctx.dpp, 0) << "could not find zonegroup connection to zonegroup: " << source_zone << dendl;
return -ENOENT;
}
conn = iter->second;
@@ -4179,7 +4178,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
} else {
auto iter = zone_conn_map.find(source_zone);
if (iter == zone_conn_map.end()) {
- ldpp_dout(dpp, 0) << "could not find zone connection to zone: " << source_zone << dendl;
+ ldpp_dout(rctx.dpp, 0) << "could not find zone connection to zone: " << source_zone << dendl;
return -ENOENT;
}
conn = iter->second;
@@ -4195,7 +4194,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
std::optional<rgw_user> override_owner;
- RGWRadosPutObj cb(dpp, cct, plugin, compressor, &processor, progress_cb, progress_data,
+ RGWRadosPutObj cb(rctx.dpp, cct, plugin, compressor, &processor, progress_cb, progress_data,
[&](map<string, bufferlist>& obj_attrs) {
const rgw_placement_rule *ptail_rule;
@@ -4207,7 +4206,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
&override_owner,
&ptail_rule);
if (ret < 0) {
- ldpp_dout(dpp, 5) << "Aborting fetch: source object filter returned ret=" << ret << dendl;
+ ldpp_dout(rctx.dpp, 5) << "Aborting fetch: source object filter returned ret=" << ret << dendl;
return ret;
}
@@ -4217,12 +4216,12 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
if (compression_type != "none") {
plugin = Compressor::create(cct, compression_type);
if (!plugin) {
- ldpp_dout(dpp, 1) << "Cannot load plugin for compression type "
+ ldpp_dout(rctx.dpp, 1) << "Cannot load plugin for compression type "
<< compression_type << dendl;
}
}
- ret = processor.prepare(y);
+ ret = processor.prepare(rctx.y);
if (ret < 0) {
return ret;
}
@@ -4243,7 +4242,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
if (copy_if_newer) {
/* need to get mtime for destination */
- ret = get_obj_state(dpp, &obj_ctx, dest_bucket_info, stat_dest_obj, &dest_state, &manifest, stat_follow_olh, y);
+ ret = get_obj_state(rctx.dpp, &obj_ctx, dest_bucket_info, stat_dest_obj, &dest_state, &manifest, stat_follow_olh, rctx.y);
if (ret < 0)
goto set_err_state;
@@ -4259,7 +4258,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
static constexpr bool sync_manifest = true;
static constexpr bool skip_decrypt = true;
static constexpr bool sync_cloudtiered = true;
- ret = conn->get_obj(dpp, user_id, info, src_obj, pmod, unmod_ptr,
+ ret = conn->get_obj(rctx.dpp, user_id, info, src_obj, pmod, unmod_ptr,
dest_mtime_weight.zone_short_id, dest_mtime_weight.pg_ver,
prepend_meta, get_op, rgwx_stat,
sync_manifest, skip_decrypt, &dst_zone_trace,
@@ -4270,7 +4269,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
}
ret = conn->complete_request(in_stream_req, &etag, &set_mtime,
- &expected_size, nullptr, nullptr, y);
+ &expected_size, nullptr, nullptr, rctx.y);
if (ret < 0) {
goto set_err_state;
}
@@ -4280,7 +4279,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
}
if (cb.get_data_len() != expected_size) {
ret = -EIO;
- ldpp_dout(dpp, 0) << "ERROR: object truncated during fetching, expected "
+ ldpp_dout(rctx.dpp, 0) << "ERROR: object truncated during fetching, expected "
<< expected_size << " bytes but received " << cb.get_data_len() << dendl;
goto set_err_state;
}
@@ -4301,8 +4300,8 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
auto& obj_attrs = cb.get_attrs();
RGWUserInfo owner_info;
- if (ctl.user->get_info_by_uid(dpp, *override_owner, &owner_info, y) < 0) {
- ldpp_dout(dpp, 10) << "owner info does not exist" << dendl;
+ if (ctl.user->get_info_by_uid(rctx.dpp, *override_owner, &owner_info, rctx.y) < 0) {
+ ldpp_dout(rctx.dpp, 10) << "owner info does not exist" << dendl;
return -EINVAL;
}
@@ -4310,14 +4309,14 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
auto aiter = obj_attrs.find(RGW_ATTR_ACL);
if (aiter == obj_attrs.end()) {
- ldpp_dout(dpp, 0) << "WARNING: " << __func__ << "(): object doesn't have ACL attribute, setting default ACLs" << dendl;
+ ldpp_dout(rctx.dpp, 0) << "WARNING: " << __func__ << "(): object doesn't have ACL attribute, setting default ACLs" << dendl;
acl.create_default(owner_info.user_id, owner_info.display_name);
} else {
auto iter = aiter->second.cbegin();
try {
acl.decode(iter);
} catch (buffer::error& err) {
- ldpp_dout(dpp, 0) << "ERROR: " << __func__ << "(): could not decode policy, caught buffer::error" << dendl;
+ ldpp_dout(rctx.dpp, 0) << "ERROR: " << __func__ << "(): could not decode policy, caught buffer::error" << dendl;
return -EIO;
}
}
@@ -4341,7 +4340,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
try {
decode(delete_at, iter->second);
} catch (buffer::error& err) {
- ldpp_dout(dpp, 0) << "ERROR: failed to decode delete_at field in intra zone copy" << dendl;
+ ldpp_dout(rctx.dpp, 0) << "ERROR: failed to decode delete_at field in intra zone copy" << dendl;
}
}
}
@@ -4395,7 +4394,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
try {
decode(pg_ver, iter);
} catch (buffer::error& err) {
- ldpp_dout(dpp, 0) << "ERROR: failed to decode pg ver attribute, ignoring" << dendl;
+ ldpp_dout(rctx.dpp, 0) << "ERROR: failed to decode pg ver attribute, ignoring" << dendl;
/* non critical error */
}
}
@@ -4413,7 +4412,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
if (verifier_etag != trimmed_etag) {
ret = -EIO;
- ldpp_dout(dpp, 0) << "ERROR: source and destination objects don't match. Expected etag:"
+ ldpp_dout(rctx.dpp, 0) << "ERROR: source and destination objects don't match. Expected etag:"
<< trimmed_etag << " Computed etag:" << verifier_etag << dendl;
goto set_err_state;
}
@@ -4424,34 +4423,34 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
bool canceled = false;
ret = processor.complete(cb.get_data_len(), etag, mtime, set_mtime,
attrs, delete_at, nullptr, nullptr, nullptr,
- zones_trace, &canceled, y);
+ zones_trace, &canceled, rctx);
if (ret < 0) {
goto set_err_state;
}
if (copy_if_newer && canceled) {
- ldpp_dout(dpp, 20) << "raced with another write of obj: " << dest_obj << dendl;
+ ldpp_dout(rctx.dpp, 20) << "raced with another write of obj: " << dest_obj << dendl;
obj_ctx.invalidate(dest_obj); /* object was overwritten */
- ret = get_obj_state(dpp, &obj_ctx, dest_bucket_info, stat_dest_obj, &dest_state, &manifest, stat_follow_olh, y);
+ ret = get_obj_state(rctx.dpp, &obj_ctx, dest_bucket_info, stat_dest_obj, &dest_state, &manifest, stat_follow_olh, rctx.y);
if (ret < 0) {
- ldpp_dout(dpp, 0) << "ERROR: " << __func__ << ": get_err_state() returned ret=" << ret << dendl;
+ ldpp_dout(rctx.dpp, 0) << "ERROR: " << __func__ << ": get_err_state() returned ret=" << ret << dendl;
goto set_err_state;
}
dest_mtime_weight.init(dest_state);
dest_mtime_weight.high_precision = high_precision_time;
if (!dest_state->exists ||
dest_mtime_weight < set_mtime_weight) {
- ldpp_dout(dpp, 20) << "retrying writing object mtime=" << set_mtime << " dest_state->mtime=" << dest_state->mtime << " dest_state->exists=" << dest_state->exists << dendl;
+ ldpp_dout(rctx.dpp, 20) << "retrying writing object mtime=" << set_mtime << " dest_state->mtime=" << dest_state->mtime << " dest_state->exists=" << dest_state->exists << dendl;
continue;
} else {
- ldpp_dout(dpp, 20) << "not retrying writing object mtime=" << set_mtime << " dest_state->mtime=" << dest_state->mtime << " dest_state->exists=" << dest_state->exists << dendl;
+ ldpp_dout(rctx.dpp, 20) << "not retrying writing object mtime=" << set_mtime << " dest_state->mtime=" << dest_state->mtime << " dest_state->exists=" << dest_state->exists << dendl;
}
}
break;
}
if (i == MAX_COMPLETE_RETRY) {
- ldpp_dout(dpp, 0) << "ERROR: retried object completion too many times, something is wrong!" << dendl;
+ ldpp_dout(rctx.dpp, 0) << "ERROR: retried object completion too many times, something is wrong!" << dendl;
ret = -EIO;
goto set_err_state;
}
@@ -4466,8 +4465,8 @@ set_err_state:
// for OP_LINK_OLH to call set_olh() with a real olh_epoch
if (olh_epoch && *olh_epoch > 0) {
constexpr bool log_data_change = true;
- ret = set_olh(dpp, obj_ctx, dest_bucket_info, dest_obj, false, nullptr,
- *olh_epoch, real_time(), false, y, zones_trace, log_data_change);
+ ret = set_olh(rctx.dpp, obj_ctx, dest_bucket_info, dest_obj, false, nullptr,
+ *olh_epoch, real_time(), false, rctx.y, zones_trace, log_data_change);
} else {
// we already have the latest copy
ret = 0;
@@ -4590,13 +4589,14 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
if (remote_src || !source_zone.empty()) {
rgw_zone_set_entry source_trace_entry{source_zone.id, std::nullopt};
+ const req_context rctx{dpp, y, nullptr};
return fetch_remote_obj(obj_ctx, user_id, info, source_zone,
dest_obj, src_obj, dest_bucket_info, &src_bucket_info,
dest_placement, src_mtime, mtime, mod_ptr,
unmod_ptr, high_precision_time,
if_match, if_nomatch, attrs_mod, copy_if_newer, attrs, category,
- olh_epoch, delete_at, ptag, petag, progress_cb, progress_data, dpp,
- nullptr /* filter */, y, stat_follow_olh, stat_dest_obj, source_trace_entry);
+ olh_epoch, delete_at, ptag, petag, progress_cb, progress_data, rctx,
+ nullptr /* filter */, stat_follow_olh, stat_dest_obj, source_trace_entry);
}
map<string, bufferlist> src_attrs;
@@ -4756,6 +4756,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
append_rand_alpha(cct, tag, tag, 32);
}
+ const req_context rctx{dpp, y, nullptr};
std::unique_ptr<rgw::Aio> aio;
rgw::AioResultList all_results;
if (!copy_itself) {
@@ -4828,7 +4829,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx,
write_op.meta.delete_at = delete_at;
write_op.meta.modify_tail = !copy_itself;
- ret = write_op.write_meta(dpp, obj_size, astate->accounted_size, attrs, y);
+ ret = write_op.write_meta(obj_size, astate->accounted_size, attrs, rctx);
if (ret < 0) {
goto done_ret;
}
@@ -4951,8 +4952,9 @@ int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx,
accounted_size = compressed ? cs_info.orig_size : ofs;
}
+ const req_context rctx{dpp, y, nullptr};
return processor.complete(accounted_size, etag, mtime, set_mtime, attrs, delete_at,
- nullptr, nullptr, nullptr, nullptr, nullptr, y);
+ nullptr, nullptr, nullptr, nullptr, nullptr, rctx);
}
int RGWRados::transition_obj(RGWObjectCtx& obj_ctx,
@@ -5503,17 +5505,17 @@ int RGWRados::bucket_set_reshard(const DoutPrefixProvider *dpp, const RGWBucketI
return r;
}
-int RGWRados::defer_gc(const DoutPrefixProvider *dpp, RGWObjectCtx* rctx, RGWBucketInfo& bucket_info, const rgw_obj& obj, optional_yield y)
+int RGWRados::defer_gc(const DoutPrefixProvider *dpp, RGWObjectCtx* octx, RGWBucketInfo& bucket_info, const rgw_obj& obj, optional_yield y)
{
std::string oid, key;
get_obj_bucket_and_oid_loc(obj, oid, key);
- if (!rctx)
+ if (!octx)
return 0;
RGWObjState *state = NULL;
RGWObjManifest *manifest = nullptr;
- int r = get_obj_state(dpp, rctx, bucket_info, obj, &state, &manifest, false, y);
+ int r = get_obj_state(dpp, octx, bucket_info, obj, &state, &manifest, false, y);
if (r < 0)
return r;
@@ -5895,7 +5897,7 @@ int RGWRados::get_olh_target_state(const DoutPrefixProvider *dpp, RGWObjectCtx&
return 0;
}
-int RGWRados::get_obj_state_impl(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx,
+int RGWRados::get_obj_state_impl(const DoutPrefixProvider *dpp, RGWObjectCtx *octx,
RGWBucketInfo& bucket_info, const rgw_obj& obj,
RGWObjState **state, RGWObjManifest** manifest,
bool follow_olh, optional_yield y, bool assume_noent)
@@ -5907,16 +5909,16 @@ int RGWRados::get_obj_state_impl(const DoutPrefixProvider *dpp, RGWObjectCtx *rc
bool need_follow_olh = follow_olh && obj.key.instance.empty();
*manifest = nullptr;
- RGWObjStateManifest *sm = rctx->get_state(obj);
+ RGWObjStateManifest *sm = octx->get_state(obj);
RGWObjState *s = &(sm->state);
- ldpp_dout(dpp, 20) << "get_obj_state: rctx=" << (void *)rctx << " obj=" << obj << " state=" << (void *)s << " s->prefetch_data=" << s->prefetch_data << dendl;
+ ldpp_dout(dpp, 20) << "get_obj_state: octx=" << (void *)octx << " obj=" << obj << " state=" << (void *)s << " s->prefetch_data=" << s->prefetch_data << dendl;
*state = s;
if (sm->manifest) {
*manifest = &(*sm->manifest);
}
if (s->has_attrs) {
if (s->is_olh && need_follow_olh) {
- return get_olh_target_state(dpp, *rctx, bucket_info, obj, s, state, manifest, y);
+ return get_olh_target_state(dpp, *octx, bucket_info, obj, s, state, manifest, y);
}
return 0;
}
@@ -6068,7 +6070,7 @@ int RGWRados::get_obj_state_impl(const DoutPrefixProvider *dpp, RGWObjectCtx *rc
ldpp_dout(dpp, 20) << __func__ << ": setting s->olh_tag to " << string(s->olh_tag.c_str(), s->olh_tag.length()) << dendl;
if (need_follow_olh) {
- return get_olh_target_state(dpp, *rctx, bucket_info, obj, s, state, manifest, y);
+ return get_olh_target_state(dpp, *octx, bucket_info, obj, s, state, manifest, y);
} else if (obj.key.have_null_instance() && !sm->manifest) {
// read null version, and the head object only have olh info
s->exists = false;
@@ -6079,13 +6081,13 @@ int RGWRados::get_obj_state_impl(const DoutPrefixProvider *dpp, RGWObjectCtx *rc
return 0;
}
-int RGWRados::get_obj_state(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state, RGWObjManifest** manifest,
+int RGWRados::get_obj_state(const DoutPrefixProvider *dpp, RGWObjectCtx *octx, RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state, RGWObjManifest** manifest,
bool follow_olh, optional_yield y, bool assume_noent)
{
int ret;
do {
- ret = get_obj_state_impl(dpp, rctx, bucket_info, obj, state, manifest, follow_olh, y, assume_noent);
+ ret = get_obj_state_impl(dpp, octx, bucket_info, obj, state, manifest, follow_olh, y, assume_noent);
} while (ret == -EAGAIN);
return ret;
@@ -6195,15 +6197,15 @@ int RGWRados::Object::Stat::finish(const DoutPrefixProvider *dpp)
return 0;
}
-int RGWRados::append_atomic_test(const DoutPrefixProvider *dpp, RGWObjectCtx* rctx,
+int RGWRados::append_atomic_test(const DoutPrefixProvider *dpp, RGWObjectCtx* octx,
RGWBucketInfo& bucket_info, const rgw_obj& obj,
ObjectOperation& op, RGWObjState **pstate,
RGWObjManifest** pmanifest, optional_yield y)
{
- if (!rctx)
+ if (!octx)
return 0;
- int r = get_obj_state(dpp, rctx, bucket_info, obj, pstate, pmanifest, false, y);
+ int r = get_obj_state(dpp, octx, bucket_info, obj, pstate, pmanifest, false, y);
if (r < 0)
return r;
@@ -6339,14 +6341,14 @@ int RGWRados::Object::prepare_atomic_modification(const DoutPrefixProvider *dpp,
* bl: the contents of the attr
* Returns: 0 on success, -ERR# otherwise.
*/
-int RGWRados::set_attr(const DoutPrefixProvider *dpp, RGWObjectCtx* rctx, RGWBucketInfo& bucket_info, const rgw_obj& obj, const char *name, bufferlist& bl, optional_yield y)
+int RGWRados::set_attr(const DoutPrefixProvider *dpp, RGWObjectCtx* octx, RGWBucketInfo& bucket_info, const rgw_obj& obj, const char *name, bufferlist& bl, optional_yield y)
{
map<string, bufferlist> attrs;
attrs[name] = bl;
- return set_attrs(dpp, rctx, bucket_info, obj, attrs, NULL, y);
+ return set_attrs(dpp, octx, bucket_info, obj, attrs, NULL, y);
}
-int RGWRados::set_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx* rctx, RGWBucketInfo& bucket_info, const rgw_obj& src_obj,
+int RGWRados::set_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx* octx, RGWBucketInfo& bucket_info, const rgw_obj& src_obj,
map<string, bufferlist>& attrs,
map<string, bufferlist>* rmattrs,
optional_yield y,
@@ -6367,7 +6369,7 @@ int RGWRados::set_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx* rctx, RGWBu
RGWObjState *state = NULL;
RGWObjManifest *manifest = nullptr;
- r = append_atomic_test(dpp, rctx, bucket_info, obj, op, &state, &manifest, y);
+ r = append_atomic_test(dpp, octx, bucket_info, obj, op, &state, &manifest, y);
if (r < 0)
return r;
@@ -9885,8 +9887,8 @@ int RGWRados::check_disk_state(const DoutPrefixProvider *dpp,
RGWObjState *astate = NULL;
RGWObjManifest *manifest = nullptr;
- RGWObjectCtx rctx(this->driver);
- int r = get_obj_state(dpp, &rctx, bucket_info, obj, &astate, &manifest, false, y);
+ RGWObjectCtx octx(this->driver);
+ int r = get_obj_state(dpp, &octx, bucket_info, obj, &astate, &manifest, false, y);
if (r < 0)
return r;
diff --git a/src/rgw/driver/rados/rgw_rados.h b/src/rgw/driver/rados/rgw_rados.h
index 5ca604c971f..2dca3cfaad4 100644
--- a/src/rgw/driver/rados/rgw_rados.h
+++ b/src/rgw/driver/rados/rgw_rados.h
@@ -816,13 +816,12 @@ public:
explicit Write(RGWRados::Object *_target) : target(_target) {}
- int _do_write_meta(const DoutPrefixProvider *dpp,
- uint64_t size, uint64_t accounted_size,
+ int _do_write_meta(uint64_t size, uint64_t accounted_size,
std::map<std::string, bufferlist>& attrs,
bool modify_tail, bool assume_noent,
- void *index_op, optional_yield y);
- int write_meta(const DoutPrefixProvider *dpp, uint64_t size, uint64_t accounted_size,
- std::map<std::string, bufferlist>& attrs, optional_yield y);
+ void *index_op, const req_context& rctx);
+ int write_meta(uint64_t size, uint64_t accounted_size,
+ std::map<std::string, bufferlist>& attrs, const req_context& rctx);
int write_data(const char *data, uint64_t ofs, uint64_t len, bool exclusive);
const req_state* get_req_state() {
return nullptr; /* XXX dang Only used by LTTng, and it handles null anyway */
@@ -1144,8 +1143,8 @@ public:
std::string *petag,
void (*progress_cb)(off_t, void *),
void *progress_data,
- const DoutPrefixProvider *dpp,
- RGWFetchObjFilter *filter, optional_yield y,
+ const req_context& rctx,
+ RGWFetchObjFilter *filter,
bool stat_follow_olh,
const rgw_obj& stat_dest_obj,
const rgw_zone_set_entry& source_trace_entry,
diff --git a/src/rgw/driver/rados/rgw_sal_rados.cc b/src/rgw/driver/rados/rgw_sal_rados.cc
index 0c24a36a0a5..fb684a921e6 100644
--- a/src/rgw/driver/rados/rgw_sal_rados.cc
+++ b/src/rgw/driver/rados/rgw_sal_rados.cc
@@ -2091,7 +2091,8 @@ int RadosObject::write_cloud_tier(const DoutPrefixProvider* dpp,
attrs.erase(RGW_ATTR_ID_TAG);
attrs.erase(RGW_ATTR_TAIL_TAG);
- return obj_op.write_meta(dpp, 0, 0, attrs, y);
+ const req_context rctx{dpp, y, nullptr};
+ return obj_op.write_meta(0, 0, attrs, rctx);
}
int RadosObject::get_max_chunk_size(const DoutPrefixProvider* dpp, rgw_placement_rule placement_rule, uint64_t* max_chunk_size, uint64_t* alignment)
@@ -2178,12 +2179,12 @@ std::unique_ptr<Object::ReadOp> RadosObject::get_read_op()
return std::make_unique<RadosObject::RadosReadOp>(this, rados_ctx);
}
-RadosObject::RadosReadOp::RadosReadOp(RadosObject *_source, RGWObjectCtx *_rctx) :
+RadosObject::RadosReadOp::RadosReadOp(RadosObject *_source, RGWObjectCtx *_octx) :
source(_source),
- rctx(_rctx),
+ octx(_octx),
op_target(_source->store->getRados(),
_source->get_bucket()->get_info(),
- *static_cast<RGWObjectCtx *>(rctx),
+ *static_cast<RGWObjectCtx *>(octx),
_source->get_obj()),
parent_op(&op_target)
{ }
@@ -2502,6 +2503,7 @@ int RadosMultipartUpload::init(const DoutPrefixProvider *dpp, optional_yield y,
int ret;
std::string oid = mp_obj.get_key();
RGWObjectCtx obj_ctx(store);
+ const req_context rctx{dpp, y, nullptr};
do {
char buf[33];
@@ -2537,7 +2539,7 @@ int RadosMultipartUpload::init(const DoutPrefixProvider *dpp, optional_yield y,
encode(upload_info, bl);
obj_op.meta.data = &bl;
- ret = obj_op.write_meta(dpp, bl.length(), 0, attrs, y);
+ ret = obj_op.write_meta(bl.length(), 0, attrs, rctx);
} while (ret == -EEXIST);
return ret;
@@ -2820,7 +2822,8 @@ int RadosMultipartUpload::complete(const DoutPrefixProvider *dpp,
obj_op.meta.completeMultipart = true;
obj_op.meta.olh_epoch = olh_epoch;
- ret = obj_op.write_meta(dpp, ofs, accounted_size, attrs, y);
+ const req_context rctx{dpp, y, nullptr};
+ ret = obj_op.write_meta(ofs, accounted_size, attrs, rctx);
if (ret < 0)
return ret;
@@ -3099,10 +3102,10 @@ int RadosAtomicWriter::complete(size_t accounted_size, const std::string& etag,
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y)
+ const req_context& rctx)
{
return processor.complete(accounted_size, etag, mtime, set_mtime, attrs, delete_at,
- if_match, if_nomatch, user_data, zones_trace, canceled, y);
+ if_match, if_nomatch, user_data, zones_trace, canceled, rctx);
}
int RadosAppendWriter::prepare(optional_yield y)
@@ -3122,10 +3125,10 @@ int RadosAppendWriter::complete(size_t accounted_size, const std::string& etag,
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y)
+ const req_context& rctx)
{
return processor.complete(accounted_size, etag, mtime, set_mtime, attrs, delete_at,
- if_match, if_nomatch, user_data, zones_trace, canceled, y);
+ if_match, if_nomatch, user_data, zones_trace, canceled, rctx);
}
int RadosMultipartWriter::prepare(optional_yield y)
@@ -3145,10 +3148,10 @@ int RadosMultipartWriter::complete(size_t accounted_size, const std::string& eta
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y)
+ const req_context& rctx)
{
return processor.complete(accounted_size, etag, mtime, set_mtime, attrs, delete_at,
- if_match, if_nomatch, user_data, zones_trace, canceled, y);
+ if_match, if_nomatch, user_data, zones_trace, canceled, rctx);
}
const std::string& RadosZoneGroup::get_endpoint() const
diff --git a/src/rgw/driver/rados/rgw_sal_rados.h b/src/rgw/driver/rados/rgw_sal_rados.h
index 228ba532869..e86a0870782 100644
--- a/src/rgw/driver/rados/rgw_sal_rados.h
+++ b/src/rgw/driver/rados/rgw_sal_rados.h
@@ -324,7 +324,7 @@ class RadosObject : public StoreObject {
struct RadosReadOp : public ReadOp {
private:
RadosObject* source;
- RGWObjectCtx* rctx;
+ RGWObjectCtx* octx;
RGWRados::Object op_target;
RGWRados::Object::Read parent_op;
@@ -793,7 +793,7 @@ public:
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) override;
+ const req_context& rctx) override;
};
class RadosAppendWriter : public StoreWriter {
@@ -840,7 +840,7 @@ public:
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) override;
+ const req_context& rctx) override;
};
class RadosMultipartWriter : public StoreWriter {
@@ -885,7 +885,7 @@ public:
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) override;
+ const req_context& rctx) override;
};
class RadosLuaManager : public StoreLuaManager {
diff --git a/src/rgw/driver/rados/rgw_tools.cc b/src/rgw/driver/rados/rgw_tools.cc
index 66651da5cc8..cdc4be83a05 100644
--- a/src/rgw/driver/rados/rgw_tools.cc
+++ b/src/rgw/driver/rados/rgw_tools.cc
@@ -417,12 +417,13 @@ int RGWDataAccess::Object::put(bufferlist& data,
puser_data = &(*user_data);
}
+ const req_context rctx{dpp, y, nullptr};
return processor->complete(obj_size, etag,
&mtime, mtime,
attrs, delete_at,
nullptr, nullptr,
puser_data,
- nullptr, nullptr, y);
+ nullptr, nullptr, rctx);
}
void RGWDataAccess::Object::set_policy(const RGWAccessControlPolicy& policy)
diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc
index 6a55d3f1d8f..227c212ac6b 100644
--- a/src/rgw/rgw_file.cc
+++ b/src/rgw/rgw_file.cc
@@ -1937,6 +1937,7 @@ namespace rgw {
char calc_md5[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 1];
unsigned char m[CEPH_CRYPTO_MD5_DIGESTSIZE];
req_state* state = get_state();
+ const req_context rctx{this, state->yield, nullptr};
size_t osize = rgw_fh->get_size();
struct timespec octime = rgw_fh->get_ctime();
@@ -2018,7 +2019,7 @@ namespace rgw {
op_ret = processor->complete(state->obj_size, etag, &mtime, real_time(), attrs,
(delete_at ? *delete_at : real_time()),
if_match, if_nomatch, nullptr, nullptr, nullptr,
- state->yield);
+ rctx);
if (op_ret != 0) {
/* revert attr updates */
rgw_fh->set_mtime(omtime);
diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc
index ab2dda48ec7..4887c9d146a 100644
--- a/src/rgw/rgw_lc.cc
+++ b/src/rgw/rgw_lc.cc
@@ -480,7 +480,7 @@ struct lc_op_ctx {
LCObjsLister& ol;
std::unique_ptr<rgw::sal::Object> obj;
- RGWObjectCtx rctx;
+ RGWObjectCtx octx;
const DoutPrefixProvider *dpp;
WorkQ* wq;
@@ -493,7 +493,7 @@ struct lc_op_ctx {
: cct(env.driver->ctx()), env(env), o(o), next_key_name(next_key_name),
effective_mtime(effective_mtime),
driver(env.driver), bucket(env.bucket), op(env.op), ol(env.ol),
- rctx(env.driver), dpp(dpp), wq(wq)
+ octx(env.driver), dpp(dpp), wq(wq)
{
obj = bucket->get_object(o.key);
}
diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc
index 8c15e5bd2e3..88c1a5abd1a 100644
--- a/src/rgw/rgw_op.cc
+++ b/src/rgw/rgw_op.cc
@@ -4390,10 +4390,11 @@ void RGWPutObj::execute(optional_yield y)
}
tracepoint(rgw_op, processor_complete_enter, s->req_id.c_str());
+ const req_context rctx{this, s->yield, s->trace.get()};
op_ret = processor->complete(s->obj_size, etag, &mtime, real_time(), attrs,
(delete_at ? *delete_at : real_time()), if_match, if_nomatch,
(user_data.empty() ? nullptr : &user_data), nullptr, nullptr,
- s->yield);
+ rctx);
tracepoint(rgw_op, processor_complete_exit, s->req_id.c_str());
// send request to notification manager
@@ -4658,10 +4659,11 @@ void RGWPostObj::execute(optional_yield y)
emplace_attr(RGW_ATTR_COMPRESSION, std::move(tmp));
}
+ const req_context rctx{this, s->yield, s->trace.get()};
op_ret = processor->complete(s->obj_size, etag, nullptr, real_time(), attrs,
(delete_at ? *delete_at : real_time()),
nullptr, nullptr, nullptr, nullptr, nullptr,
- s->yield);
+ rctx);
if (op_ret < 0) {
return;
}
@@ -7772,10 +7774,11 @@ int RGWBulkUploadOp::handle_file(const std::string_view path,
}
/* Complete the transaction. */
+ const req_context rctx{this, s->yield, s->trace.get()};
op_ret = processor->complete(size, etag, nullptr, ceph::real_time(),
attrs, ceph::real_time() /* delete_at */,
nullptr, nullptr, nullptr, nullptr, nullptr,
- s->yield);
+ rctx);
if (op_ret < 0) {
ldpp_dout(this, 20) << "processor::complete returned op_ret=" << op_ret << dendl;
}
diff --git a/src/rgw/rgw_req_context.h b/src/rgw/rgw_req_context.h
new file mode 100644
index 00000000000..b0030ca1a94
--- /dev/null
+++ b/src/rgw/rgw_req_context.h
@@ -0,0 +1,18 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab ft=cpp
+
+#include "common/async/yield_context.h"
+namespace opentelemetry::trace {
+ class Span;
+}
+
+class DoutPrefixProvider;
+
+// this struct holds information which is created at the frontend
+// and should trickle down through all function calls to the backend
+struct req_context {
+ const DoutPrefixProvider* dpp{nullptr};
+ optional_yield y;
+ const opentelemetry::trace::Span* span{nullptr};
+};
+
diff --git a/src/rgw/rgw_sal.h b/src/rgw/rgw_sal.h
index 84731f333d7..7cfd4923761 100644
--- a/src/rgw/rgw_sal.h
+++ b/src/rgw/rgw_sal.h
@@ -20,6 +20,7 @@
#include "rgw_user.h"
#include "rgw_notify_event_type.h"
#include "common/tracer.h"
+#include "rgw_req_context.h"
#include "rgw_datalog_notify.h"
#include "include/random.h"
@@ -244,7 +245,7 @@ class ObjectProcessor : public DataProcessor {
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) = 0;
+ const req_context& rctx) = 0;
};
/** A list of key-value attributes */
@@ -1387,7 +1388,7 @@ public:
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) = 0;
+ const req_context& rctx) = 0;
};
diff --git a/src/rgw/rgw_sal_dbstore.cc b/src/rgw/rgw_sal_dbstore.cc
index aa1243fe598..36d76cc12e1 100644
--- a/src/rgw/rgw_sal_dbstore.cc
+++ b/src/rgw/rgw_sal_dbstore.cc
@@ -738,9 +738,9 @@ namespace rgw::sal {
return std::make_unique<DBObject::DBReadOp>(this, nullptr);
}
- DBObject::DBReadOp::DBReadOp(DBObject *_source, RGWObjectCtx *_rctx) :
+ DBObject::DBReadOp::DBReadOp(DBObject *_source, RGWObjectCtx *_octx) :
source(_source),
- rctx(_rctx),
+ octx(_octx),
op_target(_source->store->getDB(),
_source->get_bucket()->get_info(),
_source->get_obj()),
@@ -1323,7 +1323,7 @@ namespace rgw::sal {
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y)
+ const req_context& rctx)
{
/* XXX: same as AtomicWriter..consolidate code */
parent_op.meta.mtime = mtime;
@@ -1477,7 +1477,7 @@ namespace rgw::sal {
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y)
+ const req_context& rctx)
{
parent_op.meta.mtime = mtime;
parent_op.meta.delete_at = delete_at;
diff --git a/src/rgw/rgw_sal_dbstore.h b/src/rgw/rgw_sal_dbstore.h
index 65ffd909109..0c75f4b98cb 100644
--- a/src/rgw/rgw_sal_dbstore.h
+++ b/src/rgw/rgw_sal_dbstore.h
@@ -524,12 +524,12 @@ protected:
struct DBReadOp : public ReadOp {
private:
DBObject* source;
- RGWObjectCtx* rctx;
+ RGWObjectCtx* octx;
DB::Object op_target;
DB::Object::Read parent_op;
public:
- DBReadOp(DBObject *_source, RGWObjectCtx *_rctx);
+ DBReadOp(DBObject *_source, RGWObjectCtx *_octx);
virtual int prepare(optional_yield y, const DoutPrefixProvider* dpp) override;
@@ -688,7 +688,7 @@ protected:
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) override;
+ const req_context& rctx) override;
};
class DBMultipartWriter : public StoreWriter {
@@ -736,7 +736,7 @@ public:
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) override;
+ const req_context& rctx) override;
};
class DBStore : public StoreDriver {
diff --git a/src/rgw/rgw_sal_filter.cc b/src/rgw/rgw_sal_filter.cc
index 13e9155c524..dbf688a22ab 100644
--- a/src/rgw/rgw_sal_filter.cc
+++ b/src/rgw/rgw_sal_filter.cc
@@ -1276,11 +1276,11 @@ int FilterWriter::complete(size_t accounted_size, const std::string& etag,
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y)
+ const req_context& rctx)
{
return next->complete(accounted_size, etag, mtime, set_mtime, attrs,
delete_at, if_match, if_nomatch, user_data, zones_trace,
- canceled, y);
+ canceled, rctx);
}
int FilterLuaManager::get_script(const DoutPrefixProvider* dpp, optional_yield y,
diff --git a/src/rgw/rgw_sal_filter.h b/src/rgw/rgw_sal_filter.h
index 6db44a19100..dcc03df9519 100644
--- a/src/rgw/rgw_sal_filter.h
+++ b/src/rgw/rgw_sal_filter.h
@@ -879,7 +879,7 @@ public:
const char *if_match, const char *if_nomatch,
const std::string *user_data,
rgw_zone_set *zones_trace, bool *canceled,
- optional_yield y) override;
+ const req_context& rctx) override;
};
class FilterLuaManager : public LuaManager {
diff --git a/src/test/rgw/test_d4n_filter.cc b/src/test/rgw/test_d4n_filter.cc
index 30a508cf709..7ceb7092c64 100644
--- a/src/test/rgw/test_d4n_filter.cc
+++ b/src/test/rgw/test_d4n_filter.cc
@@ -25,6 +25,7 @@ string redisHost = "";
vector<const char*> args;
class Environment* env;
const DoutPrefixProvider* dpp;
+const req_context rctx{dpp, null_yield, nullptr};
class StoreObject : public rgw::sal::StoreObject {
friend class D4NFilterFixture;
@@ -194,7 +195,7 @@ class D4NFilterFixture : public ::testing::Test {
&if_match, &if_nomatch,
&user_data,
&zones_trace, &canceled,
- null_yield);
+ rctx);
return ret;
}
@@ -454,7 +455,7 @@ TEST_F(D4NFilterFixture, CopyObjectReplace) {
&if_match, &if_nomatch,
&user_data,
&zones_trace, &canceled,
- null_yield), 0);
+ rctx), 0);
unique_ptr<rgw::sal::Object> testObject_copy = testBucket->get_object(rgw_obj_key("test_object_copy"));
@@ -579,7 +580,7 @@ TEST_F(D4NFilterFixture, CopyObjectMerge) {
&if_match, &if_nomatch,
&user_data,
&zones_trace, &canceled,
- null_yield), 0);
+ rctx), 0);
unique_ptr<rgw::sal::Object> testObject_copy = testBucket->get_object(rgw_obj_key("test_object_copy"));
@@ -1913,7 +1914,7 @@ TEST_F(D4NFilterFixture, DataCheck) {
&if_match, &if_nomatch,
&user_data,
&zones_trace, &canceled,
- null_yield), 0);
+ rctx), 0);
client.hget("rgw-object:test_object_DataCheck:cache", "data", [&data](cpp_redis::reply& reply) {
if (reply.is_string()) {
@@ -1938,7 +1939,7 @@ TEST_F(D4NFilterFixture, DataCheck) {
&if_match, &if_nomatch,
&user_data,
&zones_trace, &canceled,
- null_yield), 0);
+ rctx), 0);
client.hget("rgw-object:test_object_DataCheck:cache", "data", [&dataNew](cpp_redis::reply& reply) {
if (reply.is_string()) {