From df236920b8f0b20327cc997a6190d88f3e919029 Mon Sep 17 00:00:00 2001 From: Ali Maredia Date: Fri, 11 Dec 2020 16:19:39 -0500 Subject: [PATCH] rgw: Add DoutPrefixProvider to create_bucket logging This commit hits all log messages for a create bucket request and ensures each has a DoutPrefixProvider. This commit gets dpp's all the way down to rgw/services up way though to rgw_op.cc, rgw_rest.cc files, rgw_admin.cc, etc. This commit also removes store as dpp in rgw_sal.h Signed-off-by: Ali Maredia --- src/rgw/librgw.cc | 24 +- src/rgw/rgw_acl_s3.cc | 22 +- src/rgw/rgw_acl_s3.h | 4 +- src/rgw/rgw_acl_swift.cc | 33 +- src/rgw/rgw_acl_swift.h | 11 +- src/rgw/rgw_admin.cc | 200 ++++----- src/rgw/rgw_auth.cc | 29 +- src/rgw/rgw_auth.h | 3 +- src/rgw/rgw_auth_filters.h | 6 +- src/rgw/rgw_auth_s3.cc | 58 +-- src/rgw/rgw_auth_s3.h | 12 +- src/rgw/rgw_bucket.cc | 469 +++++++++++---------- src/rgw/rgw_bucket.h | 111 +++-- src/rgw/rgw_common.cc | 10 +- src/rgw/rgw_common.h | 8 +- src/rgw/rgw_cr_rados.cc | 8 +- src/rgw/rgw_cr_rados.h | 43 +- src/rgw/rgw_cr_tools.cc | 19 +- src/rgw/rgw_data_sync.cc | 21 +- src/rgw/rgw_datalog.cc | 9 +- src/rgw/rgw_datalog.h | 6 +- src/rgw/rgw_file.cc | 10 +- src/rgw/rgw_file.h | 14 +- src/rgw/rgw_frontend.h | 19 +- src/rgw/rgw_lc.cc | 98 ++--- src/rgw/rgw_lib.h | 2 +- src/rgw/rgw_main.cc | 3 +- src/rgw/rgw_metadata.cc | 59 +-- src/rgw/rgw_metadata.h | 47 ++- src/rgw/rgw_multi.cc | 21 +- src/rgw/rgw_multi.h | 7 +- src/rgw/rgw_notify.cc | 115 +++--- src/rgw/rgw_notify.h | 5 +- src/rgw/rgw_object_expirer.cc | 3 +- src/rgw/rgw_object_expirer_core.cc | 35 +- src/rgw/rgw_object_expirer_core.h | 17 +- src/rgw/rgw_oidc_provider.cc | 16 +- src/rgw/rgw_oidc_provider.h | 8 +- src/rgw/rgw_op.cc | 408 +++++++++--------- src/rgw/rgw_op.h | 19 +- src/rgw/rgw_orphan.cc | 43 +- src/rgw/rgw_orphan.h | 16 +- src/rgw/rgw_os_lib.cc | 2 +- src/rgw/rgw_otp.cc | 11 +- src/rgw/rgw_otp.h | 1 + src/rgw/rgw_process.cc | 4 +- src/rgw/rgw_pubsub.cc | 8 +- src/rgw/rgw_pubsub.h | 8 +- src/rgw/rgw_putobj_processor.cc | 20 +- src/rgw/rgw_quota.cc | 53 +-- src/rgw/rgw_rados.cc | 501 ++++++++++++----------- src/rgw/rgw_rados.h | 187 +++++---- src/rgw/rgw_realm_reloader.cc | 4 +- src/rgw/rgw_reshard.cc | 82 ++-- src/rgw/rgw_reshard.h | 20 +- src/rgw/rgw_rest.cc | 52 +-- src/rgw/rgw_rest_bucket.cc | 22 +- src/rgw/rgw_rest_iam.cc | 2 +- src/rgw/rgw_rest_log.cc | 13 +- src/rgw/rgw_rest_metadata.cc | 6 +- src/rgw/rgw_rest_oidc_provider.cc | 6 +- src/rgw/rgw_rest_pubsub_common.cc | 4 +- src/rgw/rgw_rest_realm.cc | 2 +- src/rgw/rgw_rest_role.cc | 10 +- src/rgw/rgw_rest_s3.cc | 40 +- src/rgw/rgw_rest_sts.cc | 12 +- src/rgw/rgw_rest_sts.h | 2 +- src/rgw/rgw_rest_swift.cc | 30 +- src/rgw/rgw_rest_user.cc | 28 +- src/rgw/rgw_rest_user_policy.cc | 14 +- src/rgw/rgw_role.cc | 37 +- src/rgw/rgw_role.h | 17 +- src/rgw/rgw_sal.h | 73 ++-- src/rgw/rgw_sal_rados.cc | 177 ++++---- src/rgw/rgw_sal_rados.h | 89 ++-- src/rgw/rgw_service.cc | 58 +-- src/rgw/rgw_service.h | 20 +- src/rgw/rgw_sts.cc | 16 +- src/rgw/rgw_sts.h | 6 +- src/rgw/rgw_swift_auth.cc | 14 +- src/rgw/rgw_sync.cc | 19 +- src/rgw/rgw_sync_checkpoint.cc | 2 +- src/rgw/rgw_sync_module_pubsub.cc | 19 +- src/rgw/rgw_tools.cc | 7 +- src/rgw/rgw_tools.h | 9 +- src/rgw/rgw_trim_bilog.cc | 55 ++- src/rgw/rgw_trim_bilog.h | 7 +- src/rgw/rgw_user.cc | 375 +++++++++-------- src/rgw/rgw_user.h | 142 ++++--- src/rgw/rgw_zone.cc | 45 +- src/rgw/rgw_zone.h | 15 +- src/rgw/services/svc_bi.h | 3 +- src/rgw/services/svc_bi_rados.cc | 5 +- src/rgw/services/svc_bi_rados.h | 2 +- src/rgw/services/svc_bucket.h | 23 +- src/rgw/services/svc_bucket_sobj.cc | 79 ++-- src/rgw/services/svc_bucket_sobj.h | 31 +- src/rgw/services/svc_bucket_sync.h | 3 +- src/rgw/services/svc_bucket_sync_sobj.cc | 30 +- src/rgw/services/svc_bucket_sync_sobj.h | 13 +- src/rgw/services/svc_cls.cc | 6 +- src/rgw/services/svc_cls.h | 2 +- src/rgw/services/svc_config_key_rados.cc | 2 +- src/rgw/services/svc_config_key_rados.h | 2 +- src/rgw/services/svc_finisher.cc | 2 +- src/rgw/services/svc_finisher.h | 2 +- src/rgw/services/svc_mdlog.cc | 27 +- src/rgw/services/svc_mdlog.h | 8 +- src/rgw/services/svc_meta_be.cc | 33 +- src/rgw/services/svc_meta_be.h | 38 +- src/rgw/services/svc_meta_be_otp.cc | 3 +- src/rgw/services/svc_meta_be_otp.h | 3 +- src/rgw/services/svc_meta_be_sobj.cc | 5 +- src/rgw/services/svc_meta_be_sobj.h | 3 +- src/rgw/services/svc_notify.cc | 8 +- src/rgw/services/svc_notify.h | 2 +- src/rgw/services/svc_otp.cc | 12 +- src/rgw/services/svc_otp.h | 8 +- src/rgw/services/svc_rados.cc | 2 +- src/rgw/services/svc_rados.h | 2 +- src/rgw/services/svc_sync_modules.cc | 2 +- src/rgw/services/svc_sync_modules.h | 2 +- src/rgw/services/svc_sys_obj.cc | 4 +- src/rgw/services/svc_sys_obj.h | 2 +- src/rgw/services/svc_sys_obj_cache.cc | 6 +- src/rgw/services/svc_sys_obj_cache.h | 2 +- src/rgw/services/svc_sys_obj_core.cc | 27 +- src/rgw/services/svc_sys_obj_core.h | 9 +- src/rgw/services/svc_user.h | 18 +- src/rgw/services/svc_user_rados.cc | 64 +-- src/rgw/services/svc_user_rados.h | 25 +- src/rgw/services/svc_zone.cc | 30 +- src/rgw/services/svc_zone.h | 8 +- src/rgw/services/svc_zone_utils.cc | 2 +- src/rgw/services/svc_zone_utils.h | 2 +- src/test/rgw/test_rgw_lua.cc | 4 +- src/test/rgw/test_rgw_throttle.cc | 3 +- 137 files changed, 2743 insertions(+), 2243 deletions(-) diff --git a/src/rgw/librgw.cc b/src/rgw/librgw.cc index d9fb3f67a3f59..482fb65bcd98a 100644 --- a/src/rgw/librgw.cc +++ b/src/rgw/librgw.cc @@ -123,7 +123,8 @@ namespace rgw { RGWLibFS* fs = iter->first->ref(); uniq.unlock(); fs->gc(); - fs->update_user(); + const DoutPrefix dp(cct, dout_subsys, "librgw: "); + fs->update_user(&dp); fs->rele(); uniq.lock(); if (cur_gen != gen) @@ -460,14 +461,14 @@ namespace rgw { { RGWOp *op = (req->op) ? req->op : dynamic_cast(req); if (! op) { - dout(1) << "failed to derive cognate RGWOp (invalid op?)" << dendl; + ldpp_dout(op, 1) << "failed to derive cognate RGWOp (invalid op?)" << dendl; return -EINVAL; } - int ret = req->exec_finish(); + int ret = req->exec_finish(op); int op_ret = op->get_ret(); - dout(1) << "====== " << __func__ + ldpp_dout(op, 1) << "====== " << __func__ << " finishing continued request req=" << hex << req << dec << " op status=" << op_ret << " ======" << dendl; @@ -537,7 +538,8 @@ namespace rgw { g_conf()->rgw_run_sync_thread && g_conf()->rgw_nfs_run_sync_thread; - store = RGWStoreManager::get_storage(g_ceph_context, + const DoutPrefix dp(cct.get(), dout_subsys, "librgw: "); + store = RGWStoreManager::get_storage(&dp, g_ceph_context, run_gc, run_lc, run_quota, @@ -656,7 +658,8 @@ namespace rgw { int RGWLibIO::set_uid(rgw::sal::RGWRadosStore *store, const rgw_user& uid) { - int ret = store->ctl()->user->get_info_by_uid(uid, &user_info, null_yield); + const DoutPrefix dp(store->ctx(), dout_subsys, "librgw: "); + int ret = store->ctl()->user->get_info_by_uid(&dp, uid, &user_info, null_yield); if (ret < 0) { derr << "ERROR: failed reading user info: uid=" << uid << " ret=" << ret << dendl; @@ -666,10 +669,11 @@ namespace rgw { int RGWLibRequest::read_permissions(RGWOp* op, optional_yield y) { /* bucket and object ops */ + const DoutPrefix dp(store->ctx(), dout_subsys, "librgw: "); int ret = - rgw_build_bucket_policies(rgwlib.get_store(), get_state(), y); + rgw_build_bucket_policies(&dp, rgwlib.get_store(), get_state(), y); if (ret < 0) { - ldout(get_state()->cct, 10) << "read_permissions (bucket policy) on " + ldpp_dout(&dp, 10) << "read_permissions (bucket policy) on " << get_state()->bucket << ":" << get_state()->object << " only_bucket=" << only_bucket() @@ -678,10 +682,10 @@ namespace rgw { ret = -EACCES; } else if (! only_bucket()) { /* object ops */ - ret = rgw_build_object_policies(rgwlib.get_store(), get_state(), + ret = rgw_build_object_policies(&dp, rgwlib.get_store(), get_state(), op->prefetch_data(), y); if (ret < 0) { - ldout(get_state()->cct, 10) << "read_permissions (object policy) on" + ldpp_dout(&dp, 10) << "read_permissions (object policy) on" << get_state()->bucket << ":" << get_state()->object << " ret=" << ret << dendl; diff --git a/src/rgw/rgw_acl_s3.cc b/src/rgw/rgw_acl_s3.cc index fb1383c4f4e9a..2fb275364bec0 100644 --- a/src/rgw/rgw_acl_s3.cc +++ b/src/rgw/rgw_acl_s3.cc @@ -290,7 +290,7 @@ static const char *get_acl_header(const RGWEnv *env, return env->get(header, NULL); } -static int parse_grantee_str(RGWUserCtl *user_ctl, string& grantee_str, +static int parse_grantee_str(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl, string& grantee_str, const struct s3_acl_header *perm, ACLGrant& grant) { string id_type, id_val_quoted; @@ -306,14 +306,14 @@ static int parse_grantee_str(RGWUserCtl *user_ctl, string& grantee_str, string id_val = rgw_trim_quotes(id_val_quoted); if (strcasecmp(id_type.c_str(), "emailAddress") == 0) { - ret = user_ctl->get_info_by_email(id_val, &info, null_yield); + ret = user_ctl->get_info_by_email(dpp, id_val, &info, null_yield); if (ret < 0) return ret; grant.set_canon(info.user_id, info.display_name, rgw_perm); } else if (strcasecmp(id_type.c_str(), "id") == 0) { rgw_user user(id_val); - ret = user_ctl->get_info_by_uid(user, &info, null_yield); + ret = user_ctl->get_info_by_uid(dpp, user, &info, null_yield); if (ret < 0) return ret; @@ -331,7 +331,7 @@ static int parse_grantee_str(RGWUserCtl *user_ctl, string& grantee_str, return 0; } -static int parse_acl_header(RGWUserCtl *user_ctl, const RGWEnv *env, +static int parse_acl_header(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl, const RGWEnv *env, const struct s3_acl_header *perm, std::list& _grants) { std::list grantees; @@ -346,7 +346,7 @@ static int parse_acl_header(RGWUserCtl *user_ctl, const RGWEnv *env, for (list::iterator it = grantees.begin(); it != grantees.end(); ++it) { ACLGrant grant; - int ret = parse_grantee_str(user_ctl, *it, perm, grant); + int ret = parse_grantee_str(dpp, user_ctl, *it, perm, grant); if (ret < 0) return ret; @@ -451,13 +451,13 @@ static const s3_acl_header acl_header_perms[] = { {0, NULL} }; -int RGWAccessControlPolicy_S3::create_from_headers(RGWUserCtl *user_ctl, const RGWEnv *env, ACLOwner& _owner) +int RGWAccessControlPolicy_S3::create_from_headers(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl, const RGWEnv *env, ACLOwner& _owner) { std::list grants; int r = 0; for (const struct s3_acl_header *p = acl_header_perms; p->rgw_perm; p++) { - r = parse_acl_header(user_ctl, env, p, grants); + r = parse_acl_header(dpp, user_ctl, env, p, grants); if (r < 0) { return r; } @@ -474,7 +474,7 @@ int RGWAccessControlPolicy_S3::create_from_headers(RGWUserCtl *user_ctl, const R /* can only be called on object that was parsed */ -int RGWAccessControlPolicy_S3::rebuild(RGWUserCtl *user_ctl, ACLOwner *owner, RGWAccessControlPolicy& dest, +int RGWAccessControlPolicy_S3::rebuild(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl, ACLOwner *owner, RGWAccessControlPolicy& dest, std::string &err_msg) { if (!owner) @@ -488,7 +488,7 @@ int RGWAccessControlPolicy_S3::rebuild(RGWUserCtl *user_ctl, ACLOwner *owner, RG } RGWUserInfo owner_info; - if (user_ctl->get_info_by_uid(owner->get_id(), &owner_info, null_yield) < 0) { + if (user_ctl->get_info_by_uid(dpp, owner->get_id(), &owner_info, null_yield) < 0) { ldout(cct, 10) << "owner info does not exist" << dendl; err_msg = "Invalid id"; return -EINVAL; @@ -522,7 +522,7 @@ int RGWAccessControlPolicy_S3::rebuild(RGWUserCtl *user_ctl, ACLOwner *owner, RG } email = u.id; ldout(cct, 10) << "grant user email=" << email << dendl; - if (user_ctl->get_info_by_email(email, &grant_user, null_yield) < 0) { + if (user_ctl->get_info_by_email(dpp, email, &grant_user, null_yield) < 0) { ldout(cct, 10) << "grant user email not found or other error" << dendl; err_msg = "The e-mail address you provided does not match any account on record."; return -ERR_UNRESOLVABLE_EMAIL; @@ -539,7 +539,7 @@ int RGWAccessControlPolicy_S3::rebuild(RGWUserCtl *user_ctl, ACLOwner *owner, RG } } - if (grant_user.user_id.empty() && user_ctl->get_info_by_uid(uid, &grant_user, null_yield) < 0) { + if (grant_user.user_id.empty() && user_ctl->get_info_by_uid(dpp, uid, &grant_user, null_yield) < 0) { ldout(cct, 10) << "grant user does not exist:" << uid << dendl; err_msg = "Invalid id"; return -EINVAL; diff --git a/src/rgw/rgw_acl_s3.h b/src/rgw/rgw_acl_s3.h index eac1412474039..60613a8a1c14b 100644 --- a/src/rgw/rgw_acl_s3.h +++ b/src/rgw/rgw_acl_s3.h @@ -83,7 +83,7 @@ public: bool xml_end(const char *el) override; void to_xml(ostream& out); - int rebuild(RGWUserCtl *user_ctl, ACLOwner *owner, RGWAccessControlPolicy& dest, + int rebuild(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl, ACLOwner *owner, RGWAccessControlPolicy& dest, std::string &err_msg); bool compare_group_name(string& id, ACLGroupTypeEnum group) override; @@ -97,7 +97,7 @@ public: int ret = _acl.create_canned(owner, bucket_owner, canned_acl); return ret; } - int create_from_headers(RGWUserCtl *user_ctl, const RGWEnv *env, ACLOwner& _owner); + int create_from_headers(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl, const RGWEnv *env, ACLOwner& _owner); }; /** diff --git a/src/rgw/rgw_acl_swift.cc b/src/rgw/rgw_acl_swift.cc index 36f00c9173eea..566f39cd22cec 100644 --- a/src/rgw/rgw_acl_swift.cc +++ b/src/rgw/rgw_acl_swift.cc @@ -111,7 +111,8 @@ static boost::optional referrer_to_grant(std::string url_spec, } } -static ACLGrant user_to_grant(CephContext* const cct, +static ACLGrant user_to_grant(const DoutPrefixProvider *dpp, + CephContext* const cct, RGWUserCtl* const user_ctl, const std::string& uid, const uint32_t perm) @@ -120,7 +121,7 @@ static ACLGrant user_to_grant(CephContext* const cct, RGWUserInfo grant_user; ACLGrant grant; - if (user_ctl->get_info_by_uid(user, &grant_user, null_yield) < 0) { + if (user_ctl->get_info_by_uid(dpp, user, &grant_user, null_yield) < 0) { ldout(cct, 10) << "grant user does not exist: " << uid << dendl; /* skipping silently */ grant.set_canon(user, std::string(), perm); @@ -131,7 +132,8 @@ static ACLGrant user_to_grant(CephContext* const cct, return grant; } -int RGWAccessControlPolicy_SWIFT::add_grants(RGWUserCtl* const user_ctl, +int RGWAccessControlPolicy_SWIFT::add_grants(const DoutPrefixProvider *dpp, + RGWUserCtl* const user_ctl, const std::vector& uids, const uint32_t perm) { @@ -144,7 +146,7 @@ int RGWAccessControlPolicy_SWIFT::add_grants(RGWUserCtl* const user_ctl, const size_t pos = uid.find(':'); if (std::string::npos == pos) { /* No, it don't have -- we've got just a regular user identifier. */ - grant = user_to_grant(cct, user_ctl, uid, perm); + grant = user_to_grant(dpp, cct, user_ctl, uid, perm); } else { /* Yes, *potentially* an HTTP referral. */ auto designator = uid.substr(0, pos); @@ -155,7 +157,7 @@ int RGWAccessControlPolicy_SWIFT::add_grants(RGWUserCtl* const user_ctl, boost::algorithm::trim(designatee); if (! boost::algorithm::starts_with(designator, ".")) { - grant = user_to_grant(cct, user_ctl, uid, perm); + grant = user_to_grant(dpp, cct, user_ctl, uid, perm); } else if ((perm & SWIFT_PERM_WRITE) == 0 && is_referrer(designator)) { /* HTTP referrer-based ACLs aren't acceptable for writes. */ grant = referrer_to_grant(designatee, perm); @@ -173,7 +175,8 @@ int RGWAccessControlPolicy_SWIFT::add_grants(RGWUserCtl* const user_ctl, } -int RGWAccessControlPolicy_SWIFT::create(RGWUserCtl* const user_ctl, +int RGWAccessControlPolicy_SWIFT::create(const DoutPrefixProvider *dpp, + RGWUserCtl* const user_ctl, const rgw_user& id, const std::string& name, const char* read_list, @@ -194,7 +197,7 @@ int RGWAccessControlPolicy_SWIFT::create(RGWUserCtl* const user_ctl, return r; } - r = add_grants(user_ctl, uids, SWIFT_PERM_READ); + r = add_grants(dpp, user_ctl, uids, SWIFT_PERM_READ); if (r < 0) { ldout(cct, 0) << "ERROR: add_grants for read returned r=" << r << dendl; @@ -211,7 +214,7 @@ int RGWAccessControlPolicy_SWIFT::create(RGWUserCtl* const user_ctl, return r; } - r = add_grants(user_ctl, uids, SWIFT_PERM_WRITE); + r = add_grants(dpp, user_ctl, uids, SWIFT_PERM_WRITE); if (r < 0) { ldout(cct, 0) << "ERROR: add_grants for write returned r=" << r << dendl; @@ -297,7 +300,8 @@ void RGWAccessControlPolicy_SWIFT::to_str(string& read, string& write) } } -void RGWAccessControlPolicy_SWIFTAcct::add_grants(RGWUserCtl * const user_ctl, +void RGWAccessControlPolicy_SWIFTAcct::add_grants(const DoutPrefixProvider *dpp, + RGWUserCtl * const user_ctl, const std::vector& uids, const uint32_t perm) { @@ -311,7 +315,7 @@ void RGWAccessControlPolicy_SWIFTAcct::add_grants(RGWUserCtl * const user_ctl, } else { rgw_user user(uid); - if (user_ctl->get_info_by_uid(user, &grant_user, null_yield) < 0) { + if (user_ctl->get_info_by_uid(dpp, user, &grant_user, null_yield) < 0) { ldout(cct, 10) << "grant user does not exist:" << uid << dendl; /* skipping silently */ grant.set_canon(user, std::string(), perm); @@ -324,7 +328,8 @@ void RGWAccessControlPolicy_SWIFTAcct::add_grants(RGWUserCtl * const user_ctl, } } -bool RGWAccessControlPolicy_SWIFTAcct::create(RGWUserCtl * const user_ctl, +bool RGWAccessControlPolicy_SWIFTAcct::create(const DoutPrefixProvider *dpp, + RGWUserCtl * const user_ctl, const rgw_user& id, const std::string& name, const std::string& acl_str) @@ -346,7 +351,7 @@ bool RGWAccessControlPolicy_SWIFTAcct::create(RGWUserCtl * const user_ctl, decode_json_obj(admin, *iter); ldout(cct, 0) << "admins: " << admin << dendl; - add_grants(user_ctl, admin, SWIFT_PERM_ADMIN); + add_grants(dpp, user_ctl, admin, SWIFT_PERM_ADMIN); } iter = parser.find_first("read-write"); @@ -355,7 +360,7 @@ bool RGWAccessControlPolicy_SWIFTAcct::create(RGWUserCtl * const user_ctl, decode_json_obj(readwrite, *iter); ldout(cct, 0) << "read-write: " << readwrite << dendl; - add_grants(user_ctl, readwrite, SWIFT_PERM_RWRT); + add_grants(dpp, user_ctl, readwrite, SWIFT_PERM_RWRT); } iter = parser.find_first("read-only"); @@ -364,7 +369,7 @@ bool RGWAccessControlPolicy_SWIFTAcct::create(RGWUserCtl * const user_ctl, decode_json_obj(readonly, *iter); ldout(cct, 0) << "read-only: " << readonly << dendl; - add_grants(user_ctl, readonly, SWIFT_PERM_READ); + add_grants(dpp, user_ctl, readonly, SWIFT_PERM_READ); } return true; diff --git a/src/rgw/rgw_acl_swift.h b/src/rgw/rgw_acl_swift.h index f5f540241ccd5..68104bd36fd81 100644 --- a/src/rgw/rgw_acl_swift.h +++ b/src/rgw/rgw_acl_swift.h @@ -17,7 +17,7 @@ class RGWUserCtl; class RGWAccessControlPolicy_SWIFT : public RGWAccessControlPolicy { - int add_grants(RGWUserCtl *user_ctl, + int add_grants(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl, const std::vector& uids, uint32_t perm); @@ -27,7 +27,8 @@ public: } ~RGWAccessControlPolicy_SWIFT() override = default; - int create(RGWUserCtl *user_ctl, + int create(const DoutPrefixProvider *dpp, + RGWUserCtl *user_ctl, const rgw_user& id, const std::string& name, const char* read_list, @@ -45,10 +46,12 @@ public: } ~RGWAccessControlPolicy_SWIFTAcct() override {} - void add_grants(RGWUserCtl *user_ctl, + void add_grants(const DoutPrefixProvider *dpp, + RGWUserCtl *user_ctl, const std::vector& uids, uint32_t perm); - bool create(RGWUserCtl *user_ctl, + bool create(const DoutPrefixProvider *dpp, + RGWUserCtl *user_ctl, const rgw_user& id, const std::string& name, const std::string& acl_str); diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 2d9a7e12a8b1d..5c833b6b21a70 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -78,7 +78,7 @@ static rgw::sal::RGWRadosStore *store = NULL; static const DoutPrefixProvider* dpp() { struct GlobalPrefix : public DoutPrefixProvider { - CephContext *get_cct() const override { return store->ctx(); } + CephContext *get_cct() const override { return dout_context; } unsigned get_subsys() const override { return dout_subsys; } std::ostream& gen_prefix(std::ostream& out) const override { return out; } }; @@ -1122,10 +1122,10 @@ static int init_bucket(const string& tenant_name, auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); int r; if (bucket_id.empty()) { - r = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, nullptr, null_yield, pattrs); + r = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, nullptr, null_yield, dpp(), pattrs); } else { string bucket_instance_id = bucket_name + ":" + bucket_id; - r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket_instance_id, bucket_info, NULL, pattrs, null_yield); + r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket_instance_id, bucket_info, NULL, pattrs, null_yield, dpp()); } if (r < 0) { cerr << "could not get bucket info for bucket=" << bucket_name << std::endl; @@ -1298,7 +1298,7 @@ int set_bucket_quota(rgw::sal::RGWRadosStore *store, OPT opt_cmd, { RGWBucketInfo bucket_info; map attrs; - int r = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, NULL, null_yield, &attrs); + int r = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, NULL, null_yield, dpp(), &attrs); if (r < 0) { cerr << "could not get bucket info for bucket=" << bucket_name << ": " << cpp_strerror(-r) << std::endl; return -r; @@ -1306,7 +1306,7 @@ int set_bucket_quota(rgw::sal::RGWRadosStore *store, OPT opt_cmd, set_quota_info(bucket_info.quota, opt_cmd, max_size, max_objects, have_max_size, have_max_objects); - r = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), &attrs); + r = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), &attrs, dpp()); if (r < 0) { cerr << "ERROR: failed writing bucket instance info: " << cpp_strerror(-r) << std::endl; return -r; @@ -1324,7 +1324,7 @@ int set_user_bucket_quota(OPT opt_cmd, RGWUser& user, RGWUserAdminOpState& op_st op_state.set_bucket_quota(user_info.bucket_quota); string err; - int r = user.modify(op_state, null_yield, &err); + int r = user.modify(dpp(), op_state, null_yield, &err); if (r < 0) { cerr << "ERROR: failed updating user info: " << cpp_strerror(-r) << ": " << err << std::endl; return -r; @@ -1342,7 +1342,7 @@ int set_user_quota(OPT opt_cmd, RGWUser& user, RGWUserAdminOpState& op_state, in op_state.set_user_quota(user_info.user_quota); string err; - int r = user.modify(op_state, null_yield, &err); + int r = user.modify(dpp(), op_state, null_yield, &err); if (r < 0) { cerr << "ERROR: failed updating user info: " << cpp_strerror(-r) << ": " << err << std::endl; return -r; @@ -1353,7 +1353,7 @@ int set_user_quota(OPT opt_cmd, RGWUser& user, RGWUserAdminOpState& op_state, in int check_min_obj_stripe_size(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info, rgw::sal::RGWObject* obj, uint64_t min_stripe_size, bool *need_rewrite) { RGWObjectCtx obj_ctx(store); - int ret = obj->get_obj_attrs(&obj_ctx, null_yield); + int ret = obj->get_obj_attrs(&obj_ctx, null_yield, dpp()); if (ret < 0) { lderr(store->ctx()) << "ERROR: failed to stat object, returned error: " << cpp_strerror(-ret) << dendl; return ret; @@ -1415,7 +1415,7 @@ int check_obj_locator_underscore(RGWBucketInfo& bucket_info, rgw_obj& obj, rgw_o RGWRados::Object op_target(store->getRados(), bucket_info, obj_ctx, obj); RGWRados::Object::Read read_op(&op_target); - int ret = read_op.prepare(null_yield); + int ret = read_op.prepare(null_yield, dpp()); bool needs_fixing = (ret == -ENOENT); f->dump_bool("needs_fixing", needs_fixing); @@ -1450,7 +1450,7 @@ int check_obj_tail_locator_underscore(RGWBucketInfo& bucket_info, rgw_obj& obj, bool needs_fixing; string status; - int ret = store->getRados()->fix_tail_obj_locator(bucket_info, key, fix, &needs_fixing, null_yield); + int ret = store->getRados()->fix_tail_obj_locator(dpp(), bucket_info, key, fix, &needs_fixing, null_yield); if (ret < 0) { cerr << "ERROR: fix_tail_object_locator_underscore() returned ret=" << ret << std::endl; status = "failed"; @@ -1510,7 +1510,7 @@ int do_check_object_locator(const string& tenant_name, const string& bucket_name f->open_array_section("check_objects"); do { - ret = list_op.list_objects(max_entries - count, &result, &common_prefixes, &truncated, null_yield); + ret = list_op.list_objects(dpp(), max_entries - count, &result, &common_prefixes, &truncated, null_yield); if (ret < 0) { cerr << "ERROR: store->list_objects(): " << cpp_strerror(-ret) << std::endl; return -ret; @@ -1661,7 +1661,7 @@ static int commit_period(RGWRealm& realm, RGWPeriod& period, return ret; } // the master zone can commit locally - ret = period.commit(store, realm, current_period, cerr, null_yield, force); + ret = period.commit(dpp(), store, realm, current_period, cerr, null_yield, force); if (ret < 0) { cerr << "failed to commit period: " << cpp_strerror(-ret) << std::endl; } @@ -2467,7 +2467,7 @@ static int sync_info(std::optional opt_target_zone, std::optionalctl()->bucket->get_sync_policy_handler(zid, hint_bucket, &hint_bucket_handler, null_yield); + int r = store->ctl()->bucket->get_sync_policy_handler(zid, hint_bucket, &hint_bucket_handler, null_yield, dpp()); if (r < 0) { ldout(store->ctx(), 20) << "could not get bucket sync policy handler for hint bucket=" << hint_bucket << " ... skipping" << dendl; continue; @@ -2518,14 +2518,14 @@ static int bucket_sync_info(rgw::sal::RGWRadosStore *store, const RGWBucketInfo& out << indented{width, "zone"} << zone.id << " (" << zone.name << ")\n"; out << indented{width, "bucket"} << info.bucket << "\n\n"; - if (!store->ctl()->bucket->bucket_imports_data(info.bucket, null_yield)) { + if (!store->ctl()->bucket->bucket_imports_data(info.bucket, null_yield, dpp())) { out << "Sync is disabled for bucket " << info.bucket.name << '\n'; return 0; } RGWBucketSyncPolicyHandlerRef handler; - int r = store->ctl()->bucket->get_sync_policy_handler(std::nullopt, info.bucket, &handler, null_yield); + int r = store->ctl()->bucket->get_sync_policy_handler(std::nullopt, info.bucket, &handler, null_yield, dpp()); if (r < 0) { lderr(store->ctx()) << "ERROR: failed to get policy handler for bucket (" << info.bucket << "): r=" << r << ": " << cpp_strerror(-r) << dendl; return r; @@ -2559,14 +2559,14 @@ static int bucket_sync_status(rgw::sal::RGWRadosStore *store, const RGWBucketInf out << indented{width, "zone"} << zone.id << " (" << zone.name << ")\n"; out << indented{width, "bucket"} << info.bucket << "\n\n"; - if (!store->ctl()->bucket->bucket_imports_data(info.bucket, null_yield)) { + if (!store->ctl()->bucket->bucket_imports_data(info.bucket, null_yield, dpp())) { out << "Sync is disabled for bucket " << info.bucket.name << " or bucket has no sync sources" << std::endl; return 0; } RGWBucketSyncPolicyHandlerRef handler; - int r = store->ctl()->bucket->get_sync_policy_handler(std::nullopt, info.bucket, &handler, null_yield); + int r = store->ctl()->bucket->get_sync_policy_handler(std::nullopt, info.bucket, &handler, null_yield, dpp()); if (r < 0) { lderr(store->ctx()) << "ERROR: failed to get policy handler for bucket (" << info.bucket << "): r=" << r << ": " << cpp_strerror(-r) << dendl; return r; @@ -2917,7 +2917,7 @@ public: return 0; } - int ret = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), &bucket_attrs); + int ret = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), &bucket_attrs, dpp()); if (ret < 0) { cerr << "failed to store bucket info: " << cpp_strerror(-ret) << std::endl; return -ret; @@ -3877,9 +3877,9 @@ int main(int argc, const char **argv) bool need_cache = readonly_ops_list.find(opt_cmd) == readonly_ops_list.end(); if (raw_storage_op) { - store = RGWStoreManager::get_raw_storage(g_ceph_context); + store = RGWStoreManager::get_raw_storage(dpp(), g_ceph_context); } else { - store = RGWStoreManager::get_storage(g_ceph_context, false, false, false, false, false, + store = RGWStoreManager::get_storage(dpp(), g_ceph_context, false, false, false, false, false, need_cache && g_conf()->rgw_cache_enabled); } if (!store) { @@ -4125,7 +4125,7 @@ int main(int argc, const char **argv) } RGWRealm realm(realm_name, g_ceph_context, store->svc()->sysobj); - int ret = realm.create(null_yield); + int ret = realm.create(dpp(), null_yield); if (ret < 0) { cerr << "ERROR: couldn't create realm " << realm_name << ": " << cpp_strerror(-ret) << std::endl; return -ret; @@ -4288,7 +4288,7 @@ int main(int argc, const char **argv) if (new_realm) { cout << "clearing period and epoch for new realm" << std::endl; realm.clear_current_period_and_epoch(); - ret = realm.create(null_yield); + ret = realm.create(dpp(), null_yield); if (ret < 0) { cerr << "ERROR: couldn't create new realm: " << cpp_strerror(-ret) << std::endl; return 1; @@ -4376,7 +4376,7 @@ int main(int argc, const char **argv) return -ret; } } - ret = realm.create(null_yield, false); + ret = realm.create(dpp(), null_yield, false); if (ret < 0 && ret != -EEXIST) { cerr << "Error storing realm " << realm.get_id() << ": " << cpp_strerror(ret) << std::endl; @@ -4476,7 +4476,7 @@ int main(int argc, const char **argv) RGWZoneGroup zonegroup(zonegroup_name, is_master, g_ceph_context, store->svc()->sysobj, realm.get_id(), endpoints); zonegroup.api_name = (api_name.empty() ? zonegroup_name : api_name); - ret = zonegroup.create(null_yield); + ret = zonegroup.create(dpp(), null_yield); if (ret < 0) { cerr << "failed to create zonegroup " << zonegroup_name << ": " << cpp_strerror(-ret) << std::endl; return -ret; @@ -4671,7 +4671,7 @@ int main(int argc, const char **argv) if (zonegroup.realm_id.empty() && !default_realm_not_exist) { zonegroup.realm_id = realm.get_id(); } - ret = zonegroup.create(null_yield); + ret = zonegroup.create(dpp(), null_yield); if (ret < 0 && ret != -EEXIST) { cerr << "ERROR: couldn't create zonegroup info: " << cpp_strerror(-ret) << std::endl; return 1; @@ -4906,7 +4906,7 @@ int main(int argc, const char **argv) } } - ret = zone.create(null_yield); + ret = zone.create(dpp(), null_yield); if (ret < 0) { cerr << "failed to create zone " << zone_name << ": " << cpp_strerror(-ret) << std::endl; return -ret; @@ -5542,7 +5542,7 @@ int main(int argc, const char **argv) RGWUser user; int ret = 0; if (!(user_id.empty() && access_key.empty()) || !subuser.empty()) { - ret = user.init(store, user_op, null_yield); + ret = user.init(dpp(), store, user_op, null_yield); if (ret < 0) { cerr << "user.init failed: " << cpp_strerror(-ret) << std::endl; return -ret; @@ -5573,7 +5573,7 @@ int main(int argc, const char **argv) if (!user_op.has_existing_user()) { user_op.set_generate_key(); // generate a new key by default } - ret = user.add(user_op, null_yield, &err_msg); + ret = user.add(dpp(), user_op, null_yield, &err_msg); if (ret < 0) { cerr << "could not create user: " << err_msg << std::endl; if (ret == -ERR_INVALID_TENANT_NAME) @@ -5582,7 +5582,7 @@ int main(int argc, const char **argv) return -ret; } if (!subuser.empty()) { - ret = user.subusers.add(user_op, null_yield, &err_msg); + ret = user.subusers.add(dpp(), user_op, null_yield, &err_msg); if (ret < 0) { cerr << "could not create subuser: " << err_msg << std::endl; return -ret; @@ -5590,7 +5590,7 @@ int main(int argc, const char **argv) } break; case OPT::USER_RM: - ret = user.remove(user_op, null_yield, &err_msg); + ret = user.remove(dpp(), user_op, null_yield, &err_msg); if (ret < 0) { cerr << "could not remove user: " << err_msg << std::endl; return -ret; @@ -5602,7 +5602,7 @@ int main(int argc, const char **argv) if (yes_i_really_mean_it) { user_op.set_overwrite_new_user(true); } - ret = user.rename(user_op, null_yield, &err_msg); + ret = user.rename(user_op, null_yield, dpp(), &err_msg); if (ret < 0) { if (ret == -EEXIST) { err_msg += ". to overwrite this user, add --yes-i-really-mean-it"; @@ -5615,7 +5615,7 @@ int main(int argc, const char **argv) case OPT::USER_ENABLE: case OPT::USER_SUSPEND: case OPT::USER_MODIFY: - ret = user.modify(user_op, null_yield, &err_msg); + ret = user.modify(dpp(), user_op, null_yield, &err_msg); if (ret < 0) { cerr << "could not modify user: " << err_msg << std::endl; return -ret; @@ -5623,7 +5623,7 @@ int main(int argc, const char **argv) break; case OPT::SUBUSER_CREATE: - ret = user.subusers.add(user_op, null_yield, &err_msg); + ret = user.subusers.add(dpp(), user_op, null_yield, &err_msg); if (ret < 0) { cerr << "could not create subuser: " << err_msg << std::endl; return -ret; @@ -5631,7 +5631,7 @@ int main(int argc, const char **argv) break; case OPT::SUBUSER_MODIFY: - ret = user.subusers.modify(user_op, null_yield, &err_msg); + ret = user.subusers.modify(dpp(), user_op, null_yield, &err_msg); if (ret < 0) { cerr << "could not modify subuser: " << err_msg << std::endl; return -ret; @@ -5639,7 +5639,7 @@ int main(int argc, const char **argv) break; case OPT::SUBUSER_RM: - ret = user.subusers.remove(user_op, null_yield, &err_msg); + ret = user.subusers.remove(dpp(), user_op, null_yield, &err_msg); if (ret < 0) { cerr << "could not remove subuser: " << err_msg << std::endl; return -ret; @@ -5647,7 +5647,7 @@ int main(int argc, const char **argv) break; case OPT::CAPS_ADD: - ret = user.caps.add(user_op, null_yield, &err_msg); + ret = user.caps.add(dpp(), user_op, null_yield, &err_msg); if (ret < 0) { cerr << "could not add caps: " << err_msg << std::endl; return -ret; @@ -5655,7 +5655,7 @@ int main(int argc, const char **argv) break; case OPT::CAPS_RM: - ret = user.caps.remove(user_op, null_yield, &err_msg); + ret = user.caps.remove(dpp(), user_op, null_yield, &err_msg); if (ret < 0) { cerr << "could not remove caps: " << err_msg << std::endl; return -ret; @@ -5663,7 +5663,7 @@ int main(int argc, const char **argv) break; case OPT::KEY_CREATE: - ret = user.keys.add(user_op, null_yield, &err_msg); + ret = user.keys.add(dpp(), user_op, null_yield, &err_msg); if (ret < 0) { cerr << "could not create key: " << err_msg << std::endl; return -ret; @@ -5671,7 +5671,7 @@ int main(int argc, const char **argv) break; case OPT::KEY_RM: - ret = user.keys.remove(user_op, null_yield, &err_msg); + ret = user.keys.remove(dpp(), user_op, null_yield, &err_msg); if (ret < 0) { cerr << "could not remove key: " << err_msg << std::endl; return -ret; @@ -5771,7 +5771,7 @@ int main(int argc, const char **argv) return -EINVAL; } RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, path, assume_role_doc, tenant); - ret = role.create(true, null_yield); + ret = role.create(dpp(), true, null_yield); if (ret < 0) { return -ret; } @@ -5785,7 +5785,7 @@ int main(int argc, const char **argv) return -EINVAL; } RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant); - ret = role.delete_obj(null_yield); + ret = role.delete_obj(dpp(), null_yield); if (ret < 0) { return -ret; } @@ -5799,7 +5799,7 @@ int main(int argc, const char **argv) return -EINVAL; } RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant); - ret = role.get(null_yield); + ret = role.get(dpp(), null_yield); if (ret < 0) { return -ret; } @@ -5827,7 +5827,7 @@ int main(int argc, const char **argv) } RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant); - ret = role.get(null_yield); + ret = role.get(dpp(), null_yield); if (ret < 0) { return -ret; } @@ -5842,7 +5842,7 @@ int main(int argc, const char **argv) case OPT::ROLE_LIST: { vector result; - ret = RGWRole::get_roles_by_path_prefix(store->getRados(), g_ceph_context, path_prefix, tenant, result, null_yield); + ret = RGWRole::get_roles_by_path_prefix(dpp(), store->getRados(), g_ceph_context, path_prefix, tenant, result, null_yield); if (ret < 0) { return -ret; } @@ -5875,7 +5875,7 @@ int main(int argc, const char **argv) } RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant); - ret = role.get(null_yield); + ret = role.get(dpp(), null_yield); if (ret < 0) { return -ret; } @@ -5894,7 +5894,7 @@ int main(int argc, const char **argv) return -EINVAL; } RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant); - ret = role.get(null_yield); + ret = role.get(dpp(), null_yield); if (ret < 0) { return -ret; } @@ -5914,7 +5914,7 @@ int main(int argc, const char **argv) return -EINVAL; } RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant); - int ret = role.get(null_yield); + int ret = role.get(dpp(), null_yield); if (ret < 0) { return -ret; } @@ -5938,7 +5938,7 @@ int main(int argc, const char **argv) return -EINVAL; } RGWRole role(g_ceph_context, store->getRados()->pctl, role_name, tenant); - ret = role.get(null_yield); + ret = role.get(dpp(), null_yield); if (ret < 0) { return -ret; } @@ -5970,13 +5970,13 @@ int main(int argc, const char **argv) if (opt_cmd == OPT::POLICY) { if (format == "xml") { - int ret = RGWBucketAdminOp::dump_s3_policy(store, bucket_op, cout); + int ret = RGWBucketAdminOp::dump_s3_policy(store, bucket_op, cout, dpp()); if (ret < 0) { cerr << "ERROR: failed to get policy: " << cpp_strerror(-ret) << std::endl; return -ret; } } else { - int ret = RGWBucketAdminOp::get_policy(store, bucket_op, f); + int ret = RGWBucketAdminOp::get_policy(store, bucket_op, f, dpp()); if (ret < 0) { cerr << "ERROR: failed to get policy: " << cpp_strerror(-ret) << std::endl; return -ret; @@ -5996,7 +5996,7 @@ int main(int argc, const char **argv) user_ids.push_back(user_id.id); ret = RGWBucketAdminOp::limit_check(store, bucket_op, user_ids, f, - null_yield, warnings_only); + null_yield, dpp(), warnings_only); } else { /* list users in groups of max-keys, then perform user-bucket * limit-check on each group */ @@ -6018,7 +6018,7 @@ int main(int argc, const char **argv) /* ok, do the limit checks for this group */ ret = RGWBucketAdminOp::limit_check(store, bucket_op, user_ids, f, - null_yield, warnings_only); + null_yield, dpp(), warnings_only); if (ret < 0) break; } @@ -6037,7 +6037,7 @@ int main(int argc, const char **argv) return -ENOENT; } } - RGWBucketAdminOp::info(store, bucket_op, f, null_yield); + RGWBucketAdminOp::info(store, bucket_op, f, null_yield, dpp()); } else { RGWBucketInfo bucket_info; int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket); @@ -6077,7 +6077,7 @@ int main(int argc, const char **argv) do { const int remaining = max_entries - count; - ret = list_op.list_objects(std::min(remaining, paginate_size), + ret = list_op.list_objects(dpp(), std::min(remaining, paginate_size), &result, &common_prefixes, &truncated, null_yield); if (ret < 0) { @@ -6102,9 +6102,9 @@ int main(int argc, const char **argv) RGWRadosList lister(store, max_concurrent_ios, orphan_stale_secs, tenant); if (bucket_name.empty()) { - ret = lister.run(); + ret = lister.run(dpp()); } else { - ret = lister.run(bucket_name); + ret = lister.run(dpp(), bucket_name); } if (ret < 0) { @@ -6133,7 +6133,7 @@ int main(int argc, const char **argv) } bucket_op.set_fetch_stats(true); - int r = RGWBucketAdminOp::info(store, bucket_op, f, null_yield); + int r = RGWBucketAdminOp::info(store, bucket_op, f, null_yield, dpp()); if (r < 0) { cerr << "failure: " << cpp_strerror(-r) << ": " << err << std::endl; return -r; @@ -6144,7 +6144,7 @@ int main(int argc, const char **argv) bucket_op.set_bucket_id(bucket_id); bucket_op.set_new_bucket_name(new_bucket_name); string err; - int r = RGWBucketAdminOp::link(store, bucket_op, &err); + int r = RGWBucketAdminOp::link(store, bucket_op, dpp(), &err); if (r < 0) { cerr << "failure: " << cpp_strerror(-r) << ": " << err << std::endl; return -r; @@ -6152,7 +6152,7 @@ int main(int argc, const char **argv) } if (opt_cmd == OPT::BUCKET_UNLINK) { - int r = RGWBucketAdminOp::unlink(store, bucket_op); + int r = RGWBucketAdminOp::unlink(store, bucket_op, dpp()); if (r < 0) { cerr << "failure: " << cpp_strerror(-r) << std::endl; return -r; @@ -6166,7 +6166,7 @@ int main(int argc, const char **argv) string err; string marker; - int r = RGWBucketAdminOp::chown(store, bucket_op, marker, &err); + int r = RGWBucketAdminOp::chown(store, bucket_op, marker, dpp(), &err); if (r < 0) { cerr << "failure: " << cpp_strerror(-r) << ": " << err << std::endl; return -r; @@ -6472,12 +6472,12 @@ next: RGWObjState *state; - ret = store->getRados()->get_obj_state(&rctx, bucket_info, obj, &state, false, null_yield); /* don't follow olh */ + ret = store->getRados()->get_obj_state(dpp(), &rctx, bucket_info, obj, &state, false, null_yield); /* don't follow olh */ if (ret < 0) { return -ret; } - ret = store->getRados()->bucket_index_read_olh_log(bucket_info, *state, obj, 0, &log, &is_truncated); + ret = store->getRados()->bucket_index_read_olh_log(dpp(), bucket_info, *state, obj, 0, &log, &is_truncated); if (ret < 0) { cerr << "ERROR: failed reading olh: " << cpp_strerror(-ret) << std::endl; return -ret; @@ -6542,7 +6542,7 @@ next: rgw_obj obj(bucket, key); - ret = store->getRados()->bi_put(bucket, obj, entry); + ret = store->getRados()->bi_put(dpp(), bucket, obj, entry); if (ret < 0) { cerr << "ERROR: bi_put(): " << cpp_strerror(-ret) << std::endl; return -ret; @@ -6576,7 +6576,7 @@ next: RGWRados::BucketShard bs(store->getRados()); int shard_id = (bucket_info.layout.current_index.layout.normal.num_shards > 0 ? i : -1); - int ret = bs.init(bucket, shard_id, bucket_info.layout.current_index, nullptr /* no RGWBucketInfo */); + int ret = bs.init(bucket, shard_id, bucket_info.layout.current_index, nullptr /* no RGWBucketInfo */, dpp()); marker.clear(); if (ret < 0) { @@ -6640,7 +6640,7 @@ next: for (int i = 0; i < max_shards; i++) { RGWRados::BucketShard bs(store->getRados()); int shard_id = (bucket_info.layout.current_index.layout.normal.num_shards > 0 ? i : -1); - int ret = bs.init(bucket, shard_id, bucket_info.layout.current_index, nullptr /* no RGWBucketInfo */); + int ret = bs.init(bucket, shard_id, bucket_info.layout.current_index, nullptr /* no RGWBucketInfo */, dpp()); if (ret < 0) { cerr << "ERROR: bs.init(bucket=" << bucket << ", shard=" << shard_id << "): " << cpp_strerror(-ret) << std::endl; return -ret; @@ -6670,7 +6670,7 @@ next: RGWDataAccess::BucketRef b; RGWDataAccess::ObjectRef obj; - int ret = data_access.get_bucket(tenant, bucket_name, bucket_id, &b, null_yield); + int ret = data_access.get_bucket(dpp(), tenant, bucket_name, bucket_id, &b, null_yield); if (ret < 0) { cerr << "ERROR: failed to init bucket: " << cpp_strerror(-ret) << std::endl; return -ret; @@ -6703,7 +6703,7 @@ next: return -ret; } rgw_obj_key key(object, object_version); - ret = rgw_remove_object(store, bucket_info, bucket, key); + ret = rgw_remove_object(dpp(), store, bucket_info, bucket, key); if (ret < 0) { cerr << "ERROR: object remove returned: " << cpp_strerror(-ret) << std::endl; @@ -6750,14 +6750,14 @@ next: } if (opt_cmd == OPT::OBJECTS_EXPIRE) { - if (!store->getRados()->process_expire_objects()) { + if (!store->getRados()->process_expire_objects(dpp())) { cerr << "ERROR: process_expire_objects() processing returned error." << std::endl; return 1; } } if (opt_cmd == OPT::OBJECTS_EXPIRE_STALE_LIST) { - ret = RGWBucketAdminOp::fix_obj_expiry(store, bucket_op, f, true); + ret = RGWBucketAdminOp::fix_obj_expiry(store, bucket_op, f, dpp(), true); if (ret < 0) { cerr << "ERROR: listing returned " << cpp_strerror(-ret) << std::endl; return -ret; @@ -6765,7 +6765,7 @@ next: } if (opt_cmd == OPT::OBJECTS_EXPIRE_STALE_RM) { - ret = RGWBucketAdminOp::fix_obj_expiry(store, bucket_op, f, false); + ret = RGWBucketAdminOp::fix_obj_expiry(store, bucket_op, f, dpp(), false); if (ret < 0) { cerr << "ERROR: removing returned " << cpp_strerror(-ret) << std::endl; return -ret; @@ -6821,7 +6821,7 @@ next: result.reserve(NUM_ENTRIES); int r = store->getRados()->cls_bucket_list_ordered( - bucket_info, RGW_NO_SHARD, + dpp(), bucket_info, RGW_NO_SHARD, marker, empty_prefix, empty_delimiter, NUM_ENTRIES, true, expansion_factor, result, &is_truncated, &cls_filtered, &marker, @@ -6915,7 +6915,7 @@ next: max_entries = DEFAULT_RESHARD_MAX_ENTRIES; } - return br.execute(num_shards, max_entries, + return br.execute(num_shards, max_entries, dpp(), verbose, &cout, formatter.get()); } @@ -6940,7 +6940,7 @@ next: int num_source_shards = (bucket_info.layout.current_index.layout.normal.num_shards > 0 ? bucket_info.layout.current_index.layout.normal.num_shards : 1); - RGWReshard reshard(store); + RGWReshard reshard(store, dpp()); cls_rgw_reshard_entry entry; entry.time = real_clock::now(); entry.tenant = tenant; @@ -6963,7 +6963,7 @@ next: int num_logshards = store->ctx()->_conf.get_val("rgw_reshard_num_logs"); - RGWReshard reshard(store); + RGWReshard reshard(store, dpp()); formatter->open_array_section("reshard"); for (int i = 0; i < num_logshards; i++) { @@ -7025,7 +7025,7 @@ next: if (opt_cmd == OPT::RESHARD_PROCESS) { RGWReshard reshard(store, true, &cout); - int ret = reshard.process_all_logshards(); + int ret = reshard.process_all_logshards(dpp()); if (ret < 0) { cerr << "ERROR: failed to process reshard logs, error=" << cpp_strerror(-ret) << std::endl; return -ret; @@ -7074,7 +7074,7 @@ next: } } - RGWReshard reshard(store); + RGWReshard reshard(store, dpp()); cls_rgw_reshard_entry entry; entry.tenant = tenant; @@ -7127,7 +7127,7 @@ next: read_op.params.attrs = &attrs; read_op.params.obj_size = &obj_size; - ret = read_op.prepare(null_yield); + ret = read_op.prepare(null_yield, dpp()); if (ret < 0) { cerr << "ERROR: failed to stat object, returned error: " << cpp_strerror(-ret) << std::endl; return 1; @@ -7176,20 +7176,20 @@ next: } do_check_object_locator(tenant, bucket_name, fix, remove_bad, formatter.get()); } else { - RGWBucketAdminOp::check_index(store, bucket_op, f, null_yield); + RGWBucketAdminOp::check_index(store, bucket_op, f, null_yield, dpp()); } } if (opt_cmd == OPT::BUCKET_RM) { if (!inconsistent_index) { - RGWBucketAdminOp::remove_bucket(store, bucket_op, null_yield, bypass_gc, true); + RGWBucketAdminOp::remove_bucket(store, bucket_op, null_yield, dpp(), bypass_gc, true); } else { if (!yes_i_really_mean_it) { cerr << "using --inconsistent_index can corrupt the bucket index " << std::endl << "do you really mean it? (requires --yes-i-really-mean-it)" << std::endl; return 1; } - RGWBucketAdminOp::remove_bucket(store, bucket_op, null_yield, bypass_gc, false); + RGWBucketAdminOp::remove_bucket(store, bucket_op, null_yield, dpp(), bypass_gc, false); } } @@ -7320,7 +7320,7 @@ next: if (opt_cmd == OPT::LC_RESHARD_FIX) { - ret = RGWBucketAdminOp::fix_lc_shards(store, bucket_op,f); + ret = RGWBucketAdminOp::fix_lc_shards(store, bucket_op, f, dpp()); if (ret < 0) { cerr << "ERROR: listing stale instances" << cpp_strerror(-ret) << std::endl; } @@ -7361,7 +7361,7 @@ next: cerr << "could not init search, ret=" << ret << std::endl; return -ret; } - ret = search.run(); + ret = search.run(dpp()); if (ret < 0) { return -ret; } @@ -7435,7 +7435,7 @@ next: } if (opt_cmd == OPT::USER_CHECK) { - check_bad_user_bucket_mapping(store, user_id, fix, null_yield); + check_bad_user_bucket_mapping(store, user_id, fix, null_yield, dpp()); } if (opt_cmd == OPT::USER_STATS) { @@ -7478,7 +7478,7 @@ next: return -ret; } } else { - int ret = rgw_user_sync_all_stats(store, user_id, null_yield); + int ret = rgw_user_sync_all_stats(dpp(), store, user_id, null_yield); if (ret < 0) { cerr << "ERROR: could not sync user stats: " << cpp_strerror(-ret) << std::endl; @@ -7515,7 +7515,7 @@ next: } if (opt_cmd == OPT::METADATA_GET) { - int ret = store->ctl()->meta.mgr->get(metadata_key, formatter.get(), null_yield); + int ret = store->ctl()->meta.mgr->get(metadata_key, formatter.get(), null_yield, dpp()); if (ret < 0) { cerr << "ERROR: can't get key: " << cpp_strerror(-ret) << std::endl; return -ret; @@ -7531,7 +7531,7 @@ next: cerr << "ERROR: failed to read input: " << cpp_strerror(-ret) << std::endl; return -ret; } - ret = store->ctl()->meta.mgr->put(metadata_key, bl, null_yield, RGWMDLogSyncType::APPLY_ALWAYS, false); + ret = store->ctl()->meta.mgr->put(metadata_key, bl, null_yield, dpp(), RGWMDLogSyncType::APPLY_ALWAYS, false); if (ret < 0) { cerr << "ERROR: can't put key: " << cpp_strerror(-ret) << std::endl; return -ret; @@ -7539,7 +7539,7 @@ next: } if (opt_cmd == OPT::METADATA_RM) { - int ret = store->ctl()->meta.mgr->remove(metadata_key, null_yield); + int ret = store->ctl()->meta.mgr->remove(metadata_key, null_yield, dpp()); if (ret < 0) { cerr << "ERROR: can't remove key: " << cpp_strerror(-ret) << std::endl; return -ret; @@ -7696,7 +7696,7 @@ next: if (opt_cmd == OPT::MDLOG_AUTOTRIM) { // need a full history for purging old mdlog periods - store->svc()->mdlog->init_oldest_log_period(null_yield); + store->svc()->mdlog->init_oldest_log_period(null_yield, dpp()); RGWCoroutinesManager crs(store->ctx(), store->getRados()->get_cr_registry()); RGWHTTPManager http(store->ctx(), crs.get_completion_mgr()); @@ -8006,13 +8006,13 @@ next: return -ret; } - if (!store->ctl()->bucket->bucket_imports_data(bucket_info.bucket, null_yield)) { + if (!store->ctl()->bucket->bucket_imports_data(bucket_info.bucket, null_yield, dpp())) { std::cout << "Sync is disabled for bucket " << bucket_name << std::endl; return 0; } RGWBucketSyncPolicyHandlerRef handler; - ret = store->ctl()->bucket->get_sync_policy_handler(std::nullopt, bucket, &handler, null_yield); + ret = store->ctl()->bucket->get_sync_policy_handler(std::nullopt, bucket, &handler, null_yield, dpp()); if (ret < 0) { std::cerr << "ERROR: failed to get policy handler for bucket (" << bucket_info.bucket << "): r=" << ret << ": " << cpp_strerror(-ret) << std::endl; @@ -8041,7 +8041,7 @@ next: } bucket_op.set_tenant(tenant); string err_msg; - ret = RGWBucketAdminOp::sync_bucket(store, bucket_op, &err_msg); + ret = RGWBucketAdminOp::sync_bucket(store, bucket_op, dpp(), &err_msg); if (ret < 0) { cerr << err_msg << std::endl; return -ret; @@ -8910,7 +8910,7 @@ next: int ret = store->ctl()->meta.mgr->mutate(RGWSI_MetaBackend_OTP::get_meta_key(user_id), mtime, &objv_tracker, - null_yield, + null_yield, dpp(), MDLOG_STATUS_WRITE, [&] { return store->svc()->cls->mfa.create_mfa(user_id, config, &objv_tracker, mtime, null_yield); @@ -8924,7 +8924,7 @@ next: user_info.mfa_ids.insert(totp_serial); user_op.set_mfa_ids(user_info.mfa_ids); string err; - ret = user.modify(user_op, null_yield, &err); + ret = user.modify(dpp(), user_op, null_yield, &err); if (ret < 0) { cerr << "ERROR: failed storing user info, error: " << err << std::endl; return -ret; @@ -8946,7 +8946,7 @@ next: int ret = store->ctl()->meta.mgr->mutate(RGWSI_MetaBackend_OTP::get_meta_key(user_id), mtime, &objv_tracker, - null_yield, + null_yield, dpp(), MDLOG_STATUS_WRITE, [&] { return store->svc()->cls->mfa.remove_mfa(user_id, totp_serial, &objv_tracker, mtime, null_yield); @@ -8960,7 +8960,7 @@ next: user_info.mfa_ids.erase(totp_serial); user_op.set_mfa_ids(user_info.mfa_ids); string err; - ret = user.modify(user_op, null_yield, &err); + ret = user.modify(dpp(), user_op, null_yield, &err); if (ret < 0) { cerr << "ERROR: failed storing user info, error: " << err << std::endl; return -ret; @@ -9090,7 +9090,7 @@ next: ret = store->ctl()->meta.mgr->mutate(RGWSI_MetaBackend_OTP::get_meta_key(user_id), mtime, &objv_tracker, - null_yield, + null_yield, dpp(), MDLOG_STATUS_WRITE, [&] { return store->svc()->cls->mfa.create_mfa(user_id, config, &objv_tracker, mtime, null_yield); @@ -9110,7 +9110,7 @@ next: return EINVAL; } - ret = RGWBucketAdminOp::list_stale_instances(store, bucket_op,f); + ret = RGWBucketAdminOp::list_stale_instances(store, bucket_op, f, dpp()); if (ret < 0) { cerr << "ERROR: listing stale instances" << cpp_strerror(-ret) << std::endl; } @@ -9122,7 +9122,7 @@ next: return EINVAL; } - ret = RGWBucketAdminOp::clear_stale_instances(store, bucket_op,f); + ret = RGWBucketAdminOp::clear_stale_instances(store, bucket_op,f, dpp()); if (ret < 0) { cerr << "ERROR: deleting stale instances" << cpp_strerror(-ret) << std::endl; } @@ -9255,7 +9255,7 @@ next: max_entries = RGWPubSub::Sub::DEFAULT_MAX_EVENTS; } auto sub = ps.get_sub_with_events(sub_name); - ret = sub->list_events(marker, max_entries); + ret = sub->list_events(dpp(), marker, max_entries); if (ret < 0) { cerr << "ERROR: could not list events: " << cpp_strerror(-ret) << std::endl; return -ret; @@ -9281,7 +9281,7 @@ next: RGWPubSub ps(store, tenant); auto sub = ps.get_sub_with_events(sub_name); - ret = sub->remove_event(event_id); + ret = sub->remove_event(dpp(), event_id); if (ret < 0) { cerr << "ERROR: could not remove event: " << cpp_strerror(-ret) << std::endl; return -ret; diff --git a/src/rgw/rgw_auth.cc b/src/rgw/rgw_auth.cc index c23eaee0e3429..88925a23332a9 100644 --- a/src/rgw/rgw_auth.cc +++ b/src/rgw/rgw_auth.cc @@ -55,7 +55,7 @@ transform_old_authinfo(CephContext* const cct, } uint32_t get_perms_from_aclspec(const DoutPrefixProvider* dpp, const aclspec_t& aclspec) const override { - return rgw_perms_from_aclspec_default_strategy(id, aclspec); + return rgw_perms_from_aclspec_default_strategy(id, aclspec, dpp); } bool is_admin_of(const rgw_user& acct_id) const override { @@ -130,17 +130,18 @@ transform_old_authinfo(const req_state* const s) uint32_t rgw_perms_from_aclspec_default_strategy( const rgw_user& uid, - const rgw::auth::Identity::aclspec_t& aclspec) + const rgw::auth::Identity::aclspec_t& aclspec, + const DoutPrefixProvider *dpp) { - dout(5) << "Searching permissions for uid=" << uid << dendl; + ldpp_dout(dpp, 5) << "Searching permissions for uid=" << uid << dendl; const auto iter = aclspec.find(uid.to_str()); if (std::end(aclspec) != iter) { - dout(5) << "Found permission: " << iter->second << dendl; + ldpp_dout(dpp, 5) << "Found permission: " << iter->second << dendl; return iter->second; } - dout(5) << "Permissions for user not found" << dendl; + ldpp_dout(dpp, 5) << "Permissions for user not found" << dendl; return 0; } @@ -376,7 +377,7 @@ void rgw::auth::WebIdentityApplier::create_account(const DoutPrefixProvider* dpp rgw_apply_default_bucket_quota(user_info.bucket_quota, cct->_conf); rgw_apply_default_user_quota(user_info.user_quota, cct->_conf); - int ret = ctl->user->store_info(user_info, null_yield, + int ret = ctl->user->store_info(dpp, user_info, null_yield, RGWUserCtl::PutParams().set_exclusive(true)); if (ret < 0) { ldpp_dout(dpp, 0) << "ERROR: failed to store new user info: user=" @@ -392,14 +393,14 @@ void rgw::auth::WebIdentityApplier::load_acct_info(const DoutPrefixProvider* dpp federated_user.ns = "oidc"; //Check in oidc namespace - if (ctl->user->get_info_by_uid(federated_user, &user_info, null_yield) >= 0) { + if (ctl->user->get_info_by_uid(dpp, federated_user, &user_info, null_yield) >= 0) { /* Succeeded. */ return; } federated_user.ns.clear(); //Check for old users which wouldn't have been created in oidc namespace - if (ctl->user->get_info_by_uid(federated_user, &user_info, null_yield) >= 0) { + if (ctl->user->get_info_by_uid(dpp, federated_user, &user_info, null_yield) >= 0) { /* Succeeded. */ return; } @@ -464,7 +465,7 @@ uint32_t rgw::auth::RemoteApplier::get_perms_from_aclspec(const DoutPrefixProvid /* For backward compatibility with ACLOwner. */ perm |= rgw_perms_from_aclspec_default_strategy(info.acct_user, - aclspec); + aclspec, dpp); /* We also need to cover cases where rgw_keystone_implicit_tenants * was enabled. */ @@ -472,7 +473,7 @@ uint32_t rgw::auth::RemoteApplier::get_perms_from_aclspec(const DoutPrefixProvid const rgw_user tenanted_acct_user(info.acct_user.id, info.acct_user.id); perm |= rgw_perms_from_aclspec_default_strategy(tenanted_acct_user, - aclspec); + aclspec, dpp); } /* Now it's a time for invoking additional strategy that was supplied by @@ -599,7 +600,7 @@ void rgw::auth::RemoteApplier::create_account(const DoutPrefixProvider* dpp, rgw_apply_default_bucket_quota(user_info.bucket_quota, cct->_conf); rgw_apply_default_user_quota(user_info.user_quota, cct->_conf); - int ret = ctl->user->store_info(user_info, null_yield, + int ret = ctl->user->store_info(dpp, user_info, null_yield, RGWUserCtl::PutParams().set_exclusive(true)); if (ret < 0) { ldpp_dout(dpp, 0) << "ERROR: failed to store new user info: user=" @@ -641,7 +642,7 @@ void rgw::auth::RemoteApplier::load_acct_info(const DoutPrefixProvider* dpp, RGW else if (acct_user.tenant.empty()) { const rgw_user tenanted_uid(acct_user.id, acct_user.id); - if (ctl->user->get_info_by_uid(tenanted_uid, &user_info, null_yield) >= 0) { + if (ctl->user->get_info_by_uid(dpp, tenanted_uid, &user_info, null_yield) >= 0) { /* Succeeded. */ return; } @@ -649,7 +650,7 @@ void rgw::auth::RemoteApplier::load_acct_info(const DoutPrefixProvider* dpp, RGW if (split_mode && implicit_tenant) ; /* suppress lookup for id used by "other" protocol */ - else if (ctl->user->get_info_by_uid(acct_user, &user_info, null_yield) >= 0) { + else if (ctl->user->get_info_by_uid(dpp, acct_user, &user_info, null_yield) >= 0) { /* Succeeded. */ return; } @@ -666,7 +667,7 @@ const std::string rgw::auth::LocalApplier::NO_SUBUSER; uint32_t rgw::auth::LocalApplier::get_perms_from_aclspec(const DoutPrefixProvider* dpp, const aclspec_t& aclspec) const { - return rgw_perms_from_aclspec_default_strategy(user_info.user_id, aclspec); + return rgw_perms_from_aclspec_default_strategy(user_info.user_id, aclspec, dpp); } bool rgw::auth::LocalApplier::is_admin_of(const rgw_user& uid) const diff --git a/src/rgw/rgw_auth.h b/src/rgw/rgw_auth.h index 1bfccbfe8ddd7..c65f0b335b105 100644 --- a/src/rgw/rgw_auth.h +++ b/src/rgw/rgw_auth.h @@ -731,6 +731,7 @@ protected: uint32_t rgw_perms_from_aclspec_default_strategy( const rgw_user& uid, - const rgw::auth::Identity::aclspec_t& aclspec); + const rgw::auth::Identity::aclspec_t& aclspec, + const DoutPrefixProvider *dpp); #endif /* CEPH_RGW_AUTH_H */ diff --git a/src/rgw/rgw_auth_filters.h b/src/rgw/rgw_auth_filters.h index fbd80e3b90be5..bea9665e4167d 100644 --- a/src/rgw/rgw_auth_filters.h +++ b/src/rgw/rgw_auth_filters.h @@ -182,13 +182,13 @@ void ThirdPartyAccountApplier::load_acct_info(const DoutPrefixProvider* dpp, if (acct_user_override.tenant.empty()) { const rgw_user tenanted_uid(acct_user_override.id, acct_user_override.id); - if (ctl->user->get_info_by_uid(tenanted_uid, &user_info, null_yield) >= 0) { + if (ctl->user->get_info_by_uid(dpp, tenanted_uid, &user_info, null_yield) >= 0) { /* Succeeded. */ return; } } - const int ret = ctl->user->get_info_by_uid(acct_user_override, &user_info, null_yield); + const int ret = ctl->user->get_info_by_uid(dpp, acct_user_override, &user_info, null_yield); if (ret < 0) { /* We aren't trying to recover from ENOENT here. It's supposed that creating * someone else's account isn't a thing we want to support in this filter. */ @@ -258,7 +258,7 @@ void SysReqApplier::load_acct_info(const DoutPrefixProvider* dpp, RGWUserInfo * reasons. rgw_get_user_info_by_uid doesn't trigger the operator=() but * calls ::decode instead. */ RGWUserInfo euser_info; - if (ctl->user->get_info_by_uid(effective_uid, &euser_info, null_yield) < 0) { + if (ctl->user->get_info_by_uid(dpp, effective_uid, &euser_info, null_yield) < 0) { //ldpp_dout(dpp, 0) << "User lookup failed!" << dendl; throw -EACCES; } diff --git a/src/rgw/rgw_auth_s3.cc b/src/rgw/rgw_auth_s3.cc index eca27202373b2..02b30ddd0f926 100644 --- a/src/rgw/rgw_auth_s3.cc +++ b/src/rgw/rgw_auth_s3.cc @@ -374,7 +374,8 @@ static inline int parse_v4_auth_header(const req_info& info, /* in std::string_view& signedheaders, /* out */ std::string_view& signature, /* out */ std::string_view& date, /* out */ - std::string_view& sessiontoken) /* out */ + std::string_view& sessiontoken, /* out */ + const DoutPrefixProvider *dpp) { std::string_view input(info.env->get("HTTP_AUTHORIZATION", "")); try { @@ -382,7 +383,7 @@ static inline int parse_v4_auth_header(const req_info& info, /* in } catch (std::out_of_range&) { /* We should never ever run into this situation as the presence of * AWS4_HMAC_SHA256_STR had been verified earlier. */ - dout(10) << "credentials string is too short" << dendl; + ldpp_dout(dpp, 10) << "credentials string is too short" << dendl; return -EINVAL; } @@ -392,7 +393,7 @@ static inline int parse_v4_auth_header(const req_info& info, /* in if (parsed_pair) { kv[parsed_pair->first] = parsed_pair->second; } else { - dout(10) << "NOTICE: failed to parse auth header (s=" << s << ")" + ldpp_dout(dpp, 10) << "NOTICE: failed to parse auth header (s=" << s << ")" << dendl; return -EINVAL; } @@ -407,7 +408,7 @@ static inline int parse_v4_auth_header(const req_info& info, /* in /* Ensure that the presigned required keys are really there. */ for (const auto& k : required_keys) { if (kv.find(k) == std::end(kv)) { - dout(10) << "NOTICE: auth header missing key: " << k << dendl; + ldpp_dout(dpp, 10) << "NOTICE: auth header missing key: " << k << dendl; return -EINVAL; } } @@ -417,7 +418,7 @@ static inline int parse_v4_auth_header(const req_info& info, /* in signature = kv["Signature"]; /* sig hex str */ - dout(10) << "v4 signature format = " << signature << dendl; + ldpp_dout(dpp, 10) << "v4 signature format = " << signature << dendl; /* ------------------------- handle x-amz-date header */ @@ -426,7 +427,7 @@ static inline int parse_v4_auth_header(const req_info& info, /* in const char *d = info.env->get("HTTP_X_AMZ_DATE"); struct tm t; if (!parse_iso8601(d, &t, NULL, false)) { - dout(10) << "error reading date via http_x_amz_date" << dendl; + ldpp_dout(dpp, 10) << "error reading date via http_x_amz_date" << dendl; return -EACCES; } date = d; @@ -449,7 +450,8 @@ int parse_v4_credentials(const req_info& info, /* in */ std::string_view& signature, /* out */ std::string_view& date, /* out */ std::string_view& session_token, /* out */ - const bool using_qs) /* in */ + const bool using_qs, /* in */ + const DoutPrefixProvider *dpp) { std::string_view credential; int ret; @@ -458,7 +460,7 @@ int parse_v4_credentials(const req_info& info, /* in */ signature, date, session_token); } else { ret = parse_v4_auth_header(info, credential, signedheaders, - signature, date, session_token); + signature, date, session_token, dpp); } if (ret < 0) { @@ -466,7 +468,7 @@ int parse_v4_credentials(const req_info& info, /* in */ } /* access_key/YYYYMMDD/region/service/aws4_request */ - dout(10) << "v4 credential format = " << credential << dendl; + ldpp_dout(dpp, 10) << "v4 credential format = " << credential << dendl; if (std::count(credential.begin(), credential.end(), '/') != 4) { return -EINVAL; @@ -480,11 +482,11 @@ int parse_v4_credentials(const req_info& info, /* in */ /* grab access key id */ const size_t pos = credential.find("/"); access_key_id = credential.substr(0, pos); - dout(10) << "access key id = " << access_key_id << dendl; + ldpp_dout(dpp, 10) << "access key id = " << access_key_id << dendl; /* grab credential scope */ credential_scope = credential.substr(pos + 1); - dout(10) << "credential scope = " << credential_scope << dendl; + ldpp_dout(dpp, 10) << "credential scope = " << credential_scope << dendl; return 0; } @@ -630,9 +632,10 @@ get_v4_canon_req_hash(CephContext* cct, const std::string& canonical_qs, const std::string& canonical_hdrs, const std::string_view& signed_hdrs, - const std::string_view& request_payload_hash) + const std::string_view& request_payload_hash, + const DoutPrefixProvider *dpp) { - ldout(cct, 10) << "payload request hash = " << request_payload_hash << dendl; + ldpp_dout(dpp, 10) << "payload request hash = " << request_payload_hash << dendl; const auto canonical_req = string_join_reserve("\n", http_verb, @@ -645,8 +648,8 @@ get_v4_canon_req_hash(CephContext* cct, const auto canonical_req_hash = calc_hash_sha256(canonical_req); using sanitize = rgw::crypt_sanitize::log_content; - ldout(cct, 10) << "canonical request = " << sanitize{canonical_req} << dendl; - ldout(cct, 10) << "canonical request hash = " + ldpp_dout(dpp, 10) << "canonical request = " << sanitize{canonical_req} << dendl; + ldpp_dout(dpp, 10) << "canonical request hash = " << canonical_req_hash << dendl; return canonical_req_hash; @@ -662,7 +665,8 @@ get_v4_string_to_sign(CephContext* const cct, const std::string_view& algorithm, const std::string_view& request_date, const std::string_view& credential_scope, - const sha256_digest_t& canonreq_hash) + const sha256_digest_t& canonreq_hash, + const DoutPrefixProvider *dpp) { const auto hexed_cr_hash = canonreq_hash.to_str(); const std::string_view hexed_cr_hash_str(hexed_cr_hash); @@ -673,7 +677,7 @@ get_v4_string_to_sign(CephContext* const cct, credential_scope, hexed_cr_hash_str); - ldout(cct, 10) << "string to sign = " + ldpp_dout(dpp, 10) << "string to sign = " << rgw::crypt_sanitize::log_content{string_to_sign} << dendl; @@ -731,7 +735,8 @@ transform_secret_key(const std::string_view& secret_access_key) static sha256_digest_t get_v4_signing_key(CephContext* const cct, const std::string_view& credential_scope, - const std::string_view& secret_access_key) + const std::string_view& secret_access_key, + const DoutPrefixProvider *dpp) { std::string_view date, region, service; std::tie(date, region, service) = parse_cred_scope(credential_scope); @@ -745,10 +750,10 @@ get_v4_signing_key(CephContext* const cct, const auto signing_key = calc_hmac_sha256(service_k, std::string_view("aws4_request")); - ldout(cct, 10) << "date_k = " << date_k << dendl; - ldout(cct, 10) << "region_k = " << region_k << dendl; - ldout(cct, 10) << "service_k = " << service_k << dendl; - ldout(cct, 10) << "signing_k = " << signing_key << dendl; + ldpp_dout(dpp, 10) << "date_k = " << date_k << dendl; + ldpp_dout(dpp, 10) << "region_k = " << region_k << dendl; + ldpp_dout(dpp, 10) << "service_k = " << service_k << dendl; + ldpp_dout(dpp, 10) << "signing_k = " << signing_key << dendl; return signing_key; } @@ -766,9 +771,10 @@ AWSEngine::VersionAbstractor::server_signature_t get_v4_signature(const std::string_view& credential_scope, CephContext* const cct, const std::string_view& secret_key, - const AWSEngine::VersionAbstractor::string_to_sign_t& string_to_sign) + const AWSEngine::VersionAbstractor::string_to_sign_t& string_to_sign, + const DoutPrefixProvider *dpp) { - auto signing_key = get_v4_signing_key(cct, credential_scope, secret_key); + auto signing_key = get_v4_signing_key(cct, credential_scope, secret_key, dpp); /* The server-side generated digest for comparison. */ const auto digest = calc_hmac_sha256(signing_key, string_to_sign); @@ -780,7 +786,7 @@ get_v4_signature(const std::string_view& credential_scope, digest.SIZE * 2); buf_to_hex(digest.v, digest.SIZE, signature.begin()); - ldout(cct, 10) << "generated signature = " << signature << dendl; + ldpp_dout(dpp, 10) << "generated signature = " << signature << dendl; return signature; } @@ -1073,7 +1079,7 @@ AWSv4ComplMulti::create(const req_state* const s, } const auto signing_key = \ - rgw::auth::s3::get_v4_signing_key(s->cct, credential_scope, *secret_key); + rgw::auth::s3::get_v4_signing_key(s->cct, credential_scope, *secret_key, s); return std::make_shared(s, std::move(date), diff --git a/src/rgw/rgw_auth_s3.h b/src/rgw/rgw_auth_s3.h index 210e48a67ffab..20767bedf64ce 100644 --- a/src/rgw/rgw_auth_s3.h +++ b/src/rgw/rgw_auth_s3.h @@ -463,7 +463,8 @@ int parse_v4_credentials(const req_info& info, /* in */ std::string_view& signature, /* out */ std::string_view& date, /* out */ std::string_view& session_token, /* out */ - const bool using_qs); /* in */ + const bool using_qs, /* in */ + const DoutPrefixProvider *dpp); /* in */ static inline bool char_needs_aws4_escaping(const char c, bool encode_slash) { @@ -593,20 +594,23 @@ get_v4_canon_req_hash(CephContext* cct, const std::string& canonical_qs, const std::string& canonical_hdrs, const std::string_view& signed_hdrs, - const std::string_view& request_payload_hash); + const std::string_view& request_payload_hash, + const DoutPrefixProvider *dpp); AWSEngine::VersionAbstractor::string_to_sign_t get_v4_string_to_sign(CephContext* cct, const std::string_view& algorithm, const std::string_view& request_date, const std::string_view& credential_scope, - const sha256_digest_t& canonreq_hash); + const sha256_digest_t& canonreq_hash, + const DoutPrefixProvider *dpp); extern AWSEngine::VersionAbstractor::server_signature_t get_v4_signature(const std::string_view& credential_scope, CephContext* const cct, const std::string_view& secret_key, - const AWSEngine::VersionAbstractor::string_to_sign_t& string_to_sign); + const AWSEngine::VersionAbstractor::string_to_sign_t& string_to_sign, + const DoutPrefixProvider *dpp); extern AWSEngine::VersionAbstractor::server_signature_t get_v2_signature(CephContext*, diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 50b4d9e413287..94bd6dd685479 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -152,7 +152,8 @@ void rgw_parse_url_bucket(const string &bucket, const string& auth_tenant, * Get all the buckets owned by a user and fill up an RGWUserBuckets with them. * Returns: 0 on success, -ERR# on failure. */ -int rgw_read_user_buckets(rgw::sal::RGWRadosStore * store, +int rgw_read_user_buckets(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore * store, const rgw_user& user_id, rgw::sal::RGWBucketList& buckets, const string& marker, @@ -162,7 +163,7 @@ int rgw_read_user_buckets(rgw::sal::RGWRadosStore * store, optional_yield y) { rgw::sal::RGWRadosUser user(store, user_id); - return user.list_buckets(marker, end_marker, max, need_stats, buckets, y); + return user.list_buckets(dpp, marker, end_marker, max, need_stats, buckets, y); } int rgw_bucket_parse_bucket_instance(const string& bucket_instance, string *bucket_name, string *bucket_id, int *shard_id) @@ -261,7 +262,8 @@ static void dump_mulipart_index_results(list& objs_to_unlink, void check_bad_user_bucket_mapping(rgw::sal::RGWRadosStore *store, const rgw_user& user_id, bool fix, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { rgw::sal::RGWBucketList user_buckets; rgw::sal::RGWRadosUser user(store, user_id); @@ -272,7 +274,7 @@ void check_bad_user_bucket_mapping(rgw::sal::RGWRadosStore *store, const rgw_use size_t max_entries = cct->_conf->rgw_list_buckets_max_chunk; do { - int ret = user.list_buckets(marker, string(), max_entries, false, user_buckets, y); + int ret = user.list_buckets(dpp, marker, string(), max_entries, false, user_buckets, y); if (ret < 0) { ldout(store->ctx(), 0) << "failed to read user buckets: " << cpp_strerror(-ret) << dendl; @@ -289,7 +291,7 @@ void check_bad_user_bucket_mapping(rgw::sal::RGWRadosStore *store, const rgw_use RGWBucketInfo bucket_info; real_time mtime; - int r = store->getRados()->get_bucket_info(store->svc(), user_id.tenant, bucket->get_name(), bucket_info, &mtime, null_yield); + int r = store->getRados()->get_bucket_info(store->svc(), user_id.tenant, bucket->get_name(), bucket_info, &mtime, null_yield, dpp); if (r < 0) { ldout(store->ctx(), 0) << "could not get bucket info for bucket=" << bucket << dendl; continue; @@ -306,7 +308,7 @@ void check_bad_user_bucket_mapping(rgw::sal::RGWRadosStore *store, const rgw_use cout << "fixing" << std::endl; r = store->ctl()->bucket->link_bucket(user_id, actual_bucket, bucket_info.creation_time, - null_yield); + null_yield, dpp); if (r < 0) { cerr << "failed to fix bucket: " << cpp_strerror(-r) << std::endl; } @@ -324,7 +326,7 @@ bool rgw_bucket_object_check_filter(const string& oid) return rgw_obj_key::oid_to_key_in_ns(oid, &key, ns); } -int rgw_remove_object(rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucket_info, const rgw_bucket& bucket, rgw_obj_key& key) +int rgw_remove_object(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucket_info, const rgw_bucket& bucket, rgw_obj_key& key) { RGWObjectCtx rctx(store); @@ -334,7 +336,7 @@ int rgw_remove_object(rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucke rgw_obj obj(bucket, key); - return store->getRados()->delete_obj(rctx, bucket_info, obj, bucket_info.versioning_status()); + return store->getRados()->delete_obj(dpp, rctx, bucket_info, obj, bucket_info.versioning_status()); } static int aio_wait(librados::AioCompletion *handle) @@ -362,7 +364,8 @@ static int drain_handles(list& pending) int rgw_remove_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& bucket, int concurrent_max, bool keep_index_consistent, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { int ret; map stats; @@ -374,7 +377,7 @@ int rgw_remove_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& buck string bucket_ver, master_ver; - ret = store->getRados()->get_bucket_info(store->svc(), bucket.tenant, bucket.name, info, NULL, null_yield); + ret = store->getRados()->get_bucket_info(store->svc(), bucket.tenant, bucket.name, info, NULL, null_yield, dpp); if (ret < 0) return ret; @@ -384,7 +387,7 @@ int rgw_remove_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& buck string prefix, delimiter; - ret = abort_bucket_multiparts(store, cct, info, prefix, delimiter); + ret = abort_bucket_multiparts(dpp, store, cct, info, prefix, delimiter); if (ret < 0) { return ret; } @@ -402,7 +405,7 @@ int rgw_remove_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& buck while (is_truncated) { objs.clear(); - ret = list_op.list_objects(listing_max_entries, &objs, &common_prefixes, + ret = list_op.list_objects(dpp, listing_max_entries, &objs, &common_prefixes, &is_truncated, null_yield); if (ret < 0) return ret; @@ -412,7 +415,7 @@ int rgw_remove_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& buck RGWObjState *astate = NULL; rgw_obj obj(bucket, (*it).key); - ret = store->getRados()->get_obj_state(&obj_ctx, info, obj, &astate, false, y); + ret = store->getRados()->get_obj_state(dpp, &obj_ctx, info, obj, &astate, false, y); if (ret == -ENOENT) { dout(1) << "WARNING: cannot find obj state for obj " << obj.get_oid() << dendl; continue; @@ -453,7 +456,7 @@ int rgw_remove_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& buck } } // for all shadow objs - ret = store->getRados()->delete_obj_aio(head_obj, info, astate, handles, keep_index_consistent, null_yield); + ret = store->getRados()->delete_obj_aio(dpp, head_obj, info, astate, handles, keep_index_consistent, null_yield); if (ret < 0) { lderr(store->ctx()) << "ERROR: delete obj aio failed with " << ret << dendl; return ret; @@ -488,13 +491,13 @@ int rgw_remove_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& buck // this function can only be run if caller wanted children to be // deleted, so we can ignore the check for children as any that // remain are detritus from a prior bug - ret = store->getRados()->delete_bucket(info, objv_tracker, y, false); + ret = store->getRados()->delete_bucket(info, objv_tracker, y, dpp, false); if (ret < 0) { lderr(store->ctx()) << "ERROR: could not remove bucket " << bucket.name << dendl; return ret; } - ret = store->ctl()->bucket->unlink_bucket(info.owner, bucket, null_yield, false); + ret = store->ctl()->bucket->unlink_bucket(info.owner, bucket, null_yield, dpp, false); if (ret < 0) { lderr(store->ctx()) << "ERROR: unable to remove user bucket information" << dendl; } @@ -509,7 +512,7 @@ static void set_err_msg(std::string *sink, std::string msg) } int RGWBucket::init(rgw::sal::RGWRadosStore *storage, RGWBucketAdminOpState& op_state, - optional_yield y, std::string *err_msg, + optional_yield y, const DoutPrefixProvider *dpp, std::string *err_msg, map *pattrs) { if (!storage) { @@ -535,7 +538,7 @@ int RGWBucket::init(rgw::sal::RGWRadosStore *storage, RGWBucketAdminOpState& op_ if (!bucket.name.empty()) { int r = store->ctl()->bucket->read_bucket_info( - bucket, &bucket_info, y, + bucket, &bucket_info, y, dpp, RGWBucketCtl::BucketInstance::GetParams().set_attrs(pattrs), &ep_objv); if (r < 0) { @@ -547,7 +550,7 @@ int RGWBucket::init(rgw::sal::RGWRadosStore *storage, RGWBucketAdminOpState& op_ } if (!user_id.empty()) { - int r = store->ctl()->user->get_info_by_uid(user_id, &user_info, y); + int r = store->ctl()->user->get_info_by_uid(dpp, user_id, &user_info, y); if (r < 0) { set_err_msg(err_msg, "failed to fetch user info"); return r; @@ -597,7 +600,7 @@ bool rgw_find_bucket_by_id(CephContext *cct, RGWMetadataManager *mgr, return false; } -int RGWBucket::link(RGWBucketAdminOpState& op_state, optional_yield y, +int RGWBucket::link(RGWBucketAdminOpState& op_state, optional_yield y, const DoutPrefixProvider *dpp, map& attrs, std::string *err_msg) { if (!op_state.is_user_op()) { @@ -652,7 +655,7 @@ int RGWBucket::link(RGWBucketAdminOpState& op_state, optional_yield y, } auto bucket_ctl = store->ctl()->bucket; - int r = bucket_ctl->unlink_bucket(owner.get_id(), old_bucket, y, false); + int r = bucket_ctl->unlink_bucket(owner.get_id(), old_bucket, y, dpp, false); if (r < 0) { set_err_msg(err_msg, "could not unlink policy from user " + owner.get_id().to_str()); return r; @@ -679,7 +682,7 @@ int RGWBucket::link(RGWBucketAdminOpState& op_state, optional_yield y, instance_params.set_exclusive(true); } - r = bucket_ctl->store_bucket_instance_info(bucket, bucket_info, y, instance_params); + r = bucket_ctl->store_bucket_instance_info(bucket, bucket_info, y, dpp, instance_params); if (r < 0) { set_err_msg(err_msg, "ERROR: failed writing bucket instance info: " + cpp_strerror(-r)); return r; @@ -697,7 +700,7 @@ int RGWBucket::link(RGWBucketAdminOpState& op_state, optional_yield y, r = store->ctl()->bucket->link_bucket(user_info.user_id, bucket_info.bucket, ep.creation_time, - y, true, &ep_data); + y, dpp, true, &ep_data); if (r < 0) { set_err_msg(err_msg, "failed to relink bucket"); return r; @@ -705,7 +708,7 @@ int RGWBucket::link(RGWBucketAdminOpState& op_state, optional_yield y, if (bucket != old_bucket) { // like RGWRados::delete_bucket -- excepting no bucket_index work. - r = bucket_ctl->remove_bucket_entrypoint_info(old_bucket, y, + r = bucket_ctl->remove_bucket_entrypoint_info(old_bucket, y, dpp, RGWBucketCtl::Bucket::RemoveParams() .set_objv_tracker(&ep_data.ep_objv)); if (r < 0) { @@ -713,7 +716,7 @@ int RGWBucket::link(RGWBucketAdminOpState& op_state, optional_yield y, return r; } - r = bucket_ctl->remove_bucket_instance_info(old_bucket, bucket_info, y, + r = bucket_ctl->remove_bucket_instance_info(old_bucket, bucket_info, y, dpp, RGWBucketCtl::BucketInstance::RemoveParams() .set_objv_tracker(&old_version)); if (r < 0) { @@ -726,10 +729,10 @@ int RGWBucket::link(RGWBucketAdminOpState& op_state, optional_yield y, } int RGWBucket::chown(RGWBucketAdminOpState& op_state, const string& marker, - optional_yield y, std::string *err_msg) + optional_yield y, const DoutPrefixProvider *dpp, std::string *err_msg) { int ret = store->ctl()->bucket->chown(store, bucket_info, user_info.user_id, - user_info.display_name, marker, y); + user_info.display_name, marker, y, dpp); if (ret < 0) { set_err_msg(err_msg, "Failed to change object ownership: " + cpp_strerror(-ret)); } @@ -737,7 +740,7 @@ int RGWBucket::chown(RGWBucketAdminOpState& op_state, const string& marker, return ret; } -int RGWBucket::unlink(RGWBucketAdminOpState& op_state, optional_yield y, std::string *err_msg) +int RGWBucket::unlink(RGWBucketAdminOpState& op_state, optional_yield y, const DoutPrefixProvider *dpp, std::string *err_msg) { rgw_bucket bucket = op_state.get_bucket(); @@ -746,7 +749,7 @@ int RGWBucket::unlink(RGWBucketAdminOpState& op_state, optional_yield y, std::st return -EINVAL; } - int r = store->ctl()->bucket->unlink_bucket(user_info.user_id, bucket, y); + int r = store->ctl()->bucket->unlink_bucket(user_info.user_id, bucket, y, dpp); if (r < 0) { set_err_msg(err_msg, "error unlinking bucket" + cpp_strerror(-r)); } @@ -754,19 +757,19 @@ int RGWBucket::unlink(RGWBucketAdminOpState& op_state, optional_yield y, std::st return r; } -int RGWBucket::set_quota(RGWBucketAdminOpState& op_state, std::string *err_msg) +int RGWBucket::set_quota(RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, std::string *err_msg) { rgw_bucket bucket = op_state.get_bucket(); RGWBucketInfo bucket_info; map attrs; - int r = store->getRados()->get_bucket_info(store->svc(), bucket.tenant, bucket.name, bucket_info, NULL, null_yield, &attrs); + int r = store->getRados()->get_bucket_info(store->svc(), bucket.tenant, bucket.name, bucket_info, NULL, null_yield, dpp, &attrs); if (r < 0) { set_err_msg(err_msg, "could not get bucket info for bucket=" + bucket.name + ": " + cpp_strerror(-r)); return r; } bucket_info.quota = op_state.quota; - r = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), &attrs); + r = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), &attrs, dpp); if (r < 0) { set_err_msg(err_msg, "ERROR: failed writing bucket instance info: " + cpp_strerror(-r)); return r; @@ -774,14 +777,14 @@ int RGWBucket::set_quota(RGWBucketAdminOpState& op_state, std::string *err_msg) return r; } -int RGWBucket::remove_object(RGWBucketAdminOpState& op_state, std::string *err_msg) +int RGWBucket::remove_object(const DoutPrefixProvider *dpp, RGWBucketAdminOpState& op_state, std::string *err_msg) { rgw_bucket bucket = op_state.get_bucket(); std::string object_name = op_state.get_object_name(); rgw_obj_key key(object_name); - int ret = rgw_remove_object(store, bucket_info, bucket, key); + int ret = rgw_remove_object(dpp, store, bucket_info, bucket, key); if (ret < 0) { set_err_msg(err_msg, "unable to remove object" + cpp_strerror(-ret)); return ret; @@ -827,7 +830,8 @@ static void dump_index_check(map existing_stats } int RGWBucket::check_bad_index_multipart(RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher ,std::string *err_msg) + RGWFormatterFlusher& flusher, + const DoutPrefixProvider *dpp, std::string *err_msg) { bool fix_index = op_state.will_fix_index(); rgw_bucket bucket = op_state.get_bucket(); @@ -840,7 +844,7 @@ int RGWBucket::check_bad_index_multipart(RGWBucketAdminOpState& op_state, RGWBucketInfo bucket_info; auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); - int r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket, bucket_info, nullptr, nullptr, null_yield); + int r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket, bucket_info, nullptr, nullptr, null_yield, dpp); if (r < 0) { ldout(store->ctx(), 0) << "ERROR: " << __func__ << "(): get_bucket_instance_info(bucket=" << bucket << ") returned r=" << r << dendl; return r; @@ -854,7 +858,7 @@ int RGWBucket::check_bad_index_multipart(RGWBucketAdminOpState& op_state, do { vector result; - int r = list_op.list_objects(listing_max_entries, &result, + int r = list_op.list_objects(dpp, listing_max_entries, &result, &common_prefixes, &is_truncated, null_yield); if (r < 0) { set_err_msg(err_msg, "failed to list objects in bucket=" + bucket.name + @@ -932,7 +936,8 @@ int RGWBucket::check_bad_index_multipart(RGWBucketAdminOpState& op_state, return 0; } -int RGWBucket::check_object_index(RGWBucketAdminOpState& op_state, +int RGWBucket::check_object_index(const DoutPrefixProvider *dpp, + RGWBucketAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y, std::string *err_msg) @@ -961,7 +966,7 @@ int RGWBucket::check_object_index(RGWBucketAdminOpState& op_state, result.reserve(listing_max_entries); int r = store->getRados()->cls_bucket_list_ordered( - bucket_info, RGW_NO_SHARD, marker, prefix, empty_delimiter, + dpp, bucket_info, RGW_NO_SHARD, marker, prefix, empty_delimiter, listing_max_entries, true, expansion_factor, result, &is_truncated, &cls_filtered, &marker, y, rgw_bucket_object_check_filter); @@ -1014,7 +1019,7 @@ int RGWBucket::check_index(RGWBucketAdminOpState& op_state, return 0; } -int RGWBucket::sync(RGWBucketAdminOpState& op_state, map *attrs, std::string *err_msg) +int RGWBucket::sync(RGWBucketAdminOpState& op_state, map *attrs, const DoutPrefixProvider *dpp, std::string *err_msg) { if (!store->svc()->zone->is_meta_master()) { set_err_msg(err_msg, "ERROR: failed to update bucket sync: only allowed on meta master zone"); @@ -1027,7 +1032,7 @@ int RGWBucket::sync(RGWBucketAdminOpState& op_state, map *at bucket_info.flags |= BUCKET_DATASYNC_DISABLED; } - int r = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), attrs); + int r = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), attrs, dpp); if (r < 0) { set_err_msg(err_msg, "ERROR: failed writing bucket instance info:" + cpp_strerror(-r)); return r; @@ -1051,7 +1056,7 @@ int RGWBucket::sync(RGWBucketAdminOpState& op_state, map *at } for (int i = 0; i < shards_num; ++i, ++shard_id) { - r = store->svc()->datalog_rados->add_entry(bucket_info, shard_id); + r = store->svc()->datalog_rados->add_entry(dpp, bucket_info, shard_id); if (r < 0) { set_err_msg(err_msg, "ERROR: failed writing data log:" + cpp_strerror(-r)); return r; @@ -1073,7 +1078,8 @@ int RGWBucket::policy_bl_to_stream(bufferlist& bl, ostream& o) return 0; } -int rgw_object_get_attr(rgw::sal::RGWRadosStore* store, const RGWBucketInfo& bucket_info, +int rgw_object_get_attr(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore* store, const RGWBucketInfo& bucket_info, const rgw_obj& obj, const char* attr_name, bufferlist& out_bl, optional_yield y) { @@ -1081,17 +1087,17 @@ int rgw_object_get_attr(rgw::sal::RGWRadosStore* store, const RGWBucketInfo& buc RGWRados::Object op_target(store->getRados(), bucket_info, obj_ctx, obj); RGWRados::Object::Read rop(&op_target); - return rop.get_attr(attr_name, out_bl, y); + return rop.get_attr(dpp, attr_name, out_bl, y); } -int RGWBucket::get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolicy& policy, optional_yield y) +int RGWBucket::get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolicy& policy, optional_yield y, const DoutPrefixProvider *dpp) { std::string object_name = op_state.get_object_name(); rgw_bucket bucket = op_state.get_bucket(); RGWBucketInfo bucket_info; map attrs; - int ret = store->getRados()->get_bucket_info(store->svc(), bucket.tenant, bucket.name, bucket_info, NULL, null_yield, &attrs); + int ret = store->getRados()->get_bucket_info(store->svc(), bucket.tenant, bucket.name, bucket_info, NULL, null_yield, dpp, &attrs); if (ret < 0) { return ret; } @@ -1100,7 +1106,7 @@ int RGWBucket::get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolic bufferlist bl; rgw_obj obj(bucket, object_name); - ret = rgw_object_get_attr(store, bucket_info, obj, RGW_ATTR_ACL, bl, y); + ret = rgw_object_get_attr(dpp, store, bucket_info, obj, RGW_ATTR_ACL, bl, y); if (ret < 0){ return ret; } @@ -1127,15 +1133,15 @@ int RGWBucket::get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolic int RGWBucketAdminOp::get_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - RGWAccessControlPolicy& policy) + RGWAccessControlPolicy& policy, const DoutPrefixProvider *dpp) { RGWBucket bucket; - int ret = bucket.init(store, op_state, null_yield); + int ret = bucket.init(store, op_state, null_yield, dpp); if (ret < 0) return ret; - ret = bucket.get_policy(op_state, policy, null_yield); + ret = bucket.get_policy(op_state, policy, null_yield, dpp); if (ret < 0) return ret; @@ -1146,11 +1152,11 @@ int RGWBucketAdminOp::get_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminO int RGWBucketAdminOp::get_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher) + RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp) { RGWAccessControlPolicy policy(store->ctx()); - int ret = get_policy(store, op_state, policy); + int ret = get_policy(store, op_state, policy, dpp); if (ret < 0) return ret; @@ -1168,11 +1174,11 @@ int RGWBucketAdminOp::get_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminO } int RGWBucketAdminOp::dump_s3_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - ostream& os) + ostream& os, const DoutPrefixProvider *dpp) { RGWAccessControlPolicy_S3 policy(store->ctx()); - int ret = get_policy(store, op_state, policy); + int ret = get_policy(store, op_state, policy, dpp); if (ret < 0) return ret; @@ -1181,49 +1187,49 @@ int RGWBucketAdminOp::dump_s3_policy(rgw::sal::RGWRadosStore *store, RGWBucketAd return 0; } -int RGWBucketAdminOp::unlink(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state) +int RGWBucketAdminOp::unlink(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp) { RGWBucket bucket; - int ret = bucket.init(store, op_state, null_yield); + int ret = bucket.init(store, op_state, null_yield, dpp); if (ret < 0) return ret; - return bucket.unlink(op_state, null_yield); + return bucket.unlink(op_state, null_yield, dpp); } -int RGWBucketAdminOp::link(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, string *err) +int RGWBucketAdminOp::link(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, string *err) { RGWBucket bucket; map attrs; - int ret = bucket.init(store, op_state, null_yield, err, &attrs); + int ret = bucket.init(store, op_state, null_yield, dpp, err, &attrs); if (ret < 0) return ret; - return bucket.link(op_state, null_yield, attrs, err); + return bucket.link(op_state, null_yield, dpp, attrs, err); } -int RGWBucketAdminOp::chown(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const string& marker, string *err) +int RGWBucketAdminOp::chown(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const string& marker, const DoutPrefixProvider *dpp, string *err) { RGWBucket bucket; map attrs; - int ret = bucket.init(store, op_state, null_yield, err, &attrs); + int ret = bucket.init(store, op_state, null_yield, dpp, err, &attrs); if (ret < 0) return ret; - ret = bucket.link(op_state, null_yield, attrs, err); + ret = bucket.link(op_state, null_yield, dpp, attrs, err); if (ret < 0) return ret; - return bucket.chown(op_state, marker, null_yield, err); + return bucket.chown(op_state, marker, null_yield, dpp, err); } int RGWBucketAdminOp::check_index(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher, optional_yield y) + RGWFormatterFlusher& flusher, optional_yield y, const DoutPrefixProvider *dpp) { int ret; map existing_stats; @@ -1232,18 +1238,18 @@ int RGWBucketAdminOp::check_index(rgw::sal::RGWRadosStore *store, RGWBucketAdmin RGWBucket bucket; - ret = bucket.init(store, op_state, null_yield); + ret = bucket.init(store, op_state, null_yield, dpp); if (ret < 0) return ret; Formatter *formatter = flusher.get_formatter(); flusher.start(0); - ret = bucket.check_bad_index_multipart(op_state, flusher); + ret = bucket.check_bad_index_multipart(op_state, flusher, dpp); if (ret < 0) return ret; - ret = bucket.check_object_index(op_state, flusher, y); + ret = bucket.check_object_index(dpp, op_state, flusher, y); if (ret < 0) return ret; @@ -1258,52 +1264,54 @@ int RGWBucketAdminOp::check_index(rgw::sal::RGWRadosStore *store, RGWBucketAdmin } int RGWBucketAdminOp::remove_bucket(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - optional_yield y, bool bypass_gc, bool keep_index_consistent) + optional_yield y, const DoutPrefixProvider *dpp, + bool bypass_gc, bool keep_index_consistent) { std::unique_ptr bucket; std::unique_ptr user = store->get_user(op_state.get_user_id()); - int ret = store->get_bucket(user.get(), user->get_tenant(), op_state.get_bucket_name(), + int ret = store->get_bucket(dpp, user.get(), user->get_tenant(), op_state.get_bucket_name(), &bucket, y); if (ret < 0) return ret; if (bypass_gc) - ret = rgw_remove_bucket_bypass_gc(store, bucket->get_key(), op_state.get_max_aio(), keep_index_consistent, y); + ret = rgw_remove_bucket_bypass_gc(store, bucket->get_key(), op_state.get_max_aio(), keep_index_consistent, y, dpp); else - ret = bucket->remove_bucket(op_state.will_delete_children(), string(), string(), + ret = bucket->remove_bucket(dpp, op_state.will_delete_children(), string(), string(), false, nullptr, y); return ret; } -int RGWBucketAdminOp::remove_object(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state) +int RGWBucketAdminOp::remove_object(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp) { RGWBucket bucket; - int ret = bucket.init(store, op_state, null_yield); + int ret = bucket.init(store, op_state, null_yield, dpp); if (ret < 0) return ret; - return bucket.remove_object(op_state); + return bucket.remove_object(dpp, op_state); } -int RGWBucketAdminOp::sync_bucket(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, string *err_msg) +int RGWBucketAdminOp::sync_bucket(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, string *err_msg) { RGWBucket bucket; map attrs; - int ret = bucket.init(store, op_state, null_yield, err_msg, &attrs); + int ret = bucket.init(store, op_state, null_yield, dpp, err_msg, &attrs); if (ret < 0) { return ret; } - return bucket.sync(op_state, &attrs, err_msg); + return bucket.sync(op_state, &attrs, dpp, err_msg); } static int bucket_stats(rgw::sal::RGWRadosStore *store, const std::string& tenant_name, const std::string& bucket_name, - Formatter *formatter) + Formatter *formatter, + const DoutPrefixProvider *dpp) { RGWBucketInfo bucket_info; map stats; @@ -1312,7 +1320,7 @@ static int bucket_stats(rgw::sal::RGWRadosStore *store, real_time mtime; int r = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, bucket_info, - &mtime, null_yield, &attrs); + &mtime, null_yield, dpp, &attrs); if (r < 0) { return r; } @@ -1376,6 +1384,7 @@ int RGWBucketAdminOp::limit_check(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const std::list& user_ids, RGWFormatterFlusher& flusher, optional_yield y, + const DoutPrefixProvider *dpp, bool warnings_only) { int ret = 0; @@ -1406,7 +1415,7 @@ int RGWBucketAdminOp::limit_check(rgw::sal::RGWRadosStore *store, do { rgw::sal::RGWRadosUser user(store, rgw_user(user_id)); - ret = user.list_buckets(marker, string(), max_entries, false, buckets, y); + ret = user.list_buckets(dpp, marker, string(), max_entries, false, buckets, y); if (ret < 0) return ret; @@ -1427,7 +1436,7 @@ int RGWBucketAdminOp::limit_check(rgw::sal::RGWRadosStore *store, ret = store->getRados()->get_bucket_info(store->svc(), bucket->get_tenant(), bucket->get_name(), info, nullptr, - null_yield); + null_yield, dpp); if (ret < 0) continue; @@ -1492,13 +1501,14 @@ int RGWBucketAdminOp::limit_check(rgw::sal::RGWRadosStore *store, int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, RGWFormatterFlusher& flusher, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { RGWBucket bucket; int ret = 0; const std::string& bucket_name = op_state.get_bucket_name(); if (!bucket_name.empty()) { - ret = bucket.init(store, op_state, null_yield); + ret = bucket.init(store, op_state, null_yield, dpp); if (-ENOENT == ret) return -ERR_NO_SUCH_BUCKET; else if (ret < 0) @@ -1524,7 +1534,7 @@ int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store, constexpr bool no_need_stats = false; // set need_stats to false do { - ret = user.list_buckets(marker, empty_end_marker, max_entries, + ret = user.list_buckets(dpp, marker, empty_end_marker, max_entries, no_need_stats, buckets, y); if (ret < 0) { return ret; @@ -1540,7 +1550,7 @@ int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store, } if (show_stats) { - bucket_stats(store, user_id.tenant, obj_name, formatter); + bucket_stats(store, user_id.tenant, obj_name, formatter, dpp); } else { formatter->dump_string("bucket", obj_name); } @@ -1556,7 +1566,7 @@ int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store, formatter->close_section(); } else if (!bucket_name.empty()) { - ret = bucket_stats(store, user_id.tenant, bucket_name, formatter); + ret = bucket_stats(store, user_id.tenant, bucket_name, formatter, dpp); if (ret < 0) { return ret; } @@ -1573,7 +1583,7 @@ int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store, &truncated); for (auto& bucket_name : buckets) { if (show_stats) { - bucket_stats(store, user_id.tenant, bucket_name, formatter); + bucket_stats(store, user_id.tenant, bucket_name, formatter, dpp); } else { formatter->dump_string("bucket", bucket_name); } @@ -1589,23 +1599,23 @@ int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store, return 0; } -int RGWBucketAdminOp::set_quota(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state) +int RGWBucketAdminOp::set_quota(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp) { RGWBucket bucket; - int ret = bucket.init(store, op_state, null_yield); + int ret = bucket.init(store, op_state, null_yield, dpp); if (ret < 0) return ret; - return bucket.set_quota(op_state); + return bucket.set_quota(op_state, dpp); } -static int purge_bucket_instance(rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucket_info) +static int purge_bucket_instance(rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucket_info, const DoutPrefixProvider *dpp) { int max_shards = (bucket_info.layout.current_index.layout.normal.num_shards > 0 ? bucket_info.layout.current_index.layout.normal.num_shards : 1); for (int i = 0; i < max_shards; i++) { RGWRados::BucketShard bs(store->getRados()); int shard_id = (bucket_info.layout.current_index.layout.normal.num_shards > 0 ? i : -1); - int ret = bs.init(bucket_info.bucket, shard_id, bucket_info.layout.current_index, nullptr); + int ret = bs.init(bucket_info.bucket, shard_id, bucket_info.layout.current_index, nullptr, dpp); if (ret < 0) { cerr << "ERROR: bs.init(bucket=" << bucket_info.bucket << ", shard=" << shard_id << "): " << cpp_strerror(-ret) << std::endl; @@ -1632,7 +1642,8 @@ inline auto split_tenant(const std::string& bucket_name){ using bucket_instance_ls = std::vector; void get_stale_instances(rgw::sal::RGWRadosStore *store, const std::string& bucket_name, const vector& lst, - bucket_instance_ls& stale_instances) + bucket_instance_ls& stale_instances, + const DoutPrefixProvider *dpp) { auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); @@ -1643,7 +1654,7 @@ void get_stale_instances(rgw::sal::RGWRadosStore *store, const std::string& buck for (const auto& bucket_instance : lst){ RGWBucketInfo binfo; int r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket_instance, - binfo, nullptr,nullptr, null_yield); + binfo, nullptr,nullptr, null_yield, dpp); if (r < 0){ // this can only happen if someone deletes us right when we're processing lderr(store->ctx()) << "Bucket instance is invalid: " << bucket_instance @@ -1661,7 +1672,7 @@ void get_stale_instances(rgw::sal::RGWRadosStore *store, const std::string& buck // all the instances auto [tenant, bucket] = split_tenant(bucket_name); RGWBucketInfo cur_bucket_info; - int r = store->getRados()->get_bucket_info(store->svc(), tenant, bucket, cur_bucket_info, nullptr, null_yield); + int r = store->getRados()->get_bucket_info(store->svc(), tenant, bucket, cur_bucket_info, nullptr, null_yield, dpp); if (r < 0) { if (r == -ENOENT) { // bucket doesn't exist, everything is stale then @@ -1718,6 +1729,7 @@ void get_stale_instances(rgw::sal::RGWRadosStore *store, const std::string& buck static int process_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, RGWFormatterFlusher& flusher, + const DoutPrefixProvider *dpp, std::function process_f) @@ -1760,7 +1772,7 @@ static int process_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdmi } for (const auto& kv: bucket_instance_map) { bucket_instance_ls stale_lst; - get_stale_instances(store, kv.first, kv.second, stale_lst); + get_stale_instances(store, kv.first, kv.second, stale_lst, dpp); process_f(stale_lst, formatter, store); } } @@ -1771,7 +1783,8 @@ static int process_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdmi int RGWBucketAdminOp::list_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher) + RGWFormatterFlusher& flusher, + const DoutPrefixProvider *dpp) { auto process_f = [](const bucket_instance_ls& lst, Formatter *formatter, @@ -1779,22 +1792,23 @@ int RGWBucketAdminOp::list_stale_instances(rgw::sal::RGWRadosStore *store, for (const auto& binfo: lst) formatter->dump_string("key", binfo.bucket.get_key()); }; - return process_stale_instances(store, op_state, flusher, process_f); + return process_stale_instances(store, op_state, flusher, dpp, process_f); } int RGWBucketAdminOp::clear_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher) + RGWFormatterFlusher& flusher, + const DoutPrefixProvider *dpp) { - auto process_f = [](const bucket_instance_ls& lst, + auto process_f = [dpp](const bucket_instance_ls& lst, Formatter *formatter, - rgw::sal::RGWRadosStore *store){ + rgw::sal::RGWRadosStore *store) { for (const auto &binfo: lst) { - int ret = purge_bucket_instance(store, binfo); + int ret = purge_bucket_instance(store, binfo, dpp); if (ret == 0){ auto md_key = "bucket.instance:" + binfo.bucket.get_key(); - ret = store->ctl()->meta.mgr->remove(md_key, null_yield); + ret = store->ctl()->meta.mgr->remove(md_key, null_yield, dpp); } formatter->open_object_section("delete_status"); formatter->dump_string("bucket_instance", binfo.bucket.get_key()); @@ -1803,17 +1817,18 @@ int RGWBucketAdminOp::clear_stale_instances(rgw::sal::RGWRadosStore *store, } }; - return process_stale_instances(store, op_state, flusher, process_f); + return process_stale_instances(store, op_state, flusher, dpp, process_f); } static int fix_single_bucket_lc(rgw::sal::RGWRadosStore *store, const std::string& tenant_name, - const std::string& bucket_name) + const std::string& bucket_name, + const DoutPrefixProvider *dpp) { RGWBucketInfo bucket_info; map bucket_attrs; int ret = store->getRados()->get_bucket_info(store->svc(), tenant_name, bucket_name, - bucket_info, nullptr, null_yield, &bucket_attrs); + bucket_info, nullptr, null_yield, dpp, &bucket_attrs); if (ret < 0) { // TODO: Should we handle the case where the bucket could've been removed between // listing and fetching? @@ -1839,15 +1854,17 @@ static void format_lc_status(Formatter* formatter, static void process_single_lc_entry(rgw::sal::RGWRadosStore *store, Formatter *formatter, const std::string& tenant_name, - const std::string& bucket_name) + const std::string& bucket_name, + const DoutPrefixProvider *dpp) { - int ret = fix_single_bucket_lc(store, tenant_name, bucket_name); + int ret = fix_single_bucket_lc(store, tenant_name, bucket_name, dpp); format_lc_status(formatter, tenant_name, bucket_name, -ret); } int RGWBucketAdminOp::fix_lc_shards(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher) + RGWFormatterFlusher& flusher, + const DoutPrefixProvider *dpp) { std::string marker; void *handle; @@ -1858,7 +1875,7 @@ int RGWBucketAdminOp::fix_lc_shards(rgw::sal::RGWRadosStore *store, if (const std::string& bucket_name = op_state.get_bucket_name(); ! bucket_name.empty()) { const rgw_user user_id = op_state.get_user_id(); - process_single_lc_entry(store, formatter, user_id.tenant, bucket_name); + process_single_lc_entry(store, formatter, user_id.tenant, bucket_name, dpp); formatter->flush(cout); } else { int ret = store->ctl()->meta.mgr->list_keys_init("bucket", marker, &handle); @@ -1883,7 +1900,7 @@ int RGWBucketAdminOp::fix_lc_shards(rgw::sal::RGWRadosStore *store, } if (ret != -ENOENT) { for (const auto &key:keys) { auto [tenant_name, bucket_name] = split_tenant(key); - process_single_lc_entry(store, formatter, tenant_name, bucket_name); + process_single_lc_entry(store, formatter, tenant_name, bucket_name, dpp); } } formatter->flush(cout); // regularly flush every 1k entries @@ -1895,14 +1912,15 @@ int RGWBucketAdminOp::fix_lc_shards(rgw::sal::RGWRadosStore *store, } -static bool has_object_expired(rgw::sal::RGWRadosStore *store, +static bool has_object_expired(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucket_info, const rgw_obj_key& key, utime_t& delete_at) { rgw_obj obj(bucket_info.bucket, key); bufferlist delete_at_bl; - int ret = rgw_object_get_attr(store, bucket_info, obj, RGW_ATTR_DELETE_AT, delete_at_bl, null_yield); + int ret = rgw_object_get_attr(dpp, store, bucket_info, obj, RGW_ATTR_DELETE_AT, delete_at_bl, null_yield); if (ret < 0) { return false; // no delete at attr, proceed } @@ -1919,7 +1937,8 @@ static bool has_object_expired(rgw::sal::RGWRadosStore *store, return false; } -static int fix_bucket_obj_expiry(rgw::sal::RGWRadosStore *store, +static int fix_bucket_obj_expiry(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucket_info, RGWFormatterFlusher& flusher, bool dry_run) { @@ -1945,7 +1964,7 @@ static int fix_bucket_obj_expiry(rgw::sal::RGWRadosStore *store, do { std::vector objs; - int ret = list_op.list_objects(listing_max_entries, &objs, nullptr, + int ret = list_op.list_objects(dpp, listing_max_entries, &objs, nullptr, &is_truncated, null_yield); if (ret < 0) { lderr(store->ctx()) << "ERROR failed to list objects in the bucket" << dendl; @@ -1954,13 +1973,13 @@ static int fix_bucket_obj_expiry(rgw::sal::RGWRadosStore *store, for (const auto& obj : objs) { rgw_obj_key key(obj.key); utime_t delete_at; - if (has_object_expired(store, bucket_info, key, delete_at)) { + if (has_object_expired(dpp, store, bucket_info, key, delete_at)) { formatter->open_object_section("object_status"); formatter->dump_string("object", key.name); formatter->dump_stream("delete_at") << delete_at; if (!dry_run) { - ret = rgw_remove_object(store, bucket_info, bucket_info.bucket, key); + ret = rgw_remove_object(dpp, store, bucket_info, bucket_info.bucket, key); formatter->dump_int("status", ret); } @@ -1975,16 +1994,17 @@ static int fix_bucket_obj_expiry(rgw::sal::RGWRadosStore *store, int RGWBucketAdminOp::fix_obj_expiry(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher, bool dry_run) + RGWFormatterFlusher& flusher, + const DoutPrefixProvider *dpp, bool dry_run) { RGWBucket admin_bucket; - int ret = admin_bucket.init(store, op_state, null_yield); + int ret = admin_bucket.init(store, op_state, null_yield, dpp); if (ret < 0) { lderr(store->ctx()) << "failed to initialize bucket" << dendl; return ret; } - return fix_bucket_obj_expiry(store, admin_bucket.get_bucket_info(), flusher, dry_run); + return fix_bucket_obj_expiry(dpp, store, admin_bucket.get_bucket_info(), flusher, dry_run); } void RGWBucketCompleteInfo::dump(Formatter *f) const { @@ -2031,7 +2051,7 @@ public: return new RGWBucketEntryMetadataObject(be, objv, mtime); } - int do_get(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject **obj, optional_yield y) override { + int do_get(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject **obj, optional_yield y, const DoutPrefixProvider *dpp) override { RGWObjVersionTracker ot; RGWBucketEntryPoint be; @@ -2040,7 +2060,7 @@ public: RGWSI_Bucket_EP_Ctx ctx(op->ctx()); - int ret = svc.bucket->read_bucket_entrypoint_info(ctx, entry, &be, &ot, &mtime, &attrs, y); + int ret = svc.bucket->read_bucket_entrypoint_info(ctx, entry, &be, &ot, &mtime, &attrs, y, dpp); if (ret < 0) return ret; @@ -2055,17 +2075,18 @@ public: RGWMetadataObject *obj, RGWObjVersionTracker& objv_tracker, optional_yield y, + const DoutPrefixProvider *dpp, RGWMDLogSyncType type, bool from_remote_zone) override; int do_remove(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWObjVersionTracker& objv_tracker, - optional_yield y) override { + optional_yield y, const DoutPrefixProvider *dpp) override { RGWBucketEntryPoint be; real_time orig_mtime; RGWSI_Bucket_EP_Ctx ctx(op->ctx()); - int ret = svc.bucket->read_bucket_entrypoint_info(ctx, entry, &be, &objv_tracker, &orig_mtime, nullptr, y); + int ret = svc.bucket->read_bucket_entrypoint_info(ctx, entry, &be, &objv_tracker, &orig_mtime, nullptr, y, dpp); if (ret < 0) return ret; @@ -2074,12 +2095,12 @@ public: * it immediately and don't want to invalidate our cached objv_version or the bucket obj removal * will incorrectly fail. */ - ret = ctl.bucket->unlink_bucket(be.owner, be.bucket, y, false); + ret = ctl.bucket->unlink_bucket(be.owner, be.bucket, y, dpp, false); if (ret < 0) { lderr(svc.bucket->ctx()) << "could not unlink bucket=" << entry << " owner=" << be.owner << dendl; } - ret = svc.bucket->remove_bucket_entrypoint_info(ctx, entry, &objv_tracker, y); + ret = svc.bucket->remove_bucket_entrypoint_info(ctx, entry, &objv_tracker, y, dpp); if (ret < 0) { lderr(svc.bucket->ctx()) << "could not delete bucket=" << entry << dendl; } @@ -2119,21 +2140,22 @@ public: obj->get_ep().encode(*bl); } - int put_checked() override; - int put_post() override; + int put_checked(const DoutPrefixProvider *dpp) override; + int put_post(const DoutPrefixProvider *dpp) override; }; int RGWBucketMetadataHandler::do_put(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject *obj, RGWObjVersionTracker& objv_tracker, optional_yield y, + const DoutPrefixProvider *dpp, RGWMDLogSyncType type, bool from_remote_zone) { RGWMetadataHandlerPut_Bucket put_op(this, op, entry, obj, objv_tracker, y, type, from_remote_zone); - return do_put_operate(&put_op); + return do_put_operate(&put_op, dpp); } -int RGWMetadataHandlerPut_Bucket::put_checked() +int RGWMetadataHandlerPut_Bucket::put_checked(const DoutPrefixProvider *dpp) { RGWBucketEntryMetadataObject *orig_obj = static_cast(old_obj); @@ -2153,10 +2175,11 @@ int RGWMetadataHandlerPut_Bucket::put_checked() mtime, pattrs, &objv_tracker, - y); + y, + dpp); } -int RGWMetadataHandlerPut_Bucket::put_post() +int RGWMetadataHandlerPut_Bucket::put_post(const DoutPrefixProvider *dpp) { auto& be = obj->get_ep(); @@ -2164,9 +2187,9 @@ int RGWMetadataHandlerPut_Bucket::put_post() /* link bucket */ if (be.linked) { - ret = bhandler->ctl.bucket->link_bucket(be.owner, be.bucket, be.creation_time, y, false); + ret = bhandler->ctl.bucket->link_bucket(be.owner, be.bucket, be.creation_time, y, dpp, false); } else { - ret = bhandler->ctl.bucket->unlink_bucket(be.owner, be.bucket, y, false); + ret = bhandler->ctl.bucket->unlink_bucket(be.owner, be.bucket, y, dpp, false); } return ret; @@ -2238,7 +2261,7 @@ public: RGWArchiveBucketMetadataHandler() {} int do_remove(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWObjVersionTracker& objv_tracker, - optional_yield y) override { + optional_yield y, const DoutPrefixProvider *dpp) override { auto cct = svc.bucket->ctx(); RGWSI_Bucket_EP_Ctx ctx(op->ctx()); @@ -2257,7 +2280,7 @@ public: RGWBucketEntryPoint be; map attrs; - int ret = svc.bucket->read_bucket_entrypoint_info(ctx, entry, &be, &objv_tracker, &mtime, &attrs, y); + int ret = svc.bucket->read_bucket_entrypoint_info(ctx, entry, &be, &objv_tracker, &mtime, &attrs, y, dpp); if (ret < 0) { return ret; } @@ -2270,7 +2293,7 @@ public: ceph::real_time orig_mtime; RGWBucketInfo old_bi; - ret = ctl.bucket->read_bucket_instance_info(be.bucket, &old_bi, y, RGWBucketCtl::BucketInstance::GetParams() + ret = ctl.bucket->read_bucket_instance_info(be.bucket, &old_bi, y, dpp, RGWBucketCtl::BucketInstance::GetParams() .set_mtime(&orig_mtime) .set_attrs(&attrs_m)); if (ret < 0) { @@ -2306,7 +2329,7 @@ public: new_be.bucket.name = new_bucket_name; - ret = ctl.bucket->store_bucket_instance_info(be.bucket, new_bi, y, RGWBucketCtl::BucketInstance::PutParams() + ret = ctl.bucket->store_bucket_instance_info(be.bucket, new_bi, y, dpp, RGWBucketCtl::BucketInstance::PutParams() .set_exclusive(false) .set_mtime(orig_mtime) .set_attrs(&attrs_m) @@ -2322,7 +2345,7 @@ public: ot.generate_new_write_ver(cct); ret = svc.bucket->store_bucket_entrypoint_info(ctx, RGWSI_Bucket::get_entrypoint_meta_key(new_be.bucket), - new_be, true, mtime, &attrs, nullptr, y); + new_be, true, mtime, &attrs, nullptr, y, dpp); if (ret < 0) { ldout(cct, 0) << "ERROR: failed to put new bucket entrypoint for bucket=" << new_be.bucket << " ret=" << ret << dendl; return ret; @@ -2330,7 +2353,7 @@ public: /* link new bucket */ - ret = ctl.bucket->link_bucket(new_be.owner, new_be.bucket, new_be.creation_time, y, false); + ret = ctl.bucket->link_bucket(new_be.owner, new_be.bucket, new_be.creation_time, y, dpp, false); if (ret < 0) { ldout(cct, 0) << "ERROR: failed to link new bucket for bucket=" << new_be.bucket << " ret=" << ret << dendl; return ret; @@ -2338,7 +2361,7 @@ public: /* clean up old stuff */ - ret = ctl.bucket->unlink_bucket(be.owner, entry_bucket, y, false); + ret = ctl.bucket->unlink_bucket(be.owner, entry_bucket, y, dpp, false); if (ret < 0) { lderr(cct) << "could not unlink bucket=" << entry << " owner=" << be.owner << dendl; } @@ -2351,13 +2374,14 @@ public: ret = svc.bucket->remove_bucket_entrypoint_info(ctx, RGWSI_Bucket::get_entrypoint_meta_key(be.bucket), &objv_tracker, - y); + y, + dpp); if (ret < 0) { ldout(cct, 0) << "ERROR: failed to put new bucket entrypoint for bucket=" << new_be.bucket << " ret=" << ret << dendl; return ret; } - ret = ctl.bucket->remove_bucket_instance_info(be.bucket, old_bi, y); + ret = ctl.bucket->remove_bucket_instance_info(be.bucket, old_bi, y, dpp); if (ret < 0) { lderr(cct) << "could not delete bucket=" << entry << dendl; } @@ -2371,12 +2395,12 @@ public: int do_put(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject *obj, RGWObjVersionTracker& objv_tracker, - optional_yield y, + optional_yield y, const DoutPrefixProvider *dpp, RGWMDLogSyncType type, bool from_remote_zone) override { if (entry.find("-deleted-") != string::npos) { RGWObjVersionTracker ot; RGWMetadataObject *robj; - int ret = do_get(op, entry, &robj, y); + int ret = do_get(op, entry, &robj, y, dpp); if (ret != -ENOENT) { if (ret < 0) { return ret; @@ -2384,7 +2408,7 @@ public: ot.read_version = robj->get_version(); delete robj; - ret = do_remove(op, entry, ot, y); + ret = do_remove(op, entry, ot, y, dpp); if (ret < 0) { return ret; } @@ -2392,7 +2416,7 @@ public: } return RGWBucketMetadataHandler::do_put(op, entry, obj, - objv_tracker, y, type, from_remote_zone); + objv_tracker, y, dpp, type, from_remote_zone); } }; @@ -2402,12 +2426,14 @@ class RGWBucketInstanceMetadataHandler : public RGWBucketInstanceMetadataHandler const string& entry, RGWBucketCompleteInfo *bi, ceph::real_time *pmtime, - optional_yield y) { + optional_yield y, + const DoutPrefixProvider *dpp) { return svc.bucket->read_bucket_instance_info(ctx, entry, &bi->info, pmtime, &bi->attrs, - y); + y, + dpp); } public: @@ -2443,13 +2469,13 @@ public: return new RGWBucketInstanceMetadataObject(bci, objv, mtime); } - int do_get(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject **obj, optional_yield y) override { + int do_get(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject **obj, optional_yield y, const DoutPrefixProvider *dpp) override { RGWBucketCompleteInfo bci; real_time mtime; RGWSI_Bucket_BI_Ctx ctx(op->ctx()); - int ret = svc.bucket->read_bucket_instance_info(ctx, entry, &bci.info, &mtime, &bci.attrs, y); + int ret = svc.bucket->read_bucket_instance_info(ctx, entry, &bci.info, &mtime, &bci.attrs, y, dpp); if (ret < 0) return ret; @@ -2462,20 +2488,20 @@ public: int do_put(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject *_obj, RGWObjVersionTracker& objv_tracker, - optional_yield y, + optional_yield y, const DoutPrefixProvider *dpp, RGWMDLogSyncType sync_type, bool from_remote_zone) override; int do_remove(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWObjVersionTracker& objv_tracker, - optional_yield y) override { + optional_yield y, const DoutPrefixProvider *dpp) override { RGWBucketCompleteInfo bci; RGWSI_Bucket_BI_Ctx ctx(op->ctx()); - int ret = read_bucket_instance_entry(ctx, entry, &bci, nullptr, y); + int ret = read_bucket_instance_entry(ctx, entry, &bci, nullptr, y, dpp); if (ret < 0 && ret != -ENOENT) return ret; - return svc.bucket->remove_bucket_instance_info(ctx, entry, bci.info, &bci.info.objv_tracker, y); + return svc.bucket->remove_bucket_instance_info(ctx, entry, bci.info, &bci.info.objv_tracker, y, dpp); } int call(std::function f) { @@ -2515,8 +2541,8 @@ public: } int put_check() override; - int put_checked() override; - int put_post() override; + int put_checked(const DoutPrefixProvider *dpp) override; + int put_post(const DoutPrefixProvider *dpp) override; }; int RGWBucketInstanceMetadataHandler::do_put(RGWSI_MetaBackend_Handler::Op *op, @@ -2524,11 +2550,12 @@ int RGWBucketInstanceMetadataHandler::do_put(RGWSI_MetaBackend_Handler::Op *op, RGWMetadataObject *obj, RGWObjVersionTracker& objv_tracker, optional_yield y, + const DoutPrefixProvider *dpp, RGWMDLogSyncType type, bool from_remote_zone) { RGWMetadataHandlerPut_BucketInstance put_op(svc.bucket->ctx(), this, op, entry, obj, objv_tracker, y, type, from_remote_zone); - return do_put_operate(&put_op); + return do_put_operate(&put_op, dpp); } void init_default_bucket_layout(CephContext *cct, rgw::BucketLayout& layout, @@ -2617,7 +2644,7 @@ int RGWMetadataHandlerPut_BucketInstance::put_check() return 0; } -int RGWMetadataHandlerPut_BucketInstance::put_checked() +int RGWMetadataHandlerPut_BucketInstance::put_checked(const DoutPrefixProvider *dpp) { RGWBucketInstanceMetadataObject *orig_obj = static_cast(old_obj); @@ -2636,10 +2663,11 @@ int RGWMetadataHandlerPut_BucketInstance::put_checked() false, mtime, pattrs, - y); + y, + dpp); } -int RGWMetadataHandlerPut_BucketInstance::put_post() +int RGWMetadataHandlerPut_BucketInstance::put_post(const DoutPrefixProvider *dpp) { RGWBucketCompleteInfo& bci = obj->get_bci(); @@ -2657,7 +2685,7 @@ class RGWArchiveBucketInstanceMetadataHandler : public RGWBucketInstanceMetadata public: RGWArchiveBucketInstanceMetadataHandler() {} - int do_remove(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWObjVersionTracker& objv_tracker, optional_yield y) override { + int do_remove(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWObjVersionTracker& objv_tracker, optional_yield y, const DoutPrefixProvider *dpp) override { ldout(cct, 0) << "SKIP: bucket instance removal is not allowed on archive zone: bucket.instance:" << entry << dendl; return 0; } @@ -2677,7 +2705,8 @@ RGWBucketCtl::RGWBucketCtl(RGWSI_Zone *zone_svc, void RGWBucketCtl::init(RGWUserCtl *user_ctl, RGWBucketMetadataHandler *_bm_handler, RGWBucketInstanceMetadataHandler *_bmi_handler, - RGWDataChangesLog *datalog) + RGWDataChangesLog *datalog, + const DoutPrefixProvider *dpp) { ctl.user = user_ctl; @@ -2688,8 +2717,8 @@ void RGWBucketCtl::init(RGWUserCtl *user_ctl, bi_be_handler = bmi_handler->get_be_handler(); datalog->set_bucket_filter( - [this](const rgw_bucket& bucket, optional_yield y) { - return bucket_exports_data(bucket, y); + [this](const rgw_bucket& bucket, optional_yield y, const DoutPrefixProvider *dpp) { + return bucket_exports_data(bucket, y, dpp); }); } @@ -2704,7 +2733,7 @@ int RGWBucketCtl::call(std::function f) { int RGWBucketCtl::read_bucket_entrypoint_info(const rgw_bucket& bucket, RGWBucketEntryPoint *info, - optional_yield y, + optional_yield y, const DoutPrefixProvider *dpp, const Bucket::GetParams& params) { return bm_handler->call(params.bectx_params, [&](RGWSI_Bucket_EP_Ctx& ctx) { @@ -2715,6 +2744,7 @@ int RGWBucketCtl::read_bucket_entrypoint_info(const rgw_bucket& bucket, params.mtime, params.attrs, y, + dpp, params.cache_info, params.refresh_version); }); @@ -2723,6 +2753,7 @@ int RGWBucketCtl::read_bucket_entrypoint_info(const rgw_bucket& bucket, int RGWBucketCtl::store_bucket_entrypoint_info(const rgw_bucket& bucket, RGWBucketEntryPoint& info, optional_yield y, + const DoutPrefixProvider *dpp, const Bucket::PutParams& params) { return bm_handler->call([&](RGWSI_Bucket_EP_Ctx& ctx) { @@ -2733,25 +2764,29 @@ int RGWBucketCtl::store_bucket_entrypoint_info(const rgw_bucket& bucket, params.mtime, params.attrs, params.objv_tracker, - y); + y, + dpp); }); } int RGWBucketCtl::remove_bucket_entrypoint_info(const rgw_bucket& bucket, optional_yield y, + const DoutPrefixProvider *dpp, const Bucket::RemoveParams& params) { return bm_handler->call([&](RGWSI_Bucket_EP_Ctx& ctx) { return svc.bucket->remove_bucket_entrypoint_info(ctx, RGWSI_Bucket::get_entrypoint_meta_key(bucket), params.objv_tracker, - y); + y, + dpp); }); } int RGWBucketCtl::read_bucket_instance_info(const rgw_bucket& bucket, RGWBucketInfo *info, optional_yield y, + const DoutPrefixProvider *dpp, const BucketInstance::GetParams& params) { int ret = bmi_handler->call(params.bectx_params, [&](RGWSI_Bucket_BI_Ctx& ctx) { @@ -2761,6 +2796,7 @@ int RGWBucketCtl::read_bucket_instance_info(const rgw_bucket& bucket, params.mtime, params.attrs, y, + dpp, params.cache_info, params.refresh_version); }); @@ -2779,6 +2815,7 @@ int RGWBucketCtl::read_bucket_instance_info(const rgw_bucket& bucket, int RGWBucketCtl::read_bucket_info(const rgw_bucket& bucket, RGWBucketInfo *info, optional_yield y, + const DoutPrefixProvider *dpp, const BucketInstance::GetParams& params, RGWObjVersionTracker *ep_objv_tracker) { @@ -2789,7 +2826,7 @@ int RGWBucketCtl::read_bucket_info(const rgw_bucket& bucket, if (b->bucket_id.empty()) { ep.emplace(); - int r = read_bucket_entrypoint_info(*b, &(*ep), y, RGWBucketCtl::Bucket::GetParams() + int r = read_bucket_entrypoint_info(*b, &(*ep), y, dpp, RGWBucketCtl::Bucket::GetParams() .set_bectx_params(params.bectx_params) .set_objv_tracker(ep_objv_tracker)); if (r < 0) { @@ -2805,7 +2842,7 @@ int RGWBucketCtl::read_bucket_info(const rgw_bucket& bucket, info, params.mtime, params.attrs, - y, + y, dpp, params.cache_info, params.refresh_version); }); @@ -2825,6 +2862,7 @@ int RGWBucketCtl::do_store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, const rgw_bucket& bucket, RGWBucketInfo& info, optional_yield y, + const DoutPrefixProvider *dpp, const BucketInstance::PutParams& params) { if (params.objv_tracker) { @@ -2838,22 +2876,25 @@ int RGWBucketCtl::do_store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, params.exclusive, params.mtime, params.attrs, - y); + y, + dpp); } int RGWBucketCtl::store_bucket_instance_info(const rgw_bucket& bucket, RGWBucketInfo& info, optional_yield y, + const DoutPrefixProvider *dpp, const BucketInstance::PutParams& params) { return bmi_handler->call([&](RGWSI_Bucket_BI_Ctx& ctx) { - return do_store_bucket_instance_info(ctx, bucket, info, y, params); + return do_store_bucket_instance_info(ctx, bucket, info, y, dpp, params); }); } int RGWBucketCtl::remove_bucket_instance_info(const rgw_bucket& bucket, RGWBucketInfo& info, optional_yield y, + const DoutPrefixProvider *dpp, const BucketInstance::RemoveParams& params) { if (params.objv_tracker) { @@ -2865,7 +2906,8 @@ int RGWBucketCtl::remove_bucket_instance_info(const rgw_bucket& bucket, RGWSI_Bucket::get_bi_meta_key(bucket), info, &info.objv_tracker, - y); + y, + dpp); }); } @@ -2876,7 +2918,7 @@ int RGWBucketCtl::do_store_linked_bucket_info(RGWSI_Bucket_X_Ctx& ctx, obj_version *pep_objv, map *pattrs, bool create_entry_point, - optional_yield y) + optional_yield y, const DoutPrefixProvider *dpp) { bool create_head = !info.has_instance_obj || create_entry_point; @@ -2886,7 +2928,7 @@ int RGWBucketCtl::do_store_linked_bucket_info(RGWSI_Bucket_X_Ctx& ctx, orig_info, exclusive, mtime, pattrs, - y); + y, dpp); if (ret < 0) { return ret; } @@ -2915,7 +2957,8 @@ int RGWBucketCtl::do_store_linked_bucket_info(RGWSI_Bucket_X_Ctx& ctx, mtime, pattrs, &ot, - y); + y, + dpp); if (ret < 0) return ret; @@ -2923,7 +2966,8 @@ int RGWBucketCtl::do_store_linked_bucket_info(RGWSI_Bucket_X_Ctx& ctx, } int RGWBucketCtl::convert_old_bucket_info(RGWSI_Bucket_X_Ctx& ctx, const rgw_bucket& bucket, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { RGWBucketEntryPoint entry_point; real_time ep_mtime; @@ -2936,7 +2980,7 @@ int RGWBucketCtl::convert_old_bucket_info(RGWSI_Bucket_X_Ctx& ctx, int ret = svc.bucket->read_bucket_entrypoint_info(ctx.ep, RGWSI_Bucket::get_entrypoint_meta_key(bucket), - &entry_point, &ot, &ep_mtime, &attrs, y); + &entry_point, &ot, &ep_mtime, &attrs, y, dpp); if (ret < 0) { ldout(cct, 0) << "ERROR: get_bucket_entrypoint_info() returned " << ret << " bucket=" << bucket << dendl; return ret; @@ -2951,7 +2995,7 @@ int RGWBucketCtl::convert_old_bucket_info(RGWSI_Bucket_X_Ctx& ctx, ot.generate_new_write_ver(cct); - ret = do_store_linked_bucket_info(ctx, info, nullptr, false, ep_mtime, &ot.write_version, &attrs, true, y); + ret = do_store_linked_bucket_info(ctx, info, nullptr, false, ep_mtime, &ot.write_version, &attrs, true, y, dpp); if (ret < 0) { ldout(cct, 0) << "ERROR: failed to put_linked_bucket_info(): " << ret << dendl; return ret; @@ -2963,14 +3007,15 @@ int RGWBucketCtl::convert_old_bucket_info(RGWSI_Bucket_X_Ctx& ctx, int RGWBucketCtl::set_bucket_instance_attrs(RGWBucketInfo& bucket_info, map& attrs, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { return call([&](RGWSI_Bucket_X_Ctx& ctx) { rgw_bucket& bucket = bucket_info.bucket; if (!bucket_info.has_instance_obj) { /* an old bucket object, need to convert it */ - int ret = convert_old_bucket_info(ctx, bucket, y); + int ret = convert_old_bucket_info(ctx, bucket, y, dpp); if (ret < 0) { ldout(cct, 0) << "ERROR: failed converting old bucket info: " << ret << dendl; return ret; @@ -2981,6 +3026,7 @@ int RGWBucketCtl::set_bucket_instance_attrs(RGWBucketInfo& bucket_info, bucket, bucket_info, y, + dpp, BucketInstance::PutParams().set_attrs(&attrs) .set_objv_tracker(objv_tracker) .set_orig_info(&bucket_info)); @@ -2992,12 +3038,13 @@ int RGWBucketCtl::link_bucket(const rgw_user& user_id, const rgw_bucket& bucket, ceph::real_time creation_time, optional_yield y, + const DoutPrefixProvider *dpp, bool update_entrypoint, rgw_ep_info *pinfo) { return bm_handler->call([&](RGWSI_Bucket_EP_Ctx& ctx) { return do_link_bucket(ctx, user_id, bucket, creation_time, - update_entrypoint, pinfo, y); + update_entrypoint, pinfo, y, dpp); }); } @@ -3007,7 +3054,8 @@ int RGWBucketCtl::do_link_bucket(RGWSI_Bucket_EP_Ctx& ctx, ceph::real_time creation_time, bool update_entrypoint, rgw_ep_info *pinfo, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { int ret; @@ -3027,7 +3075,7 @@ int RGWBucketCtl::do_link_bucket(RGWSI_Bucket_EP_Ctx& ctx, meta_key, &ep, &rot, nullptr, &attrs, - y); + y, dpp); if (ret < 0 && ret != -ENOENT) { ldout(cct, 0) << "ERROR: store->get_bucket_entrypoint_info() returned: " << cpp_strerror(-ret) << dendl; @@ -3053,14 +3101,14 @@ int RGWBucketCtl::do_link_bucket(RGWSI_Bucket_EP_Ctx& ctx, ep.owner = user_id; ep.bucket = bucket; ret = svc.bucket->store_bucket_entrypoint_info( - ctx, meta_key, ep, false, real_time(), pattrs, &rot, y); + ctx, meta_key, ep, false, real_time(), pattrs, &rot, y, dpp); if (ret < 0) goto done_err; return 0; done_err: - int r = do_unlink_bucket(ctx, user_id, bucket, true, y); + int r = do_unlink_bucket(ctx, user_id, bucket, true, y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed unlinking bucket on error cleanup: " << cpp_strerror(-r) << dendl; @@ -3068,10 +3116,10 @@ done_err: return ret; } -int RGWBucketCtl::unlink_bucket(const rgw_user& user_id, const rgw_bucket& bucket, optional_yield y, bool update_entrypoint) +int RGWBucketCtl::unlink_bucket(const rgw_user& user_id, const rgw_bucket& bucket, optional_yield y, const DoutPrefixProvider *dpp, bool update_entrypoint) { return bm_handler->call([&](RGWSI_Bucket_EP_Ctx& ctx) { - return do_unlink_bucket(ctx, user_id, bucket, update_entrypoint, y); + return do_unlink_bucket(ctx, user_id, bucket, update_entrypoint, y, dpp); }); } @@ -3079,7 +3127,8 @@ int RGWBucketCtl::do_unlink_bucket(RGWSI_Bucket_EP_Ctx& ctx, const rgw_user& user_id, const rgw_bucket& bucket, bool update_entrypoint, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { int ret = ctl.user->remove_bucket(user_id, bucket, y); if (ret < 0) { @@ -3094,7 +3143,7 @@ int RGWBucketCtl::do_unlink_bucket(RGWSI_Bucket_EP_Ctx& ctx, RGWObjVersionTracker ot; map attrs; string meta_key = RGWSI_Bucket::get_entrypoint_meta_key(bucket); - ret = svc.bucket->read_bucket_entrypoint_info(ctx, meta_key, &ep, &ot, nullptr, &attrs, y); + ret = svc.bucket->read_bucket_entrypoint_info(ctx, meta_key, &ep, &ot, nullptr, &attrs, y, dpp); if (ret == -ENOENT) return 0; if (ret < 0) @@ -3109,18 +3158,19 @@ int RGWBucketCtl::do_unlink_bucket(RGWSI_Bucket_EP_Ctx& ctx, } ep.linked = false; - return svc.bucket->store_bucket_entrypoint_info(ctx, meta_key, ep, false, real_time(), &attrs, &ot, y); + return svc.bucket->store_bucket_entrypoint_info(ctx, meta_key, ep, false, real_time(), &attrs, &ot, y, dpp); } int RGWBucketCtl::set_acl(ACLOwner& owner, rgw_bucket& bucket, RGWBucketInfo& bucket_info, bufferlist& bl, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { // set owner and acl bucket_info.owner = owner.get_id(); std::map attrs{{RGW_ATTR_ACL, bl}}; - int r = store_bucket_instance_info(bucket, bucket_info, y, + int r = store_bucket_instance_info(bucket, bucket_info, y, dpp, BucketInstance::PutParams().set_attrs(&attrs)); if (r < 0) { cerr << "ERROR: failed to set bucket owner: " << cpp_strerror(-r) << std::endl; @@ -3133,7 +3183,7 @@ int RGWBucketCtl::set_acl(ACLOwner& owner, rgw_bucket& bucket, // TODO: remove RGWRados dependency for bucket listing int RGWBucketCtl::chown(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info, const rgw_user& user_id, const std::string& display_name, - const std::string& marker, optional_yield y) + const std::string& marker, optional_yield y, const DoutPrefixProvider *dpp) { RGWObjectCtx obj_ctx(store); std::vector objs; @@ -3154,7 +3204,7 @@ int RGWBucketCtl::chown(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_in do { objs.clear(); - int ret = list_op.list_objects(max_entries, &objs, &common_prefixes, &is_truncated, y); + int ret = list_op.list_objects(dpp, max_entries, &objs, &common_prefixes, &is_truncated, y); if (ret < 0) { ldout(store->ctx(), 0) << "ERROR: list objects failed: " << cpp_strerror(-ret) << dendl; return ret; @@ -3171,7 +3221,7 @@ int RGWBucketCtl::chown(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_in map attrs; read_op.params.attrs = &attrs; - ret = read_op.prepare(y); + ret = read_op.prepare(y, dpp); if (ret < 0){ ldout(store->ctx(), 0) << "ERROR: failed to read object " << obj.key.name << cpp_strerror(-ret) << dendl; continue; @@ -3213,7 +3263,7 @@ int RGWBucketCtl::chown(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_in encode(policy, bl); obj_ctx.set_atomic(r_obj); - ret = store->getRados()->set_attr(&obj_ctx, bucket_info, r_obj, RGW_ATTR_ACL, bl); + ret = store->getRados()->set_attr(dpp, &obj_ctx, bucket_info, r_obj, RGW_ATTR_ACL, bl); if (ret < 0) { ldout(store->ctx(), 0) << "ERROR: modify attr failed " << cpp_strerror(-ret) << dendl; return ret; @@ -3228,18 +3278,19 @@ int RGWBucketCtl::chown(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_in int RGWBucketCtl::read_bucket_stats(const rgw_bucket& bucket, RGWBucketEnt *result, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { return call([&](RGWSI_Bucket_X_Ctx& ctx) { - return svc.bucket->read_bucket_stats(ctx, bucket, result, y); + return svc.bucket->read_bucket_stats(ctx, bucket, result, y, dpp); }); } int RGWBucketCtl::read_buckets_stats(map& m, - optional_yield y) + optional_yield y, const DoutPrefixProvider *dpp) { return call([&](RGWSI_Bucket_X_Ctx& ctx) { - return svc.bucket->read_buckets_stats(ctx, m, y); + return svc.bucket->read_buckets_stats(ctx, m, y, dpp); }); } @@ -3264,10 +3315,11 @@ int RGWBucketCtl::sync_user_stats(const rgw_user& user_id, int RGWBucketCtl::get_sync_policy_handler(std::optional zone, std::optional bucket, RGWBucketSyncPolicyHandlerRef *phandler, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { int r = call([&](RGWSI_Bucket_X_Ctx& ctx) { - return svc.bucket_sync->get_policy_handler(ctx, zone, bucket, phandler, y); + return svc.bucket_sync->get_policy_handler(ctx, zone, bucket, phandler, y, dpp); }); if (r < 0) { ldout(cct, 20) << __func__ << "(): failed to get policy handler for bucket=" << bucket << " (r=" << r << ")" << dendl; @@ -3277,12 +3329,13 @@ int RGWBucketCtl::get_sync_policy_handler(std::optional zone, } int RGWBucketCtl::bucket_exports_data(const rgw_bucket& bucket, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { RGWBucketSyncPolicyHandlerRef handler; - int r = get_sync_policy_handler(std::nullopt, bucket, &handler, y); + int r = get_sync_policy_handler(std::nullopt, bucket, &handler, y, dpp); if (r < 0) { return r; } @@ -3291,12 +3344,12 @@ int RGWBucketCtl::bucket_exports_data(const rgw_bucket& bucket, } int RGWBucketCtl::bucket_imports_data(const rgw_bucket& bucket, - optional_yield y) + optional_yield y, const DoutPrefixProvider *dpp) { RGWBucketSyncPolicyHandlerRef handler; - int r = get_sync_policy_handler(std::nullopt, bucket, &handler, y); + int r = get_sync_policy_handler(std::nullopt, bucket, &handler, y, dpp); if (r < 0) { return r; } diff --git a/src/rgw/rgw_bucket.h b/src/rgw/rgw_bucket.h index 81d076bce5d91..6a62c631dfb9a 100644 --- a/src/rgw/rgw_bucket.h +++ b/src/rgw/rgw_bucket.h @@ -226,7 +226,8 @@ public: * Get all the buckets owned by a user and fill up an RGWUserBuckets with them. * Returns: 0 on success, -ERR# on failure. */ -extern int rgw_read_user_buckets(rgw::sal::RGWRadosStore *store, +extern int rgw_read_user_buckets(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, const rgw_user& user_id, rgw::sal::RGWBucketList& buckets, const string& marker, @@ -235,14 +236,14 @@ extern int rgw_read_user_buckets(rgw::sal::RGWRadosStore *store, bool need_stats, optional_yield y); -extern int rgw_remove_object(rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucket_info, const rgw_bucket& bucket, rgw_obj_key& key); +extern int rgw_remove_object(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, const RGWBucketInfo& bucket_info, const rgw_bucket& bucket, rgw_obj_key& key); extern int rgw_remove_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& bucket, int concurrent_max, optional_yield y); extern int rgw_object_get_attr(rgw::sal::RGWRadosStore* store, const RGWBucketInfo& bucket_info, const rgw_obj& obj, const char* attr_name, bufferlist& out_bl, optional_yield y); -extern void check_bad_user_bucket_mapping(rgw::sal::RGWRadosStore *store, const rgw_user& user_id, bool fix, optional_yield y); +extern void check_bad_user_bucket_mapping(rgw::sal::RGWRadosStore *store, const rgw_user& user_id, bool fix, optional_yield y, const DoutPrefixProvider *dpp); struct RGWBucketAdminOpState { rgw_user uid; @@ -348,12 +349,14 @@ class RGWBucket public: RGWBucket() : store(NULL), handle(NULL), failure(false) {} int init(rgw::sal::RGWRadosStore *storage, RGWBucketAdminOpState& op_state, optional_yield y, - std::string *err_msg = NULL, map *pattrs = NULL); + const DoutPrefixProvider *dpp, std::string *err_msg = NULL, map *pattrs = NULL); int check_bad_index_multipart(RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher, std::string *err_msg = NULL); + RGWFormatterFlusher& flusher, + const DoutPrefixProvider *dpp, std::string *err_msg = NULL); - int check_object_index(RGWBucketAdminOpState& op_state, + int check_object_index(const DoutPrefixProvider *dpp, + RGWBucketAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y, std::string *err_msg = NULL); @@ -363,17 +366,17 @@ public: map& calculated_stats, std::string *err_msg = NULL); - int link(RGWBucketAdminOpState& op_state, optional_yield y, + int link(RGWBucketAdminOpState& op_state, optional_yield y, const DoutPrefixProvider *dpp, map& attrs, std::string *err_msg = NULL); int chown(RGWBucketAdminOpState& op_state, const string& marker, - optional_yield y, std::string *err_msg = NULL); - int unlink(RGWBucketAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); - int set_quota(RGWBucketAdminOpState& op_state, std::string *err_msg = NULL); + optional_yield y, const DoutPrefixProvider *dpp, std::string *err_msg = NULL); + int unlink(RGWBucketAdminOpState& op_state, optional_yield y, const DoutPrefixProvider *dpp, std::string *err_msg = NULL); + int set_quota(RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, std::string *err_msg = NULL); - int remove_object(RGWBucketAdminOpState& op_state, std::string *err_msg = NULL); + int remove_object(const DoutPrefixProvider *dpp, RGWBucketAdminOpState& op_state, std::string *err_msg = NULL); int policy_bl_to_stream(bufferlist& bl, ostream& o); - int get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolicy& policy, optional_yield y); - int sync(RGWBucketAdminOpState& op_state, map *attrs, std::string *err_msg = NULL); + int get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolicy& policy, optional_yield y, const DoutPrefixProvider *dpp); + int sync(RGWBucketAdminOpState& op_state, map *attrs, const DoutPrefixProvider *dpp, std::string *err_msg = NULL); void clear_failure() { failure = false; } @@ -384,39 +387,41 @@ class RGWBucketAdminOp { public: static int get_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher); + RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp); static int get_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - RGWAccessControlPolicy& policy); + RGWAccessControlPolicy& policy, const DoutPrefixProvider *dpp); static int dump_s3_policy(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - ostream& os); + ostream& os, const DoutPrefixProvider *dpp); - static int unlink(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state); - static int link(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, string *err_msg = NULL); - static int chown(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const string& marker, string *err_msg = NULL); + static int unlink(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp); + static int link(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, string *err_msg = NULL); + static int chown(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const string& marker, const DoutPrefixProvider *dpp, string *err_msg = NULL); static int check_index(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher, optional_yield y); + RGWFormatterFlusher& flusher, optional_yield y, const DoutPrefixProvider *dpp); - static int remove_bucket(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, optional_yield y, bool bypass_gc = false, bool keep_index_consistent = true); - static int remove_object(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state); - static int info(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y); + static int remove_bucket(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, optional_yield y, + const DoutPrefixProvider *dpp, bool bypass_gc = false, bool keep_index_consistent = true); + static int remove_object(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp); + static int info(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y, const DoutPrefixProvider *dpp); static int limit_check(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const std::list& user_ids, RGWFormatterFlusher& flusher, optional_yield y, + const DoutPrefixProvider *dpp, bool warnings_only = false); - static int set_quota(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state); + static int set_quota(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp); static int list_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher); + RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp); static int clear_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher); + RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp); static int fix_lc_shards(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher); + RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp); static int fix_obj_expiry(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, - RGWFormatterFlusher& flusher, bool dry_run = false); + RGWFormatterFlusher& flusher, const DoutPrefixProvider *dpp, bool dry_run = false); - static int sync_bucket(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, string *err_msg = NULL); + static int sync_bucket(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, const DoutPrefixProvider *dpp, string *err_msg = NULL); }; struct rgw_ep_info { @@ -459,7 +464,8 @@ public: void init(RGWUserCtl *user_ctl, RGWBucketMetadataHandler *_bm_handler, RGWBucketInstanceMetadataHandler *_bmi_handler, - RGWDataChangesLog *datalog); + RGWDataChangesLog *datalog, + const DoutPrefixProvider *dpp); struct Bucket { struct GetParams { @@ -638,27 +644,33 @@ public: int read_bucket_entrypoint_info(const rgw_bucket& bucket, RGWBucketEntryPoint *info, optional_yield y, + const DoutPrefixProvider *dpp, const Bucket::GetParams& params = {}); int store_bucket_entrypoint_info(const rgw_bucket& bucket, RGWBucketEntryPoint& info, optional_yield y, + const DoutPrefixProvider *dpp, const Bucket::PutParams& params = {}); int remove_bucket_entrypoint_info(const rgw_bucket& bucket, optional_yield y, + const DoutPrefixProvider *dpp, const Bucket::RemoveParams& params = {}); /* bucket instance */ int read_bucket_instance_info(const rgw_bucket& bucket, RGWBucketInfo *info, optional_yield y, + const DoutPrefixProvider *dpp, const BucketInstance::GetParams& params = {}); int store_bucket_instance_info(const rgw_bucket& bucket, RGWBucketInfo& info, optional_yield y, + const DoutPrefixProvider *dpp, const BucketInstance::PutParams& params = {}); int remove_bucket_instance_info(const rgw_bucket& bucket, RGWBucketInfo& info, optional_yield y, + const DoutPrefixProvider *dpp, const BucketInstance::RemoveParams& params = {}); /* @@ -670,6 +682,7 @@ public: int read_bucket_info(const rgw_bucket& bucket, RGWBucketInfo *info, optional_yield y, + const DoutPrefixProvider *dpp, const BucketInstance::GetParams& params = {}, RGWObjVersionTracker *ep_objv_tracker = nullptr); @@ -677,34 +690,40 @@ public: int set_bucket_instance_attrs(RGWBucketInfo& bucket_info, map& attrs, RGWObjVersionTracker *objv_tracker, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); /* user/bucket */ int link_bucket(const rgw_user& user_id, const rgw_bucket& bucket, ceph::real_time creation_time, optional_yield y, + const DoutPrefixProvider *dpp, bool update_entrypoint = true, rgw_ep_info *pinfo = nullptr); int unlink_bucket(const rgw_user& user_id, const rgw_bucket& bucket, optional_yield y, + const DoutPrefixProvider *dpp, bool update_entrypoint = true); int chown(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info, const rgw_user& user_id, const std::string& display_name, - const std::string& marker, optional_yield y); + const std::string& marker, optional_yield y, const DoutPrefixProvider *dpp); int set_acl(ACLOwner& owner, rgw_bucket& bucket, - RGWBucketInfo& bucket_info, bufferlist& bl, optional_yield y); + RGWBucketInfo& bucket_info, bufferlist& bl, optional_yield y, + const DoutPrefixProvider *dpp); int read_buckets_stats(map& m, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); int read_bucket_stats(const rgw_bucket& bucket, RGWBucketEnt *result, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); /* quota related */ int sync_user_stats(const rgw_user& user_id, const RGWBucketInfo& bucket_info, @@ -715,21 +734,26 @@ public: int get_sync_policy_handler(std::optional zone, std::optional bucket, RGWBucketSyncPolicyHandlerRef *phandler, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); int bucket_exports_data(const rgw_bucket& bucket, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); int bucket_imports_data(const rgw_bucket& bucket, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); private: int convert_old_bucket_info(RGWSI_Bucket_X_Ctx& ctx, const rgw_bucket& bucket, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); int do_store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, const rgw_bucket& bucket, RGWBucketInfo& info, optional_yield y, + const DoutPrefixProvider *dpp, const BucketInstance::PutParams& params); int do_store_linked_bucket_info(RGWSI_Bucket_X_Ctx& ctx, @@ -739,7 +763,8 @@ private: obj_version *pep_objv, map *pattrs, bool create_entry_point, - optional_yield); + optional_yield, + const DoutPrefixProvider *dpp); int do_link_bucket(RGWSI_Bucket_EP_Ctx& ctx, const rgw_user& user, @@ -747,13 +772,15 @@ private: ceph::real_time creation_time, bool update_entrypoint, rgw_ep_info *pinfo, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); int do_unlink_bucket(RGWSI_Bucket_EP_Ctx& ctx, const rgw_user& user_id, const rgw_bucket& bucket, bool update_entrypoint, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); }; diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 21a6ac5790f2b..57765bbfe922c 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -387,7 +387,7 @@ struct str_len meta_prefixes[] = { STR_LEN_ENTRY("HTTP_X_AMZ"), STR_LEN_ENTRY("HTTP_X_ACCOUNT"), {NULL, 0} }; -void req_info::init_meta_info(bool *found_bad_meta) +void req_info::init_meta_info(const DoutPrefixProvider *dpp, bool *found_bad_meta) { x_meta_map.clear(); @@ -399,7 +399,7 @@ void req_info::init_meta_info(bool *found_bad_meta) int len = meta_prefixes[prefix_num].len; const char *p = header_name.c_str(); if (strncmp(p, prefix, len) == 0) { - dout(10) << "meta>> " << p << dendl; + ldpp_dout(dpp, 10) << "meta>> " << p << dendl; const char *name = p+len; /* skip the prefix */ int name_len = header_name.size() - len; @@ -431,7 +431,7 @@ void req_info::init_meta_info(bool *found_bad_meta) } } for (const auto& kv: x_meta_map) { - dout(10) << "x>> " << kv.first << ":" << rgw::crypt_sanitize::x_meta_map{kv.first, kv.second} << dendl; + ldpp_dout(dpp, 10) << "x>> " << kv.first << ":" << rgw::crypt_sanitize::x_meta_map{kv.first, kv.second} << dendl; } } @@ -788,7 +788,7 @@ int NameVal::parse() return ret; } -int RGWHTTPArgs::parse() +int RGWHTTPArgs::parse(const DoutPrefixProvider *dpp) { int pos = 0; bool end = false; @@ -820,7 +820,7 @@ int RGWHTTPArgs::parse() }); } string& val = nv.get_val(); - dout(10) << "name: " << name << " val: " << val << dendl; + ldpp_dout(dpp, 10) << "name: " << name << " val: " << val << dendl; append(name, val); } diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 4a96a86492760..3631273075de5 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -319,9 +319,9 @@ class RGWHTTPArgs { bool admin_subresource_added = false; public: RGWHTTPArgs() = default; - explicit RGWHTTPArgs(const std::string& s) { + explicit RGWHTTPArgs(const std::string& s, const DoutPrefixProvider *dpp) { set(s); - parse(); + parse(dpp); } /** Set the arguments; as received */ @@ -332,7 +332,7 @@ class RGWHTTPArgs { str = s; } /** parse the received arguments */ - int parse(); + int parse(const DoutPrefixProvider *dpp); void append(const std::string& name, const string& val); /** Get the value for a specific argument parameter */ const string& get(const std::string& name, bool *exists = NULL) const; @@ -1160,7 +1160,7 @@ struct req_info { req_info(CephContext *cct, const RGWEnv *env); void rebuild_from(req_info& src); - void init_meta_info(bool *found_bad_meta); + void init_meta_info(const DoutPrefixProvider *dpp, bool *found_bad_meta); }; typedef cls_rgw_obj_key rgw_obj_index_key; diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index 38217e1854c40..ee6e962ef3dda 100644 --- a/src/rgw/rgw_cr_rados.cc +++ b/src/rgw/rgw_cr_rados.cc @@ -581,9 +581,9 @@ int RGWAsyncGetBucketInstanceInfo::_send_request() int r; if (!bucket.bucket_id.empty()) { RGWSysObjectCtx obj_ctx = store->svc()->sysobj->init_obj_ctx(); - r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket, bucket_info, nullptr, &attrs, null_yield); + r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket, bucket_info, nullptr, &attrs, null_yield, dpp); } else { - r = store->ctl()->bucket->read_bucket_info(bucket, &bucket_info, null_yield, + r = store->ctl()->bucket->read_bucket_info(bucket, &bucket_info, null_yield, dpp, RGWBucketCtl::BucketInstance::GetParams().set_attrs(&attrs)); } if (r < 0) { @@ -738,7 +738,7 @@ int RGWAsyncRemoveObj::_send_request() RGWObjState *state; - int ret = store->getRados()->get_obj_state(&obj_ctx, bucket_info, obj, &state, null_yield); + int ret = store->getRados()->get_obj_state(dpp, &obj_ctx, bucket_info, obj, &state, null_yield); if (ret < 0) { ldout(store->ctx(), 20) << __func__ << "(): get_obj_state() obj=" << obj << " returned ret=" << ret << dendl; return ret; @@ -783,7 +783,7 @@ int RGWAsyncRemoveObj::_send_request() del_op.params.high_precision_time = true; del_op.params.zones_trace = &zones_trace; - ret = del_op.delete_obj(null_yield); + ret = del_op.delete_obj(null_yield, dpp); if (ret < 0) { ldout(store->ctx(), 20) << __func__ << "(): delete_obj() obj=" << obj << " returned ret=" << ret << dendl; } diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index ac267b618a7f3..4697c9379fc81 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -176,11 +176,13 @@ class RGWSimpleAsyncCR : public RGWSimpleCoroutine { P params; std::shared_ptr result; + const DoutPrefixProvider *dpp; class Request : public RGWAsyncRadosRequest { rgw::sal::RGWRadosStore *store; P params; std::shared_ptr result; + const DoutPrefixProvider *dpp; protected: int _send_request() override; public: @@ -188,21 +190,25 @@ class RGWSimpleAsyncCR : public RGWSimpleCoroutine { RGWAioCompletionNotifier *cn, rgw::sal::RGWRadosStore *_store, const P& _params, - std::shared_ptr& _result) : RGWAsyncRadosRequest(caller, cn), + std::shared_ptr& _result, + const DoutPrefixProvider *_dpp) : RGWAsyncRadosRequest(caller, cn), store(_store), params(_params), - result(_result) {} + result(_result), + dpp(_dpp) {} } *req{nullptr}; public: RGWSimpleAsyncCR(RGWAsyncRadosProcessor *_async_rados, rgw::sal::RGWRadosStore *_store, const P& _params, - std::shared_ptr& _result) : RGWSimpleCoroutine(_store->ctx()), + std::shared_ptr& _result, + const DoutPrefixProvider *_dpp) : RGWSimpleCoroutine(_store->ctx()), async_rados(_async_rados), store(_store), params(_params), - result(_result) {} + result(_result), + dpp(_dpp) {} ~RGWSimpleAsyncCR() override { request_cleanup(); @@ -219,7 +225,8 @@ class RGWSimpleAsyncCR : public RGWSimpleCoroutine { stack->create_completion_notifier(), store, params, - result); + result, + dpp); async_rados->queue(req); return 0; @@ -821,13 +828,15 @@ public: class RGWAsyncGetBucketInstanceInfo : public RGWAsyncRadosRequest { rgw::sal::RGWRadosStore *store; rgw_bucket bucket; + const DoutPrefixProvider *dpp; protected: int _send_request() override; public: RGWAsyncGetBucketInstanceInfo(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, - rgw::sal::RGWRadosStore *_store, const rgw_bucket& bucket) - : RGWAsyncRadosRequest(caller, cn), store(_store), bucket(bucket) {} + rgw::sal::RGWRadosStore *_store, const rgw_bucket& bucket, + const DoutPrefixProvider *dpp) + : RGWAsyncRadosRequest(caller, cn), store(_store), bucket(bucket), dpp(dpp) {} RGWBucketInfo bucket_info; map attrs; @@ -839,6 +848,7 @@ class RGWGetBucketInstanceInfoCR : public RGWSimpleCoroutine { rgw_bucket bucket; RGWBucketInfo *bucket_info; map *pattrs; + const DoutPrefixProvider *dpp; RGWAsyncGetBucketInstanceInfo *req{nullptr}; @@ -846,9 +856,9 @@ public: // rgw_bucket constructor RGWGetBucketInstanceInfoCR(RGWAsyncRadosProcessor *_async_rados, rgw::sal::RGWRadosStore *_store, const rgw_bucket& _bucket, RGWBucketInfo *_bucket_info, - map *_pattrs) + map *_pattrs, const DoutPrefixProvider *dpp) : RGWSimpleCoroutine(_store->ctx()), async_rados(_async_rados), store(_store), - bucket(_bucket), bucket_info(_bucket_info), pattrs(_pattrs) {} + bucket(_bucket), bucket_info(_bucket_info), pattrs(_pattrs), dpp(dpp) {} ~RGWGetBucketInstanceInfoCR() override { request_cleanup(); } @@ -860,7 +870,7 @@ public: } int send_request() override { - req = new RGWAsyncGetBucketInstanceInfo(this, stack->create_completion_notifier(), store, bucket); + req = new RGWAsyncGetBucketInstanceInfo(this, stack->create_completion_notifier(), store, bucket, dpp); async_rados->queue(req); return 0; } @@ -1127,6 +1137,7 @@ public: }; class RGWAsyncRemoveObj : public RGWAsyncRadosRequest { + const DoutPrefixProvider *dpp; rgw::sal::RGWRadosStore *store; rgw_zone_id source_zone; @@ -1146,7 +1157,8 @@ class RGWAsyncRemoveObj : public RGWAsyncRadosRequest { protected: int _send_request() override; public: - RGWAsyncRemoveObj(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, rgw::sal::RGWRadosStore *_store, + RGWAsyncRemoveObj(const DoutPrefixProvider *_dpp, RGWCoroutine *caller, RGWAioCompletionNotifier *cn, + rgw::sal::RGWRadosStore *_store, const rgw_zone_id& _source_zone, RGWBucketInfo& _bucket_info, const rgw_obj_key& _key, @@ -1157,7 +1169,7 @@ public: bool _delete_marker, bool _if_older, real_time& _timestamp, - rgw_zone_set* _zones_trace) : RGWAsyncRadosRequest(caller, cn), store(_store), + rgw_zone_set* _zones_trace) : RGWAsyncRadosRequest(caller, cn), dpp(_dpp), store(_store), source_zone(_source_zone), bucket_info(_bucket_info), key(_key), @@ -1178,6 +1190,7 @@ public: }; class RGWRemoveObjCR : public RGWSimpleCoroutine { + const DoutPrefixProvider *dpp; CephContext *cct; RGWAsyncRadosProcessor *async_rados; rgw::sal::RGWRadosStore *store; @@ -1200,7 +1213,7 @@ class RGWRemoveObjCR : public RGWSimpleCoroutine { rgw_zone_set *zones_trace; public: - RGWRemoveObjCR(RGWAsyncRadosProcessor *_async_rados, rgw::sal::RGWRadosStore *_store, + RGWRemoveObjCR(const DoutPrefixProvider *_dpp, RGWAsyncRadosProcessor *_async_rados, rgw::sal::RGWRadosStore *_store, const rgw_zone_id& _source_zone, RGWBucketInfo& _bucket_info, const rgw_obj_key& _key, @@ -1210,7 +1223,7 @@ public: string *_owner_display_name, bool _delete_marker, real_time *_timestamp, - rgw_zone_set *_zones_trace) : RGWSimpleCoroutine(_store->ctx()), cct(_store->ctx()), + rgw_zone_set *_zones_trace) : RGWSimpleCoroutine(_store->ctx()), dpp(_dpp), cct(_store->ctx()), async_rados(_async_rados), store(_store), source_zone(_source_zone), bucket_info(_bucket_info), @@ -1243,7 +1256,7 @@ public: } int send_request() override { - req = new RGWAsyncRemoveObj(this, stack->create_completion_notifier(), store, source_zone, bucket_info, + req = new RGWAsyncRemoveObj(dpp, this, stack->create_completion_notifier(), store, source_zone, bucket_info, key, owner, owner_display_name, versioned, versioned_epoch, delete_marker, del_if_older, timestamp, zones_trace); async_rados->queue(req); diff --git a/src/rgw/rgw_cr_tools.cc b/src/rgw/rgw_cr_tools.cc index 74497d5fc05e4..1db4d1f3c67fa 100644 --- a/src/rgw/rgw_cr_tools.cc +++ b/src/rgw/rgw_cr_tools.cc @@ -87,20 +87,20 @@ int RGWUserCreateCR::Request::_send_request() } RGWNullFlusher flusher; - return RGWUserAdminOp_User::create(store, op_state, flusher, null_yield); + return RGWUserAdminOp_User::create(dpp, store, op_state, flusher, null_yield); } template<> int RGWGetUserInfoCR::Request::_send_request() { - return store->ctl()->user->get_info_by_uid(params.user, result.get(), null_yield); + return store->ctl()->user->get_info_by_uid(dpp, params.user, result.get(), null_yield); } template<> int RGWGetBucketInfoCR::Request::_send_request() { return store->getRados()->get_bucket_info(store->svc(), params.tenant, params.bucket_name, - result->bucket_info, &result->mtime, null_yield, &result->attrs); + result->bucket_info, &result->mtime, null_yield, dpp, &result->attrs); } template<> @@ -128,7 +128,7 @@ int RGWBucketCreateLocalCR::Request::_send_request() map bucket_attrs; int ret = store->getRados()->get_bucket_info(store->svc(), user.tenant, bucket_name, - bucket_info, nullptr, null_yield, &bucket_attrs); + bucket_info, nullptr, null_yield, dpp, &bucket_attrs); if (ret < 0 && ret != -ENOENT) return ret; bool bucket_exists = (ret != -ENOENT); @@ -138,7 +138,7 @@ int RGWBucketCreateLocalCR::Request::_send_request() bucket_owner.set_id(user); bucket_owner.set_name(user_info->display_name); if (bucket_exists) { - ret = rgw_op_get_bucket_policy_from_attr(cct, store, bucket_info, + ret = rgw_op_get_bucket_policy_from_attr(dpp, cct, store, bucket_info, bucket_attrs, &old_policy, null_yield); if (ret >= 0) { if (old_policy.get_owner().get_id().compare(user) != 0) { @@ -194,7 +194,7 @@ int RGWBucketCreateLocalCR::Request::_send_request() placement_rule, bucket_info.swift_ver_location, pquota_info, attrs, info, nullptr, &ep_objv, creation_time, - pmaster_bucket, pmaster_num_shards, null_yield, true); + pmaster_bucket, pmaster_num_shards, null_yield, dpp, true); if (ret && ret != -EEXIST) @@ -210,10 +210,10 @@ int RGWBucketCreateLocalCR::Request::_send_request() bucket = info.bucket; } - ret = store->ctl()->bucket->link_bucket(user, bucket, info.creation_time, null_yield, false); + ret = store->ctl()->bucket->link_bucket(user, bucket, info.creation_time, null_yield, dpp, false); if (ret && !existed && ret != -EEXIST) { /* if it exists (or previously existed), don't remove it! */ - int r = store->ctl()->bucket->unlink_bucket(user, bucket, null_yield); + int r = store->ctl()->bucket->unlink_bucket(user, bucket, null_yield, dpp); if (r < 0) { ldout(cct, 0) << "WARNING: failed to unlink bucket: ret=" << r << dendl; } @@ -283,7 +283,8 @@ int RGWBucketGetSyncPolicyHandlerCR::Request::_send_request() int r = store->ctl()->bucket->get_sync_policy_handler(params.zone, params.bucket, &result->policy_handler, - null_yield); + null_yield, + dpp); if (r < 0) { lderr(cct) << "ERROR: " << __func__ << "(): get_sync_policy_handler() returned " << r << dendl; return r; diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 9efe9ec9ac707..67a8252e76024 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -2025,7 +2025,7 @@ class RGWUserPermHandler { int operate() override { auto user_ctl = sync_env->store->getRados()->ctl.user; - ret = user_ctl->get_info_by_uid(uid, &info->user_info, null_yield); + ret = user_ctl->get_info_by_uid(sync_env->dpp, uid, &info->user_info, null_yield); if (ret < 0) { return ret; } @@ -2038,7 +2038,7 @@ class RGWUserPermHandler { map uattrs; - ret = user_ctl->get_attrs_by_uid(uid, &uattrs, null_yield); + ret = user_ctl->get_attrs_by_uid(sync_env->dpp, uid, &uattrs, null_yield); if (ret == 0) { ret = RGWUserPermHandler::policy_from_attrs(sync_env->cct, uattrs, &info->user_acl); } @@ -2463,7 +2463,7 @@ RGWCoroutine *RGWDefaultDataSyncModule::remove_object(RGWDataSyncCtx *sc, rgw_bu real_time& mtime, bool versioned, uint64_t versioned_epoch, rgw_zone_set *zones_trace) { auto sync_env = sc->env; - return new RGWRemoveObjCR(sync_env->async_rados, sync_env->store, sc->source_zone, + return new RGWRemoveObjCR(sync_env->dpp, sync_env->async_rados, sync_env->store, sc->source_zone, sync_pipe.dest_bucket_info, key, versioned, versioned_epoch, NULL, NULL, false, &mtime, zones_trace); } @@ -2472,7 +2472,7 @@ RGWCoroutine *RGWDefaultDataSyncModule::create_delete_marker(RGWDataSyncCtx *sc, rgw_bucket_entry_owner& owner, bool versioned, uint64_t versioned_epoch, rgw_zone_set *zones_trace) { auto sync_env = sc->env; - return new RGWRemoveObjCR(sync_env->async_rados, sync_env->store, sc->source_zone, + return new RGWRemoveObjCR(sync_env->dpp, sync_env->async_rados, sync_env->store, sc->source_zone, sync_pipe.dest_bucket_info, key, versioned, versioned_epoch, &owner.id, &owner.display_name, true, &mtime, zones_trace); } @@ -2516,7 +2516,7 @@ RGWCoroutine *RGWArchiveDataSyncModule::sync_object(RGWDataSyncCtx *sc, rgw_buck (sync_pipe.dest_bucket_info.flags & BUCKET_VERSIONS_SUSPENDED)) { ldout(sc->cct, 0) << "SYNC_ARCHIVE: sync_object: enabling object versioning for archive bucket" << dendl; sync_pipe.dest_bucket_info.flags = (sync_pipe.dest_bucket_info.flags & ~BUCKET_VERSIONS_SUSPENDED) | BUCKET_VERSIONED; - int op_ret = sync_env->store->getRados()->put_bucket_instance_info(sync_pipe.dest_bucket_info, false, real_time(), NULL); + int op_ret = sync_env->store->getRados()->put_bucket_instance_info(sync_pipe.dest_bucket_info, false, real_time(), NULL, sync_env->dpp); if (op_ret < 0) { ldout(sc->cct, 0) << "SYNC_ARCHIVE: sync_object: error versioning archive bucket" << dendl; return NULL; @@ -2549,7 +2549,7 @@ RGWCoroutine *RGWArchiveDataSyncModule::create_delete_marker(RGWDataSyncCtx *sc, ldout(sc->cct, 0) << "SYNC_ARCHIVE: create_delete_marker: b=" << sync_pipe.info.source_bs.bucket << " k=" << key << " mtime=" << mtime << " versioned=" << versioned << " versioned_epoch=" << versioned_epoch << dendl; auto sync_env = sc->env; - return new RGWRemoveObjCR(sync_env->async_rados, sync_env->store, sc->source_zone, + return new RGWRemoveObjCR(sync_env->dpp, sync_env->async_rados, sync_env->store, sc->source_zone, sync_pipe.dest_bucket_info, key, versioned, versioned_epoch, &owner.id, &owner.display_name, true, &mtime, zones_trace); } @@ -4429,7 +4429,7 @@ public: int RGWSyncGetBucketInfoCR::operate() { reenter(this) { - yield call(new RGWGetBucketInstanceInfoCR(sync_env->async_rados, sync_env->store, bucket, pbucket_info, pattrs)); + yield call(new RGWGetBucketInstanceInfoCR(sync_env->async_rados, sync_env->store, bucket, pbucket_info, pattrs, sync_env->dpp)); if (retcode == -ENOENT) { /* bucket instance info has not been synced in yet, fetch it now */ yield { @@ -4450,7 +4450,7 @@ int RGWSyncGetBucketInfoCR::operate() return set_cr_error(retcode); } - yield call(new RGWGetBucketInstanceInfoCR(sync_env->async_rados, sync_env->store, bucket, pbucket_info, pattrs)); + yield call(new RGWGetBucketInstanceInfoCR(sync_env->async_rados, sync_env->store, bucket, pbucket_info, pattrs, sync_env->dpp)); } if (retcode < 0) { tn->log(0, SSTR("ERROR: failed to retrieve bucket info for bucket=" << bucket_str{bucket})); @@ -4547,7 +4547,8 @@ public: yield call(new RGWBucketGetSyncPolicyHandlerCR(sync_env->async_rados, sync_env->store, get_policy_params, - policy)); + policy, + sync_env->dpp)); if (retcode < 0 && retcode != -ENOENT) { return set_cr_error(retcode); @@ -5035,7 +5036,7 @@ int rgw_bucket_sync_status(const DoutPrefixProvider *dpp, if (!psource_bucket_info) { auto& bucket_ctl = store->getRados()->ctl.bucket; - int ret = bucket_ctl->read_bucket_info(source_bucket, &source_bucket_info, null_yield); + int ret = bucket_ctl->read_bucket_info(source_bucket, &source_bucket_info, null_yield, dpp); if (ret < 0) { ldpp_dout(dpp, 0) << "ERROR: failed to get bucket instance info: bucket=" << source_bucket << ": " << cpp_strerror(-ret) << dendl; return ret; diff --git a/src/rgw/rgw_datalog.cc b/src/rgw/rgw_datalog.cc index 5df3378319921..697a1b360e64a 100644 --- a/src/rgw/rgw_datalog.cc +++ b/src/rgw/rgw_datalog.cc @@ -681,24 +681,25 @@ int RGWDataChangesLog::get_log_shard_id(rgw_bucket& bucket, int shard_id) { return choose_oid(bs); } -bool RGWDataChangesLog::filter_bucket(const rgw_bucket& bucket, +bool RGWDataChangesLog::filter_bucket(const DoutPrefixProvider *dpp, + const rgw_bucket& bucket, optional_yield y) const { if (!bucket_filter) { return true; } - return bucket_filter(bucket, y); + return bucket_filter(bucket, y, dpp); } std::string RGWDataChangesLog::get_oid(int i) const { return be->get_oid(i); } -int RGWDataChangesLog::add_entry(const RGWBucketInfo& bucket_info, int shard_id) { +int RGWDataChangesLog::add_entry(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, int shard_id) { auto& bucket = bucket_info.bucket; - if (!filter_bucket(bucket, null_yield)) { + if (!filter_bucket(dpp, bucket, null_yield)) { return 0; } diff --git a/src/rgw/rgw_datalog.h b/src/rgw/rgw_datalog.h index 1e8652409ed18..1524a957ec2c8 100644 --- a/src/rgw/rgw_datalog.h +++ b/src/rgw/rgw_datalog.h @@ -205,10 +205,10 @@ class RGWDataChangesLog { void renew_stop(); std::thread renew_thread; - std::function bucket_filter; + std::function bucket_filter; int choose_oid(const rgw_bucket_shard& bs); bool going_down() const; - bool filter_bucket(const rgw_bucket& bucket, optional_yield y) const; + bool filter_bucket(const DoutPrefixProvider *dpp, const rgw_bucket& bucket, optional_yield y) const; int renew_entries(); public: @@ -219,7 +219,7 @@ public: int start(const RGWZone* _zone, const RGWZoneParams& zoneparams, RGWSI_Cls *cls_svc, librados::Rados* lr); - int add_entry(const RGWBucketInfo& bucket_info, int shard_id); + int add_entry(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, int shard_id); int get_log_shard_id(rgw_bucket& bucket, int shard_id); int list_entries(int shard, int max_entries, std::vector& entries, diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index 1a30f11cc55ae..77c6e80072022 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -1904,7 +1904,7 @@ namespace rgw { return op_ret; } /* exec_continue */ - int RGWWriteRequest::exec_finish() + int RGWWriteRequest::exec_finish(const DoutPrefixProvider *dpp) { buffer::list bl, aclbl, ux_key, ux_attrs; map::iterator iter; @@ -1973,7 +1973,7 @@ namespace rgw { attrbl.append(val.c_str(), val.size() + 1); } - op_ret = rgw_get_request_metadata(state->cct, state->info, attrs); + op_ret = rgw_get_request_metadata(dpp, state->cct, state->info, attrs); if (op_ret < 0) { goto done; } @@ -2034,7 +2034,8 @@ void rgwfile_version(int *major, int *minor, int *extra) sec_key, "/"); ceph_assert(new_fs); - rc = new_fs->authorize(rgwlib.get_store()); + const DoutPrefix dp(rgwlib.get_store()->ctx(), dout_subsys, "rgw mount: "); + rc = new_fs->authorize(&dp, rgwlib.get_store()); if (rc != 0) { delete new_fs; return -EINVAL; @@ -2065,7 +2066,8 @@ int rgw_mount2(librgw_t rgw, const char *uid, const char *acc_key, sec_key, root); ceph_assert(new_fs); - rc = new_fs->authorize(rgwlib.get_store()); + const DoutPrefix dp(rgwlib.get_store()->ctx(), dout_subsys, "rgw mount2: "); + rc = new_fs->authorize(&dp, rgwlib.get_store()); if (rc != 0) { delete new_fs; return -EINVAL; diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index a97f54f2873a5..baf115f3d3617 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -984,8 +984,8 @@ namespace rgw { (void) fh_lru.unref(fh, cohort::lru::FLAG_NONE); } - int authorize(rgw::sal::RGWRadosStore* store) { - int ret = store->ctl()->user->get_info_by_access_key(key.id, &user, null_yield); + int authorize(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore* store) { + int ret = store->ctl()->user->get_info_by_access_key(dpp, key.id, &user, null_yield); if (ret == 0) { RGWAccessKey* k = user.get_key(key.id); if (!k || (k->key != key.key)) @@ -1004,8 +1004,8 @@ namespace rgw { } if (token.valid() && (ldh->auth(token.id, token.key) == 0)) { /* try to store user if it doesn't already exist */ - if (store->ctl()->user->get_info_by_uid(rgw_user(token.id), &user, null_yield) < 0) { - int ret = store->ctl()->user->store_info(user, null_yield, + if (store->ctl()->user->get_info_by_uid(dpp, rgw_user(token.id), &user, null_yield) < 0) { + int ret = store->ctl()->user->store_info(dpp, user, null_yield, RGWUserCtl::PutParams() .set_exclusive(true)); if (ret < 0) { @@ -1297,10 +1297,10 @@ namespace rgw { RGWUserInfo* get_user() { return &user; } - void update_user() { + void update_user(const DoutPrefixProvider *dpp) { RGWUserInfo _user = user; auto user_ctl = rgwlib.get_store()->ctl()->user; - int ret = user_ctl->get_info_by_access_key(key.id, &user, null_yield); + int ret = user_ctl->get_info_by_access_key(dpp, key.id, &user, null_yield); if (ret != 0) user = _user; } @@ -2579,7 +2579,7 @@ public: int exec_start() override; int exec_continue() override; - int exec_finish() override; + int exec_finish(const DoutPrefixProvider *dpp) override; void send_response() override {} diff --git a/src/rgw/rgw_frontend.h b/src/rgw/rgw_frontend.h index e728a68292f63..08f6042a62ce6 100644 --- a/src/rgw/rgw_frontend.h +++ b/src/rgw/rgw_frontend.h @@ -18,7 +18,6 @@ #include "rgw_sal_rados.h" #define dout_context g_ceph_context -#define dout_subsys ceph_subsys_rgw namespace rgw::dmclock { class SyncScheduler; @@ -210,11 +209,25 @@ public: } }; /* RGWFCGXFrontend */ -class RGWLoadGenFrontend : public RGWProcessFrontend { +class RGWLoadGenFrontend : public RGWProcessFrontend, public DoutPrefixProvider { public: RGWLoadGenFrontend(RGWProcessEnv& pe, RGWFrontendConfig *_conf) : RGWProcessFrontend(pe, _conf) {} + CephContext *get_cct() const { + return env.store->ctx(); + } + + unsigned get_subsys() const + { + return ceph_subsys_rgw; + } + + std::ostream& gen_prefix(std::ostream& out) const + { + return out << "rgw loadgen frontend: "; + } + int init() override { int num_threads; conf->get_val("num_threads", g_conf()->rgw_thread_pool_size, &num_threads); @@ -234,7 +247,7 @@ public: rgw_user uid(uid_str); RGWUserInfo user_info; - int ret = env.store->ctl()->user->get_info_by_uid(uid, &user_info, null_yield); + int ret = env.store->ctl()->user->get_info_by_uid(this, uid, &user_info, null_yield); if (ret < 0) { derr << "ERROR: failed reading user info: uid=" << uid << " ret=" << ret << dendl; diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index dd1b9b1b4ccaf..f5520e12a9823 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -368,13 +368,13 @@ static bool obj_has_expired(CephContext *cct, ceph::real_time mtime, int days, return (timediff >= cmp); } -static bool pass_object_lock_check(rgw::sal::RGWStore* store, rgw::sal::RGWObject* obj, RGWObjectCtx& ctx) +static bool pass_object_lock_check(rgw::sal::RGWStore* store, rgw::sal::RGWObject* obj, RGWObjectCtx& ctx, const DoutPrefixProvider *dpp) { if (!obj->get_bucket()->get_info().obj_lock_enabled()) { return true; } std::unique_ptr read_op = obj->get_read_op(&ctx); - int ret = read_op->prepare(null_yield); + int ret = read_op->prepare(null_yield, dpp); if (ret < 0) { if (ret == -ENOENT) { return true; @@ -388,7 +388,7 @@ static bool pass_object_lock_check(rgw::sal::RGWStore* store, rgw::sal::RGWObjec try { decode(retention, iter->second); } catch (buffer::error& err) { - ldout(store->ctx(), 0) << "ERROR: failed to decode RGWObjectRetention" + ldpp_dout(dpp, 0) << "ERROR: failed to decode RGWObjectRetention" << dendl; return false; } @@ -403,7 +403,7 @@ static bool pass_object_lock_check(rgw::sal::RGWStore* store, rgw::sal::RGWObjec try { decode(obj_legal_hold, iter->second); } catch (buffer::error& err) { - ldout(store->ctx(), 0) << "ERROR: failed to decode RGWObjectLegalHold" + ldpp_dout(dpp, 0) << "ERROR: failed to decode RGWObjectLegalHold" << dendl; return false; } @@ -438,12 +438,12 @@ public: list_params.prefix = prefix; } - int init() { - return fetch(); + int init(const DoutPrefixProvider *dpp) { + return fetch(dpp); } - int fetch() { - int ret = bucket->list(list_params, 1000, list_results, null_yield); + int fetch(const DoutPrefixProvider *dpp) { + int ret = bucket->list(dpp, list_params, 1000, list_results, null_yield); if (ret < 0) { return ret; } @@ -457,7 +457,7 @@ public: std::this_thread::sleep_for(std::chrono::milliseconds(delay_ms)); } - bool get_obj(rgw_bucket_dir_entry **obj, + bool get_obj(const DoutPrefixProvider *dpp, rgw_bucket_dir_entry **obj, std::function fetch_barrier = []() { /* nada */}) { if (obj_iter == list_results.objs.end()) { @@ -467,7 +467,7 @@ public: } else { fetch_barrier(); list_params.marker = pre_obj.key; - int ret = fetch(); + int ret = fetch(dpp); if (ret < 0) { ldout(store->ctx(), 0) << "ERROR: list_op returned ret=" << ret << dendl; @@ -558,7 +558,7 @@ struct lc_op_ctx { }; /* lc_op_ctx */ -static int remove_expired_obj(lc_op_ctx& oc, bool remove_indeed) +static int remove_expired_obj(const DoutPrefixProvider *dpp, lc_op_ctx& oc, bool remove_indeed) { auto& store = oc.store; auto& bucket_info = oc.bucket->get_info(); @@ -590,7 +590,7 @@ static int remove_expired_obj(lc_op_ctx& oc, bool remove_indeed) ACLOwner bucket_owner; bucket_owner.set_id(bucket_info.owner); - return obj->delete_object(&oc.rctx, obj_owner, bucket_owner, meta.mtime, false, 0, + return obj->delete_object(dpp, &oc.rctx, obj_owner, bucket_owner, meta.mtime, false, 0, version_id, null_yield); } /* remove_expired_obj */ @@ -598,7 +598,7 @@ class LCOpAction { public: virtual ~LCOpAction() {} - virtual bool check(lc_op_ctx& oc, ceph::real_time *exp_time) { + virtual bool check(lc_op_ctx& oc, ceph::real_time *exp_time, const DoutPrefixProvider *dpp) { return false; } @@ -627,7 +627,7 @@ public: class LCOpFilter { public: virtual ~LCOpFilter() {} - virtual bool check(lc_op_ctx& oc) { + virtual bool check(const DoutPrefixProvider *dpp, lc_op_ctx& oc) { return false; } }; /* LCOpFilter */ @@ -846,7 +846,7 @@ int RGWLC::handle_multipart_expiration(rgw::sal::RGWBucket* target, return; } RGWObjectCtx rctx(store); - int ret = abort_multipart_upload(store, cct, &rctx, target->get_info(), mp_obj); + int ret = abort_multipart_upload(this, store, cct, &rctx, target->get_info(), mp_obj); if (ret == 0) { if (perfcounter) { perfcounter->inc(l_rgw_lc_abort_mpu, 1); @@ -887,7 +887,7 @@ int RGWLC::handle_multipart_expiration(rgw::sal::RGWBucket* target, params.prefix = prefix_iter->first; do { results.objs.clear(); - ret = target->list(params, 1000, results, null_yield); + ret = target->list(this, params, 1000, results, null_yield); if (ret < 0) { if (ret == (-ENOENT)) return 0; @@ -912,11 +912,11 @@ int RGWLC::handle_multipart_expiration(rgw::sal::RGWBucket* target, return 0; } -static int read_obj_tags(rgw::sal::RGWObject* obj, RGWObjectCtx& ctx, bufferlist& tags_bl) +static int read_obj_tags(const DoutPrefixProvider *dpp, rgw::sal::RGWObject* obj, RGWObjectCtx& ctx, bufferlist& tags_bl) { std::unique_ptr rop = obj->get_read_op(&ctx); - return rop->get_attr(RGW_ATTR_TAGS, tags_bl, null_yield); + return rop->get_attr(dpp, RGW_ATTR_TAGS, tags_bl, null_yield); } static bool is_valid_op(const lc_op& op) @@ -952,7 +952,7 @@ static inline bool has_all_tags(const lc_op& rule_action, return tag_count == rule_action.obj_tags->count(); } -static int check_tags(lc_op_ctx& oc, bool *skip) +static int check_tags(const DoutPrefixProvider *dpp, lc_op_ctx& oc, bool *skip) { auto& op = oc.op; @@ -960,7 +960,7 @@ static int check_tags(lc_op_ctx& oc, bool *skip) *skip = true; bufferlist tags_bl; - int ret = read_obj_tags(oc.obj.get(), oc.rctx, tags_bl); + int ret = read_obj_tags(dpp, oc.obj.get(), oc.rctx, tags_bl); if (ret < 0) { if (ret != -ENODATA) { ldout(oc.cct, 5) << "ERROR: read_obj_tags returned r=" @@ -992,7 +992,7 @@ static int check_tags(lc_op_ctx& oc, bool *skip) class LCOpFilter_Tags : public LCOpFilter { public: - bool check(lc_op_ctx& oc) override { + bool check(const DoutPrefixProvider *dpp, lc_op_ctx& oc) override { auto& o = oc.o; if (o.is_delete_marker()) { @@ -1001,7 +1001,7 @@ public: bool skip; - int ret = check_tags(oc, &skip); + int ret = check_tags(dpp, oc, &skip); if (ret < 0) { if (ret == -ENOENT) { return false; @@ -1020,10 +1020,10 @@ class LCOpAction_CurrentExpiration : public LCOpAction { public: LCOpAction_CurrentExpiration(op_env& env) {} - bool check(lc_op_ctx& oc, ceph::real_time *exp_time) override { + bool check(lc_op_ctx& oc, ceph::real_time *exp_time, const DoutPrefixProvider *dpp) override { auto& o = oc.o; if (!o.is_current()) { - ldout(oc.cct, 20) << __func__ << "(): key=" << o.key + ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key << ": not current, skipping " << oc.wq->thr_name() << dendl; return false; @@ -1032,12 +1032,12 @@ public: std::string nkn; if (oc.next_key_name) nkn = *oc.next_key_name; if (oc.next_has_same_name(o.key.name)) { - ldout(oc.cct, 7) << __func__ << "(): dm-check SAME: key=" << o.key + ldpp_dout(dpp, 7) << __func__ << "(): dm-check SAME: key=" << o.key << " next_key_name: %%" << nkn << "%% " << oc.wq->thr_name() << dendl; return false; } else { - ldout(oc.cct, 7) << __func__ << "(): dm-check DELE: key=" << o.key + ldpp_dout(dpp, 7) << __func__ << "(): dm-check DELE: key=" << o.key << " next_key_name: %%" << nkn << "%% " << oc.wq->thr_name() << dendl; *exp_time = real_clock::now(); @@ -1050,7 +1050,7 @@ public: auto& op = oc.op; if (op.expiration <= 0) { if (op.expiration_date == boost::none) { - ldout(oc.cct, 20) << __func__ << "(): key=" << o.key + ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key << ": no expiration set in rule, skipping " << oc.wq->thr_name() << dendl; return false; @@ -1062,7 +1062,7 @@ public: is_expired = obj_has_expired(oc.cct, mtime, op.expiration, exp_time); } - ldout(oc.cct, 20) << __func__ << "(): key=" << o.key << ": is_expired=" + ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key << ": is_expired=" << (int)is_expired << " " << oc.wq->thr_name() << dendl; return is_expired; @@ -1072,7 +1072,7 @@ public: auto& o = oc.o; int r; if (o.is_delete_marker()) { - r = remove_expired_obj(oc, true); + r = remove_expired_obj(oc.dpp, oc, true); if (r < 0) { ldout(oc.cct, 0) << "ERROR: current is-dm remove_expired_obj " << oc.bucket << ":" << o.key @@ -1085,7 +1085,7 @@ public: << " " << oc.wq->thr_name() << dendl; } else { /* ! o.is_delete_marker() */ - r = remove_expired_obj(oc, !oc.bucket->versioned()); + r = remove_expired_obj(oc.dpp, oc, !oc.bucket->versioned()); if (r < 0) { ldout(oc.cct, 0) << "ERROR: remove_expired_obj " << oc.bucket << ":" << o.key @@ -1109,10 +1109,10 @@ public: LCOpAction_NonCurrentExpiration(op_env& env) {} - bool check(lc_op_ctx& oc, ceph::real_time *exp_time) override { + bool check(lc_op_ctx& oc, ceph::real_time *exp_time, const DoutPrefixProvider *dpp) override { auto& o = oc.o; if (o.is_current()) { - ldout(oc.cct, 20) << __func__ << "(): key=" << o.key + ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key << ": current version, skipping " << oc.wq->thr_name() << dendl; return false; @@ -1122,17 +1122,17 @@ public: bool is_expired = obj_has_expired(oc.cct, oc.effective_mtime, expiration, exp_time); - ldout(oc.cct, 20) << __func__ << "(): key=" << o.key << ": is_expired=" + ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key << ": is_expired=" << is_expired << " " << oc.wq->thr_name() << dendl; return is_expired && - pass_object_lock_check(oc.store, oc.obj.get(), oc.rctx); + pass_object_lock_check(oc.store, oc.obj.get(), oc.rctx, dpp); } int process(lc_op_ctx& oc) { auto& o = oc.o; - int r = remove_expired_obj(oc, true); + int r = remove_expired_obj(oc.dpp, oc, true); if (r < 0) { ldout(oc.cct, 0) << "ERROR: remove_expired_obj (non-current expiration) " << oc.bucket << ":" << o.key @@ -1154,16 +1154,16 @@ class LCOpAction_DMExpiration : public LCOpAction { public: LCOpAction_DMExpiration(op_env& env) {} - bool check(lc_op_ctx& oc, ceph::real_time *exp_time) override { + bool check(lc_op_ctx& oc, ceph::real_time *exp_time, const DoutPrefixProvider *dpp) override { auto& o = oc.o; if (!o.is_delete_marker()) { - ldout(oc.cct, 20) << __func__ << "(): key=" << o.key + ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key << ": not a delete marker, skipping " << oc.wq->thr_name() << dendl; return false; } if (oc.next_has_same_name(o.key.name)) { - ldout(oc.cct, 20) << __func__ << "(): key=" << o.key + ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key << ": next is same object, skipping " << oc.wq->thr_name() << dendl; return false; @@ -1176,7 +1176,7 @@ public: int process(lc_op_ctx& oc) { auto& o = oc.o; - int r = remove_expired_obj(oc, true); + int r = remove_expired_obj(oc.dpp, oc, true); if (r < 0) { ldout(oc.cct, 0) << "ERROR: remove_expired_obj (delete marker expiration) " << oc.bucket << ":" << o.key @@ -1206,7 +1206,7 @@ public: LCOpAction_Transition(const transition_action& _transition) : transition(_transition) {} - bool check(lc_op_ctx& oc, ceph::real_time *exp_time) override { + bool check(lc_op_ctx& oc, ceph::real_time *exp_time, const DoutPrefixProvider *dpp) override { auto& o = oc.o; if (o.is_delete_marker()) { @@ -1221,7 +1221,7 @@ public: bool is_expired; if (transition.days < 0) { if (transition.date == boost::none) { - ldout(oc.cct, 20) << __func__ << "(): key=" << o.key + ldpp_dout(dpp, 20) << __func__ << "(): key=" << o.key << ": no transition day/date set in rule, skipping " << oc.wq->thr_name() << dendl; return false; @@ -1376,7 +1376,7 @@ int LCOpRule::process(rgw_bucket_dir_entry& o, for (auto& a : actions) { real_time action_exp; - if (a->check(ctx, &action_exp)) { + if (a->check(ctx, &action_exp, dpp)) { if (action_exp > exp) { exp = action_exp; selected = &a; @@ -1398,7 +1398,7 @@ int LCOpRule::process(rgw_bucket_dir_entry& o, bool cont = false; for (auto& f : filters) { - if (f->check(ctx)) { + if (f->check(dpp, ctx)) { cont = true; break; } @@ -1439,14 +1439,14 @@ int RGWLC::bucket_lc_process(string& shard_id, LCWorker* worker, string bucket_tenant = result[0]; string bucket_name = result[1]; string bucket_marker = result[2]; - int ret = store->get_bucket(nullptr, bucket_tenant, bucket_name, &bucket, null_yield); + int ret = store->get_bucket(this, nullptr, bucket_tenant, bucket_name, &bucket, null_yield); if (ret < 0) { ldpp_dout(this, 0) << "LC:get_bucket for " << bucket_name << " failed" << dendl; return ret; } - ret = bucket->get_bucket_info(null_yield); + ret = bucket->get_bucket_info(this, null_yield); if (ret < 0) { ldpp_dout(this, 0) << "LC:get_bucket_info for " << bucket_name << " failed" << dendl; @@ -1533,7 +1533,7 @@ int RGWLC::bucket_lc_process(string& shard_id, LCWorker* worker, LCObjsLister ol(store, bucket.get()); ol.set_prefix(prefix_iter->first); - ret = ol.init(); + ret = ol.init(this); if (ret < 0) { if (ret == (-ENOENT)) return 0; @@ -1545,7 +1545,7 @@ int RGWLC::bucket_lc_process(string& shard_id, LCWorker* worker, LCOpRule orule(oenv); orule.build(); // why can't ctor do it? rgw_bucket_dir_entry* o{nullptr}; - for (; ol.get_obj(&o /* , fetch_barrier */); ol.next()) { + for (; ol.get_obj(this, &o /* , fetch_barrier */); ol.next()) { orule.update(); std::tuple t1 = {orule, *o}; worker->workpool->enqueue(WorkItem{t1}); @@ -2009,7 +2009,7 @@ int RGWLC::set_bucket_config(RGWBucketInfo& bucket_info, int ret = store->ctl()->bucket->set_bucket_instance_attrs( - bucket_info, attrs, &bucket_info.objv_tracker, null_yield); + bucket_info, attrs, &bucket_info.objv_tracker, null_yield, this); if (ret < 0) return ret; @@ -2032,7 +2032,7 @@ int RGWLC::remove_bucket_config(RGWBucketInfo& bucket_info, attrs.erase(RGW_ATTR_LC); int ret = store->ctl()->bucket->set_bucket_instance_attrs( - bucket_info, attrs, &bucket_info.objv_tracker, null_yield); + bucket_info, attrs, &bucket_info.objv_tracker, null_yield, this); rgw_bucket& bucket = bucket_info.bucket; diff --git a/src/rgw/rgw_lib.h b/src/rgw/rgw_lib.h index 63f34cf3d7942..3f87859b6e98f 100644 --- a/src/rgw/rgw_lib.h +++ b/src/rgw/rgw_lib.h @@ -222,7 +222,7 @@ namespace rgw { virtual int execute() final { ceph_abort(); } virtual int exec_start() = 0; virtual int exec_continue() = 0; - virtual int exec_finish() = 0; + virtual int exec_finish(const DoutPrefixProvider *dpp) = 0; }; /* RGWLibContinuedReq */ diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index 391d56524393c..ccc70294882e7 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -327,8 +327,9 @@ int radosgw_Main(int argc, const char **argv) FCGX_Init(); #endif + const DoutPrefix dp(cct.get(), dout_subsys, "rgw main: "); rgw::sal::RGWRadosStore *store = - RGWStoreManager::get_storage(g_ceph_context, + RGWStoreManager::get_storage(&dp, g_ceph_context, g_conf()->rgw_enable_gc_threads, g_conf()->rgw_enable_lc_threads, g_conf()->rgw_enable_quota_threads, diff --git a/src/rgw/rgw_metadata.cc b/src/rgw/rgw_metadata.cc index be572ebc866a8..5de78f52a4ed1 100644 --- a/src/rgw/rgw_metadata.cc +++ b/src/rgw/rgw_metadata.cc @@ -306,16 +306,16 @@ public: return new RGWMetadataObject; } - int get(string& entry, RGWMetadataObject **obj, optional_yield y) override { + int get(string& entry, RGWMetadataObject **obj, optional_yield y, const DoutPrefixProvider *dpp) override { return -ENOTSUP; } int put(string& entry, RGWMetadataObject *obj, RGWObjVersionTracker& objv_tracker, - optional_yield y, RGWMDLogSyncType type, bool from_remote_zone) override { + optional_yield y, const DoutPrefixProvider *dpp, RGWMDLogSyncType type, bool from_remote_zone) override { return -ENOTSUP; } - int remove(string& entry, RGWObjVersionTracker& objv_tracker, optional_yield y) override { + int remove(string& entry, RGWObjVersionTracker& objv_tracker, optional_yield y, const DoutPrefixProvider *dpp) override { return -ENOTSUP; } @@ -323,6 +323,7 @@ public: const ceph::real_time& mtime, RGWObjVersionTracker *objv_tracker, optional_yield y, + const DoutPrefixProvider *dpp, RGWMDLogStatus op_type, std::function f) { return -ENOTSUP; @@ -407,9 +408,9 @@ RGWMetadataHandlerPut_SObj::RGWMetadataHandlerPut_SObj(RGWMetadataHandler_Generi RGWMetadataHandlerPut_SObj::~RGWMetadataHandlerPut_SObj() { } -int RGWMetadataHandlerPut_SObj::put_pre() +int RGWMetadataHandlerPut_SObj::put_pre(const DoutPrefixProvider *dpp) { - int ret = get(&old_obj); + int ret = get(&old_obj, dpp); if (ret < 0 && ret != -ENOENT) { return ret; } @@ -432,23 +433,23 @@ int RGWMetadataHandlerPut_SObj::put_pre() return 0; } -int RGWMetadataHandlerPut_SObj::put() +int RGWMetadataHandlerPut_SObj::put(const DoutPrefixProvider *dpp) { int ret = put_check(); if (ret != 0) { return ret; } - return put_checked(); + return put_checked(dpp); } -int RGWMetadataHandlerPut_SObj::put_checked() +int RGWMetadataHandlerPut_SObj::put_checked(const DoutPrefixProvider *dpp) { RGWSI_MBSObj_PutParams params(obj->get_pattrs(), obj->get_mtime()); encode_obj(¶ms.bl); - int ret = op->put(entry, params, &objv_tracker, y); + int ret = op->put(entry, params, &objv_tracker, y, dpp); if (ret < 0) { return ret; } @@ -456,19 +457,19 @@ int RGWMetadataHandlerPut_SObj::put_checked() return 0; } -int RGWMetadataHandler_GenericMetaBE::do_put_operate(Put *put_op) +int RGWMetadataHandler_GenericMetaBE::do_put_operate(Put *put_op, const DoutPrefixProvider *dpp) { - int r = put_op->put_pre(); + int r = put_op->put_pre(dpp); if (r != 0) { /* r can also be STATUS_NO_APPLY */ return r; } - r = put_op->put(); + r = put_op->put(dpp); if (r != 0) { return r; } - r = put_op->put_post(); + r = put_op->put_post(dpp); if (r != 0) { /* e.g., -error or STATUS_APPLIED */ return r; } @@ -476,25 +477,25 @@ int RGWMetadataHandler_GenericMetaBE::do_put_operate(Put *put_op) return 0; } -int RGWMetadataHandler_GenericMetaBE::get(string& entry, RGWMetadataObject **obj, optional_yield y) +int RGWMetadataHandler_GenericMetaBE::get(string& entry, RGWMetadataObject **obj, optional_yield y, const DoutPrefixProvider *dpp) { return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) { - return do_get(op, entry, obj, y); + return do_get(op, entry, obj, y, dpp); }); } int RGWMetadataHandler_GenericMetaBE::put(string& entry, RGWMetadataObject *obj, RGWObjVersionTracker& objv_tracker, - optional_yield y, RGWMDLogSyncType type, bool from_remote_zone) + optional_yield y, const DoutPrefixProvider *dpp, RGWMDLogSyncType type, bool from_remote_zone) { return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) { - return do_put(op, entry, obj, objv_tracker, y, type, from_remote_zone); + return do_put(op, entry, obj, objv_tracker, y, dpp, type, from_remote_zone); }); } -int RGWMetadataHandler_GenericMetaBE::remove(string& entry, RGWObjVersionTracker& objv_tracker, optional_yield y) +int RGWMetadataHandler_GenericMetaBE::remove(string& entry, RGWObjVersionTracker& objv_tracker, optional_yield y, const DoutPrefixProvider *dpp) { return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) { - return do_remove(op, entry, objv_tracker, y); + return do_remove(op, entry, objv_tracker, y, dpp); }); } @@ -502,6 +503,7 @@ int RGWMetadataHandler_GenericMetaBE::mutate(const string& entry, const ceph::real_time& mtime, RGWObjVersionTracker *objv_tracker, optional_yield y, + const DoutPrefixProvider *dpp, RGWMDLogStatus op_type, std::function f) { @@ -511,7 +513,8 @@ int RGWMetadataHandler_GenericMetaBE::mutate(const string& entry, params, objv_tracker, y, - f); + f, + dpp); }); } @@ -626,7 +629,7 @@ int RGWMetadataManager::find_handler(const string& metadata_key, RGWMetadataHand } -int RGWMetadataManager::get(string& metadata_key, Formatter *f, optional_yield y) +int RGWMetadataManager::get(string& metadata_key, Formatter *f, optional_yield y, const DoutPrefixProvider *dpp) { RGWMetadataHandler *handler; string entry; @@ -637,7 +640,7 @@ int RGWMetadataManager::get(string& metadata_key, Formatter *f, optional_yield y RGWMetadataObject *obj; - ret = handler->get(entry, &obj, y); + ret = handler->get(entry, &obj, y, dpp); if (ret < 0) { return ret; } @@ -660,6 +663,7 @@ int RGWMetadataManager::get(string& metadata_key, Formatter *f, optional_yield y int RGWMetadataManager::put(string& metadata_key, bufferlist& bl, optional_yield y, + const DoutPrefixProvider *dpp, RGWMDLogSyncType sync_type, bool from_remote_zone, obj_version *existing_version) @@ -701,7 +705,7 @@ int RGWMetadataManager::put(string& metadata_key, bufferlist& bl, return -EINVAL; } - ret = handler->put(entry, obj, objv_tracker, y, sync_type, from_remote_zone); + ret = handler->put(entry, obj, objv_tracker, y, dpp, sync_type, from_remote_zone); if (existing_version) { *existing_version = objv_tracker.read_version; } @@ -711,7 +715,7 @@ int RGWMetadataManager::put(string& metadata_key, bufferlist& bl, return ret; } -int RGWMetadataManager::remove(string& metadata_key, optional_yield y) +int RGWMetadataManager::remove(string& metadata_key, optional_yield y, const DoutPrefixProvider *dpp) { RGWMetadataHandler *handler; string entry; @@ -722,7 +726,7 @@ int RGWMetadataManager::remove(string& metadata_key, optional_yield y) } RGWMetadataObject *obj; - ret = handler->get(entry, &obj, y); + ret = handler->get(entry, &obj, y, dpp); if (ret < 0) { return ret; } @@ -730,13 +734,14 @@ int RGWMetadataManager::remove(string& metadata_key, optional_yield y) objv_tracker.read_version = obj->get_version(); delete obj; - return handler->remove(entry, objv_tracker, y); + return handler->remove(entry, objv_tracker, y, dpp); } int RGWMetadataManager::mutate(const string& metadata_key, const ceph::real_time& mtime, RGWObjVersionTracker *objv_tracker, optional_yield y, + const DoutPrefixProvider *dpp, RGWMDLogStatus op_type, std::function f) { @@ -748,7 +753,7 @@ int RGWMetadataManager::mutate(const string& metadata_key, return ret; } - return handler->mutate(entry, mtime, objv_tracker, y, op_type, f); + return handler->mutate(entry, mtime, objv_tracker, y, dpp, op_type, f); } int RGWMetadataManager::get_shard_id(const string& section, const string& entry, int *shard_id) diff --git a/src/rgw/rgw_metadata.h b/src/rgw/rgw_metadata.h index 97d4f0487606d..4e265ba02a624 100644 --- a/src/rgw/rgw_metadata.h +++ b/src/rgw/rgw_metadata.h @@ -69,18 +69,21 @@ public: virtual RGWMetadataObject *get_meta_obj(JSONObj *jo, const obj_version& objv, const ceph::real_time& mtime) = 0; - virtual int get(string& entry, RGWMetadataObject **obj, optional_yield) = 0; + virtual int get(string& entry, RGWMetadataObject **obj, optional_yield, const DoutPrefixProvider *dpp) = 0; virtual int put(string& entry, RGWMetadataObject *obj, RGWObjVersionTracker& objv_tracker, - optional_yield, RGWMDLogSyncType type, + optional_yield, + const DoutPrefixProvider *dpp, + RGWMDLogSyncType type, bool from_remote_zone) = 0; - virtual int remove(string& entry, RGWObjVersionTracker& objv_tracker, optional_yield) = 0; + virtual int remove(string& entry, RGWObjVersionTracker& objv_tracker, optional_yield, const DoutPrefixProvider *dpp) = 0; virtual int mutate(const string& entry, const ceph::real_time& mtime, RGWObjVersionTracker *objv_tracker, optional_yield y, + const DoutPrefixProvider *dpp, RGWMDLogStatus op_type, std::function f) = 0; @@ -108,12 +111,13 @@ public: protected: RGWSI_MetaBackend_Handler *be_handler; - virtual int do_get(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject **obj, optional_yield y) = 0; + virtual int do_get(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject **obj, optional_yield y, const DoutPrefixProvider *dpp) = 0; virtual int do_put(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject *obj, RGWObjVersionTracker& objv_tracker, optional_yield y, - RGWMDLogSyncType type, bool from_remote_zone) = 0; - virtual int do_put_operate(Put *put_op); - virtual int do_remove(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWObjVersionTracker& objv_tracker, optional_yield y) = 0; + const DoutPrefixProvider *dpp, RGWMDLogSyncType type, + bool from_remote_zone) = 0; + virtual int do_put_operate(Put *put_op, const DoutPrefixProvider *dpp); + virtual int do_remove(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWObjVersionTracker& objv_tracker, optional_yield y, const DoutPrefixProvider *dpp) = 0; public: RGWMetadataHandler_GenericMetaBE() {} @@ -139,8 +143,8 @@ public: optional_yield y; bool from_remote_zone{false}; - int get(RGWMetadataObject **obj) { - return handler->do_get(op, entry, obj, y); + int get(RGWMetadataObject **obj, const DoutPrefixProvider *dpp) { + return handler->do_get(op, entry, obj, y, dpp); } public: Put(RGWMetadataHandler_GenericMetaBE *_handler, RGWSI_MetaBackend_Handler::Op *_op, @@ -150,13 +154,13 @@ public: virtual ~Put() {} - virtual int put_pre() { + virtual int put_pre(const DoutPrefixProvider *dpp) { return 0; } - virtual int put() { + virtual int put(const DoutPrefixProvider *dpp) { return 0; } - virtual int put_post() { + virtual int put_post(const DoutPrefixProvider *dpp) { return 0; } virtual int finalize() { @@ -164,14 +168,15 @@ public: } }; - int get(string& entry, RGWMetadataObject **obj, optional_yield) override; - int put(string& entry, RGWMetadataObject *obj, RGWObjVersionTracker& objv_tracker, optional_yield, RGWMDLogSyncType type, bool from_remote_zone) override; - int remove(string& entry, RGWObjVersionTracker& objv_tracker, optional_yield) override; + int get(string& entry, RGWMetadataObject **obj, optional_yield, const DoutPrefixProvider *dpp) override; + int put(string& entry, RGWMetadataObject *obj, RGWObjVersionTracker& objv_tracker, optional_yield, const DoutPrefixProvider *dpp, RGWMDLogSyncType type, bool from_remote_zone) override; + int remove(string& entry, RGWObjVersionTracker& objv_tracker, optional_yield, const DoutPrefixProvider *dpp) override; int mutate(const string& entry, const ceph::real_time& mtime, RGWObjVersionTracker *objv_tracker, optional_yield y, + const DoutPrefixProvider *dpp, RGWMDLogStatus op_type, std::function f) override; @@ -233,17 +238,19 @@ public: RGWMetadataHandler *get_handler(const string& type); - int get(string& metadata_key, Formatter *f, optional_yield y); + int get(string& metadata_key, Formatter *f, optional_yield y, const DoutPrefixProvider *dpp); int put(string& metadata_key, bufferlist& bl, optional_yield y, + const DoutPrefixProvider *dpp, RGWMDLogSyncType sync_mode, bool from_remote_zone, obj_version *existing_version = NULL); - int remove(string& metadata_key, optional_yield y); + int remove(string& metadata_key, optional_yield y, const DoutPrefixProvider *dpp); int mutate(const string& metadata_key, const ceph::real_time& mtime, RGWObjVersionTracker *objv_tracker, optional_yield y, + const DoutPrefixProvider *dpp, RGWMDLogStatus op_type, std::function f); @@ -277,12 +284,12 @@ public: RGWMDLogSyncType type, bool from_remote_zone); ~RGWMetadataHandlerPut_SObj(); - int put_pre() override; - int put() override; + int put_pre(const DoutPrefixProvider *dpp) override; + int put(const DoutPrefixProvider *dpp) override; virtual int put_check() { return 0; } - virtual int put_checked(); + virtual int put_checked(const DoutPrefixProvider *dpp); virtual void encode_obj(bufferlist *bl) {} }; diff --git a/src/rgw/rgw_multi.cc b/src/rgw/rgw_multi.cc index 79284591b40ee..0bbf9ae4e90c6 100644 --- a/src/rgw/rgw_multi.cc +++ b/src/rgw/rgw_multi.cc @@ -200,7 +200,8 @@ int list_multipart_parts(rgw::sal::RGWRadosStore *store, struct req_state *s, next_marker, truncated, assume_unsorted); } -int abort_multipart_upload(rgw::sal::RGWRadosStore *store, CephContext *cct, +int abort_multipart_upload(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, CephContext *cct, RGWObjectCtx *obj_ctx, RGWBucketInfo& bucket_info, RGWMPObj& mp_obj) { @@ -235,7 +236,7 @@ int abort_multipart_upload(rgw::sal::RGWRadosStore *store, CephContext *cct, string oid = mp_obj.get_part(obj_iter->second.num); obj.init_ns(bucket_info.bucket, oid, RGW_OBJ_NS_MULTIPART); obj.index_hash_source = mp_obj.get_key(); - ret = store->getRados()->delete_obj(*obj_ctx, bucket_info, obj, 0); + ret = store->getRados()->delete_obj(dpp, *obj_ctx, bucket_info, obj, 0); if (ret < 0 && ret != -ENOENT) return ret; } else { @@ -278,7 +279,7 @@ int abort_multipart_upload(rgw::sal::RGWRadosStore *store, CephContext *cct, del_op.params.parts_accounted_size = parts_accounted_size; // and also remove the metadata obj - ret = del_op.delete_obj(null_yield); + ret = del_op.delete_obj(null_yield, dpp); if (ret < 0) { ldout(cct, 20) << __func__ << ": del_op.delete_obj returned " << ret << dendl; @@ -286,7 +287,8 @@ int abort_multipart_upload(rgw::sal::RGWRadosStore *store, CephContext *cct, return (ret == -ENOENT) ? -ERR_NO_SUCH_UPLOAD : ret; } -int list_bucket_multiparts(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info, +int list_bucket_multiparts(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info, const string& prefix, const string& marker, const string& delim, const int& max_uploads, @@ -303,11 +305,12 @@ int list_bucket_multiparts(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket list_op.params.ns = RGW_OBJ_NS_MULTIPART; list_op.params.filter = &mp_filter; - return(list_op.list_objects(max_uploads, objs, common_prefixes, is_truncated, null_yield)); + return(list_op.list_objects(dpp, max_uploads, objs, common_prefixes, is_truncated, null_yield)); } -int abort_bucket_multiparts(rgw::sal::RGWRadosStore *store, CephContext *cct, RGWBucketInfo& bucket_info, - string& prefix, string& delim) +int abort_bucket_multiparts(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, CephContext *cct, + RGWBucketInfo& bucket_info, string& prefix, string& delim) { constexpr int max = 1000; int ret, num_deleted = 0; @@ -317,7 +320,7 @@ int abort_bucket_multiparts(rgw::sal::RGWRadosStore *store, CephContext *cct, RG bool is_truncated; do { - ret = list_bucket_multiparts(store, bucket_info, prefix, marker, delim, + ret = list_bucket_multiparts(dpp, store, bucket_info, prefix, marker, delim, max, &objs, nullptr, &is_truncated); if (ret < 0) { ldout(store->ctx(), 0) << __func__ << @@ -337,7 +340,7 @@ int abort_bucket_multiparts(rgw::sal::RGWRadosStore *store, CephContext *cct, RG rgw_obj_key key(obj.key); if (!mp.from_meta(key.name)) continue; - ret = abort_multipart_upload(store, cct, &obj_ctx, bucket_info, mp); + ret = abort_multipart_upload(dpp, store, cct, &obj_ctx, bucket_info, mp); if (ret < 0) { // we're doing a best-effort; if something cannot be found, // log it and keep moving forward diff --git a/src/rgw/rgw_multi.h b/src/rgw/rgw_multi.h index 5f8fa11b336a5..4b6cad74c5225 100644 --- a/src/rgw/rgw_multi.h +++ b/src/rgw/rgw_multi.h @@ -123,10 +123,11 @@ extern int list_multipart_parts(rgw::sal::RGWRadosStore *store, struct req_state int *next_marker, bool *truncated, bool assume_unsorted = false); -extern int abort_multipart_upload(rgw::sal::RGWRadosStore *store, CephContext *cct, RGWObjectCtx *obj_ctx, +extern int abort_multipart_upload(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, CephContext *cct, RGWObjectCtx *obj_ctx, RGWBucketInfo& bucket_info, RGWMPObj& mp_obj); -extern int list_bucket_multiparts(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info, +extern int list_bucket_multiparts(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_info, const string& prefix, const string& marker, const string& delim, @@ -134,6 +135,6 @@ extern int list_bucket_multiparts(rgw::sal::RGWRadosStore *store, RGWBucketInfo& vector *objs, map *common_prefixes, bool *is_truncated); -extern int abort_bucket_multiparts(rgw::sal::RGWRadosStore *store, CephContext *cct, RGWBucketInfo& bucket_info, +extern int abort_bucket_multiparts(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, CephContext *cct, RGWBucketInfo& bucket_info, string& prefix, string& delim); #endif diff --git a/src/rgw/rgw_notify.cc b/src/rgw/rgw_notify.cc index b2e114623bf50..5d6b1759f4f7d 100644 --- a/src/rgw/rgw_notify.cc +++ b/src/rgw/rgw_notify.cc @@ -46,7 +46,7 @@ WRITE_CLASS_ENCODER(event_entry_t) using queues_t = std::set; -class Manager { +class Manager : public DoutPrefixProvider { const size_t max_queue_size; const uint32_t queues_update_period_ms; const uint32_t queues_update_retry_ms; @@ -65,6 +65,10 @@ class Manager { const std::string Q_LIST_OBJECT_NAME = "queues_list_object"; + CephContext *get_cct() const override { return cct; } + unsigned get_subsys() const override { return dout_subsys; } + std::ostream& gen_prefix(std::ostream& out) const override { return out << "rgw notify: "; } + // read the list of queues from the queue list object int read_queue_list(queues_t& queues, optional_yield y) { constexpr auto max_chunk = 1024U; @@ -82,7 +86,7 @@ class Manager { } if (ret < 0) { // TODO: do we need to check on rval as well as ret? - ldout(cct, 1) << "ERROR: failed to read queue list. error: " << ret << dendl; + ldpp_dout(this, 1) << "ERROR: failed to read queue list. error: " << ret << dendl; return ret; } queues.merge(queues_chunk); @@ -154,29 +158,29 @@ class Manager { try { decode(event_entry, iter); } catch (buffer::error& err) { - ldout(cct, 5) << "WARNING: failed to decode entry. error: " << err.what() << dendl; + ldpp_dout(this, 5) << "WARNING: failed to decode entry. error: " << err.what() << dendl; return false; } try { // TODO move endpoint creation to queue level const auto push_endpoint = RGWPubSubEndpoint::create(event_entry.push_endpoint, event_entry.arn_topic, - RGWHTTPArgs(event_entry.push_endpoint_args), + RGWHTTPArgs(event_entry.push_endpoint_args, this), cct); - ldout(cct, 20) << "INFO: push endpoint created: " << event_entry.push_endpoint << + ldpp_dout(this, 20) << "INFO: push endpoint created: " << event_entry.push_endpoint << " for entry: " << entry.marker << dendl; const auto ret = push_endpoint->send_to_completion_async(cct, event_entry.event, optional_yield(io_context, yield)); if (ret < 0) { - ldout(cct, 5) << "WARNING: push entry: " << entry.marker << " to endpoint: " << event_entry.push_endpoint + ldpp_dout(this, 5) << "WARNING: push entry: " << entry.marker << " to endpoint: " << event_entry.push_endpoint << " failed. error: " << ret << " (will retry)" << dendl; return false; } else { - ldout(cct, 20) << "INFO: push entry: " << entry.marker << " to endpoint: " << event_entry.push_endpoint + ldpp_dout(this, 20) << "INFO: push entry: " << entry.marker << " to endpoint: " << event_entry.push_endpoint << " ok" << dendl; if (perfcounter) perfcounter->inc(l_rgw_pubsub_push_ok); return true; } } catch (const RGWPubSubEndpoint::configuration_error& e) { - ldout(cct, 5) << "WARNING: failed to create push endpoint: " + ldpp_dout(this, 5) << "WARNING: failed to create push endpoint: " << event_entry.push_endpoint << " for entry: " << entry.marker << ". error: " << e.what() << " (will retry) " << dendl; return false; } @@ -185,7 +189,7 @@ class Manager { // clean stale reservation from queue void cleanup_queue(const std::string& queue_name, spawn::yield_context yield) { while (true) { - ldout(cct, 20) << "INFO: trying to perform stale reservation cleanup for queue: " << queue_name << dendl; + ldpp_dout(this, 20) << "INFO: trying to perform stale reservation cleanup for queue: " << queue_name << dendl; const auto now = ceph::coarse_real_time::clock::now(); const auto stale_time = now - std::chrono::seconds(stale_reservations_period_s); librados::ObjectWriteOperation op; @@ -199,16 +203,16 @@ class Manager { auto ret = rgw_rados_operate(rados_ioctx, queue_name, &op, optional_yield(io_context, yield)); if (ret == -ENOENT) { // queue was deleted - ldout(cct, 5) << "INFO: queue: " + ldpp_dout(this, 5) << "INFO: queue: " << queue_name << ". was removed. cleanup will stop" << dendl; return; } if (ret == -EBUSY) { - ldout(cct, 5) << "WARNING: queue: " << queue_name << " ownership moved to another daemon. processing will stop" << dendl; + ldpp_dout(this, 5) << "WARNING: queue: " << queue_name << " ownership moved to another daemon. processing will stop" << dendl; return; } if (ret < 0) { - ldout(cct, 5) << "WARNING: failed to cleanup stale reservation from queue and/or lock queue: " << queue_name + ldpp_dout(this, 5) << "WARNING: failed to cleanup stale reservation from queue and/or lock queue: " << queue_name << ". error: " << ret << dendl; } Timer timer(io_context); @@ -258,22 +262,22 @@ class Manager { auto ret = rgw_rados_operate(rados_ioctx, queue_name, &op, nullptr, optional_yield(io_context, yield)); if (ret == -ENOENT) { // queue was deleted - ldout(cct, 5) << "INFO: queue: " + ldpp_dout(this, 5) << "INFO: queue: " << queue_name << ". was removed. processing will stop" << dendl; return; } if (ret == -EBUSY) { - ldout(cct, 5) << "WARNING: queue: " << queue_name << " ownership moved to another daemon. processing will stop" << dendl; + ldpp_dout(this, 5) << "WARNING: queue: " << queue_name << " ownership moved to another daemon. processing will stop" << dendl; return; } if (ret < 0) { - ldout(cct, 5) << "WARNING: failed to get list of entries in queue and/or lock queue: " + ldpp_dout(this, 5) << "WARNING: failed to get list of entries in queue and/or lock queue: " << queue_name << ". error: " << ret << " (will retry)" << dendl; continue; } ret = cls_2pc_queue_list_entries_result(obl, entries, &truncated, end_marker); if (ret < 0) { - ldout(cct, 5) << "WARNING: failed to parse list of entries in queue: " + ldpp_dout(this, 5) << "WARNING: failed to parse list of entries in queue: " << queue_name << ". error: " << ret << " (will retry)" << dendl; continue; } @@ -284,7 +288,7 @@ class Manager { continue; } // log when queue is not idle - ldout(cct, 20) << "INFO: found: " << total_entries << " entries in: " << queue_name << + ldpp_dout(this, 20) << "INFO: found: " << total_entries << " entries in: " << queue_name << ". end marker is: " << end_marker << dendl; is_idle = false; @@ -301,17 +305,17 @@ class Manager { spawn::spawn(yield, [this, &queue_name, entry_idx, total_entries, &end_marker, &remove_entries, &has_error, &waiter, entry](spawn::yield_context yield) { const auto token = waiter.make_token(); if (process_entry(entry, yield)) { - ldout(cct, 20) << "INFO: processing of entry: " << + ldpp_dout(this, 20) << "INFO: processing of entry: " << entry.marker << " (" << entry_idx << "/" << total_entries << ") from: " << queue_name << " ok" << dendl; remove_entries = true; } else { if (set_min_marker(end_marker, entry.marker) < 0) { - ldout(cct, 1) << "ERROR: cannot determin minimum between malformed markers: " << end_marker << ", " << entry.marker << dendl; + ldpp_dout(this, 1) << "ERROR: cannot determin minimum between malformed markers: " << end_marker << ", " << entry.marker << dendl; } else { - ldout(cct, 20) << "INFO: new end marker for removal: " << end_marker << " from: " << queue_name << dendl; + ldpp_dout(this, 20) << "INFO: new end marker for removal: " << end_marker << " from: " << queue_name << dendl; } has_error = true; - ldout(cct, 20) << "INFO: processing of entry: " << + ldpp_dout(this, 20) << "INFO: processing of entry: " << entry.marker << " (" << entry_idx << "/" << total_entries << ") from: " << queue_name << " failed" << dendl; } }); @@ -334,19 +338,19 @@ class Manager { const auto ret = rgw_rados_operate(rados_ioctx, queue_name, &op, optional_yield(io_context, yield)); if (ret == -ENOENT) { // queue was deleted - ldout(cct, 5) << "INFO: queue: " + ldpp_dout(this, 5) << "INFO: queue: " << queue_name << ". was removed. processing will stop" << dendl; return; } if (ret == -EBUSY) { - ldout(cct, 5) << "WARNING: queue: " << queue_name << " ownership moved to another daemon. processing will stop" << dendl; + ldpp_dout(this, 5) << "WARNING: queue: " << queue_name << " ownership moved to another daemon. processing will stop" << dendl; return; } if (ret < 0) { - ldout(cct, 1) << "ERROR: failed to remove entries and/or lock queue up to: " << end_marker << " from queue: " + ldpp_dout(this, 1) << "ERROR: failed to remove entries and/or lock queue up to: " << end_marker << " from queue: " << queue_name << ". error: " << ret << dendl; } else { - ldout(cct, 20) << "INFO: removed entries up to: " << end_marker << " from queue: " + ldpp_dout(this, 20) << "INFO: removed entries up to: " << end_marker << " from queue: " << queue_name << dendl; } } @@ -378,7 +382,7 @@ class Manager { std::chrono::milliseconds(duration_jitter(rnd_gen)); timer.expires_from_now(duration); const auto tp = ceph::coarse_real_time::clock::to_time_t(ceph::coarse_real_time::clock::now() + duration); - ldout(cct, 20) << "INFO: next queues processing will happen at: " << std::ctime(&tp) << dendl; + ldpp_dout(this, 20) << "INFO: next queues processing will happen at: " << std::ctime(&tp) << dendl; boost::system::error_code ec; timer.async_wait(yield[ec]); @@ -407,24 +411,24 @@ class Manager { ret = rgw_rados_operate(rados_ioctx, queue_name, &op, optional_yield(io_context, yield)); if (ret == -EBUSY) { // lock is already taken by another RGW - ldout(cct, 20) << "INFO: queue: " << queue_name << " owned (locked) by another daemon" << dendl; + ldpp_dout(this, 20) << "INFO: queue: " << queue_name << " owned (locked) by another daemon" << dendl; // if queue was owned by this RGW, processing should be stopped, queue would be deleted from list afterwards continue; } if (ret == -ENOENT) { // queue is deleted - processing will stop the next time we try to read from the queue - ldout(cct, 10) << "INFO: queue: " << queue_name << " should not be locked - already deleted" << dendl; + ldpp_dout(this, 10) << "INFO: queue: " << queue_name << " should not be locked - already deleted" << dendl; continue; } if (ret < 0) { // failed to lock for another reason, continue to process other queues - ldout(cct, 1) << "ERROR: failed to lock queue: " << queue_name << ". error: " << ret << dendl; + ldpp_dout(this, 1) << "ERROR: failed to lock queue: " << queue_name << ". error: " << ret << dendl; has_error = true; continue; } // add queue to list of owned queues if (owned_queues.insert(queue_name).second) { - ldout(cct, 10) << "INFO: queue: " << queue_name << " now owned (locked) by this daemon" << dendl; + ldpp_dout(this, 10) << "INFO: queue: " << queue_name << " now owned (locked) by this daemon" << dendl; // start processing this queue spawn::spawn(io_context, [this, &queue_gc, &queue_gc_lock, queue_name](spawn::yield_context yield) { process_queue(queue_name, yield); @@ -432,10 +436,10 @@ class Manager { // mark it for deletion std::lock_guard lock_guard(queue_gc_lock); queue_gc.push_back(queue_name); - ldout(cct, 10) << "INFO: queue: " << queue_name << " marked for removal" << dendl; + ldpp_dout(this, 10) << "INFO: queue: " << queue_name << " marked for removal" << dendl; }); } else { - ldout(cct, 20) << "INFO: queue: " << queue_name << " ownership (lock) renewed" << dendl; + ldpp_dout(this, 20) << "INFO: queue: " << queue_name << " ownership (lock) renewed" << dendl; } } // erase all queue that were deleted @@ -443,7 +447,7 @@ class Manager { std::lock_guard lock_guard(queue_gc_lock); std::for_each(queue_gc.begin(), queue_gc.end(), [this, &owned_queues](const std::string& queue_name) { owned_queues.erase(queue_name); - ldout(cct, 20) << "INFO: queue: " << queue_name << " removed" << dendl; + ldpp_dout(this, 20) << "INFO: queue: " << queue_name << " removed" << dendl; }); queue_gc.clear(); } @@ -488,12 +492,12 @@ public: (WORKER_THREAD_NAME+std::to_string(worker_id)).c_str()); ceph_assert(rc == 0); } - ldout(cct, 10) << "Started notification manager with: " << worker_count << " workers" << dendl; + ldpp_dout(this, 10) << "Started notification manager with: " << worker_count << " workers" << dendl; } int add_persistent_topic(const std::string& topic_name, optional_yield y) { if (topic_name == Q_LIST_OBJECT_NAME) { - ldout(cct, 1) << "ERROR: topic name cannot be: " << Q_LIST_OBJECT_NAME << " (conflict with queue list object name)" << dendl; + ldpp_dout(this, 1) << "ERROR: topic name cannot be: " << Q_LIST_OBJECT_NAME << " (conflict with queue list object name)" << dendl; return -EINVAL; } librados::ObjectWriteOperation op; @@ -502,12 +506,12 @@ public: auto ret = rgw_rados_operate(rados_ioctx, topic_name, &op, y); if (ret == -EEXIST) { // queue already exists - nothing to do - ldout(cct, 20) << "INFO: queue for topic: " << topic_name << " already exists. nothing to do" << dendl; + ldpp_dout(this, 20) << "INFO: queue for topic: " << topic_name << " already exists. nothing to do" << dendl; return 0; } if (ret < 0) { // failed to create queue - ldout(cct, 1) << "ERROR: failed to create queue for topic: " << topic_name << ". error: " << ret << dendl; + ldpp_dout(this, 1) << "ERROR: failed to create queue for topic: " << topic_name << ". error: " << ret << dendl; return ret; } @@ -516,10 +520,10 @@ public: op.omap_set(new_topic); ret = rgw_rados_operate(rados_ioctx, Q_LIST_OBJECT_NAME, &op, y); if (ret < 0) { - ldout(cct, 1) << "ERROR: failed to add queue: " << topic_name << " to queue list. error: " << ret << dendl; + ldpp_dout(this, 1) << "ERROR: failed to add queue: " << topic_name << " to queue list. error: " << ret << dendl; return ret; } - ldout(cct, 20) << "INFO: queue: " << topic_name << " added to queue list" << dendl; + ldpp_dout(this, 20) << "INFO: queue: " << topic_name << " added to queue list" << dendl; return 0; } @@ -529,12 +533,12 @@ public: auto ret = rgw_rados_operate(rados_ioctx, topic_name, &op, y); if (ret == -ENOENT) { // queue already removed - nothing to do - ldout(cct, 20) << "INFO: queue for topic: " << topic_name << " already removed. nothing to do" << dendl; + ldpp_dout(this, 20) << "INFO: queue for topic: " << topic_name << " already removed. nothing to do" << dendl; return 0; } if (ret < 0) { // failed to remove queue - ldout(cct, 1) << "ERROR: failed to remove queue for topic: " << topic_name << ". error: " << ret << dendl; + ldpp_dout(this, 1) << "ERROR: failed to remove queue for topic: " << topic_name << ". error: " << ret << dendl; return ret; } @@ -542,10 +546,10 @@ public: op.omap_rm_keys(topic_to_remove); ret = rgw_rados_operate(rados_ioctx, Q_LIST_OBJECT_NAME, &op, y); if (ret < 0) { - ldout(cct, 1) << "ERROR: failed to remove queue: " << topic_name << " from queue list. error: " << ret << dendl; + ldpp_dout(this, 1) << "ERROR: failed to remove queue: " << topic_name << " from queue list. error: " << ret << dendl; return ret; } - ldout(cct, 20) << "INFO: queue: " << topic_name << " removed from queue list" << dendl; + ldpp_dout(this, 20) << "INFO: queue: " << topic_name << " removed from queue list" << dendl; return 0; } }; @@ -564,7 +568,7 @@ constexpr uint32_t WORKER_COUNT = 1; // 1 worker thread constexpr uint32_t STALE_RESERVATIONS_PERIOD_S = 120; // cleanup reservations that are more than 2 minutes old constexpr uint32_t RESERVATIONS_CLEANUP_PERIOD_S = 30; // reservation cleanup every 30 seconds -bool init(CephContext* cct, rgw::sal::RGWRadosStore* store) { +bool init(CephContext* cct, rgw::sal::RGWRadosStore* store, const DoutPrefixProvider *dpp) { if (s_manager) { return false; } @@ -604,7 +608,7 @@ rgw::sal::RGWObject* get_object_with_atttributes(const req_state* s, rgw::sal::R if (!src_obj->get_bucket()) { src_obj->set_bucket(s->bucket.get()); } - if (src_obj->get_obj_attrs(s->obj_ctx, s->yield) < 0) { + if (src_obj->get_obj_attrs(s->obj_ctx, s->yield, s) < 0) { return nullptr; } } @@ -801,7 +805,8 @@ int publish_commit(rgw::sal::RGWObject* obj, const ceph::real_time& mtime, const std::string& etag, EventType event_type, - reservation_t& res) + reservation_t& res, + const DoutPrefixProvider *dpp) { for (auto& topic : res.topics) { if (topic.cfg.dest.persistent && topic.res_id == cls_2pc_reservation::NO_ID) { @@ -821,7 +826,7 @@ int publish_commit(rgw::sal::RGWObject* obj, const auto& queue_name = topic.cfg.dest.arn_topic; if (bl.length() > res.size) { // try to make a larger reservation, fail only if this is not possible - ldout(res.s->cct, 5) << "WARNING: committed size: " << bl.length() << " exceeded reserved size: " << res.size << + ldpp_dout(dpp, 5) << "WARNING: committed size: " << bl.length() << " exceeded reserved size: " << res.size << " . trying to make a larger reservation on queue:" << queue_name << dendl; // first cancel the existing reservation librados::ObjectWriteOperation op; @@ -830,7 +835,7 @@ int publish_commit(rgw::sal::RGWObject* obj, topic.cfg.dest.arn_topic, &op, res.s->yield); if (ret < 0) { - ldout(res.s->cct, 1) << "ERROR: failed to abort reservation: " << topic.res_id << + ldpp_dout(dpp, 1) << "ERROR: failed to abort reservation: " << topic.res_id << " when trying to make a larger reservation on queue: " << queue_name << ". error: " << ret << dendl; return ret; @@ -842,13 +847,13 @@ int publish_commit(rgw::sal::RGWObject* obj, ret = rgw_rados_operate(res.store->getRados()->get_notif_pool_ctx(), queue_name, &op, res.s->yield, librados::OPERATION_RETURNVEC); if (ret < 0) { - ldout(res.s->cct, 1) << "ERROR: failed to reserve extra space on queue: " << queue_name + ldpp_dout(dpp, 1) << "ERROR: failed to reserve extra space on queue: " << queue_name << ". error: " << ret << dendl; return (ret == -ENOSPC) ? -ERR_RATE_LIMITED : ret; } ret = cls_2pc_queue_reserve_result(obl, topic.res_id); if (ret < 0) { - ldout(res.s->cct, 1) << "ERROR: failed to parse reservation id for extra space. error: " << ret << dendl; + ldpp_dout(dpp, 1) << "ERROR: failed to parse reservation id for extra space. error: " << ret << dendl; return ret; } } @@ -860,7 +865,7 @@ int publish_commit(rgw::sal::RGWObject* obj, res.s->yield); topic.res_id = cls_2pc_reservation::NO_ID; if (ret < 0) { - ldout(res.s->cct, 1) << "ERROR: failed to commit reservation to queue: " << queue_name + ldpp_dout(dpp, 1) << "ERROR: failed to commit reservation to queue: " << queue_name << ". error: " << ret << dendl; return ret; } @@ -869,18 +874,18 @@ int publish_commit(rgw::sal::RGWObject* obj, // TODO add endpoint LRU cache const auto push_endpoint = RGWPubSubEndpoint::create(topic.cfg.dest.push_endpoint, topic.cfg.dest.arn_topic, - RGWHTTPArgs(topic.cfg.dest.push_endpoint_args), + RGWHTTPArgs(topic.cfg.dest.push_endpoint_args, dpp), res.s->cct); - ldout(res.s->cct, 20) << "INFO: push endpoint created: " << topic.cfg.dest.push_endpoint << dendl; + ldpp_dout(dpp, 20) << "INFO: push endpoint created: " << topic.cfg.dest.push_endpoint << dendl; const auto ret = push_endpoint->send_to_completion_async(res.s->cct, event_entry.event, res.s->yield); if (ret < 0) { - ldout(res.s->cct, 1) << "ERROR: push to endpoint " << topic.cfg.dest.push_endpoint << " failed. error: " << ret << dendl; + ldpp_dout(dpp, 1) << "ERROR: push to endpoint " << topic.cfg.dest.push_endpoint << " failed. error: " << ret << dendl; if (perfcounter) perfcounter->inc(l_rgw_pubsub_push_failed); return ret; } if (perfcounter) perfcounter->inc(l_rgw_pubsub_push_ok); } catch (const RGWPubSubEndpoint::configuration_error& e) { - ldout(res.s->cct, 1) << "ERROR: failed to create push endpoint: " + ldpp_dout(dpp, 1) << "ERROR: failed to create push endpoint: " << topic.cfg.dest.push_endpoint << ". error: " << e.what() << dendl; if (perfcounter) perfcounter->inc(l_rgw_pubsub_push_failed); return -EINVAL; diff --git a/src/rgw/rgw_notify.h b/src/rgw/rgw_notify.h index bcbc31f3628ad..169e09c6b20cb 100644 --- a/src/rgw/rgw_notify.h +++ b/src/rgw/rgw_notify.h @@ -25,7 +25,7 @@ namespace rgw::notify { // initialize the notification manager // notification manager is dequeing the 2-phase-commit queues // and send the notifications to the endpoints -bool init(CephContext* cct, rgw::sal::RGWRadosStore* store); +bool init(CephContext* cct, rgw::sal::RGWRadosStore* store, const DoutPrefixProvider *dpp); // shutdown the notification manager void shutdown(); @@ -77,7 +77,8 @@ int publish_commit(rgw::sal::RGWObject* obj, const ceph::real_time& mtime, const std::string& etag, EventType event_type, - reservation_t& reservation); + reservation_t& reservation, + const DoutPrefixProvider *dpp); // cancel the reservation int publish_abort(reservation_t& reservation); diff --git a/src/rgw/rgw_object_expirer.cc b/src/rgw/rgw_object_expirer.cc index cf30693baa496..42aefea6712a1 100644 --- a/src/rgw/rgw_object_expirer.cc +++ b/src/rgw/rgw_object_expirer.cc @@ -80,7 +80,8 @@ int main(const int argc, const char **argv) common_init_finish(g_ceph_context); - store = RGWStoreManager::get_storage(g_ceph_context, false, false, false, false, false); + const DoutPrefix dp(cct.get(), dout_subsys, "rgw object expirer: "); + store = RGWStoreManager::get_storage(&dp, g_ceph_context, false, false, false, false, false); if (!store) { std::cerr << "couldn't init storage provider" << std::endl; return EIO; diff --git a/src/rgw/rgw_object_expirer_core.cc b/src/rgw/rgw_object_expirer_core.cc index d390d491013d0..0b0be8476056d 100644 --- a/src/rgw/rgw_object_expirer_core.cc +++ b/src/rgw/rgw_object_expirer_core.cc @@ -210,7 +210,7 @@ int RGWObjectExpirer::init_bucket_info(const string& tenant_name, } -int RGWObjectExpirer::garbage_single_object(objexp_hint_entry& hint) +int RGWObjectExpirer::garbage_single_object(const DoutPrefixProvider *dpp, objexp_hint_entry& hint) { RGWBucketInfo bucket_info; @@ -235,13 +235,14 @@ int RGWObjectExpirer::garbage_single_object(objexp_hint_entry& hint) rgw_obj obj(bucket_info.bucket, key); store->getRados()->set_atomic(&rctx, obj); - ret = store->getRados()->delete_obj(rctx, bucket_info, obj, + ret = store->getRados()->delete_obj(dpp, rctx, bucket_info, obj, bucket_info.versioning_status(), 0, hint.exp_time); return ret; } -void RGWObjectExpirer::garbage_chunk(list& entries, /* in */ +void RGWObjectExpirer::garbage_chunk(const DoutPrefixProvider *dpp, + list& entries, /* in */ bool& need_trim) /* out */ { need_trim = false; @@ -262,7 +263,7 @@ void RGWObjectExpirer::garbage_chunk(list& entries, /* /* PRECOND_FAILED simply means that our hint is not valid. * We can silently ignore that and move forward. */ - ret = garbage_single_object(hint); + ret = garbage_single_object(dpp, hint); if (ret == -ERR_PRECONDITION_FAILED) { ldout(store->ctx(), 15) << "not actual hint for object: " << hint.obj_key << dendl; } else if (ret < 0) { @@ -296,7 +297,8 @@ void RGWObjectExpirer::trim_chunk(const string& shard, return; } -bool RGWObjectExpirer::process_single_shard(const string& shard, +bool RGWObjectExpirer::process_single_shard(const DoutPrefixProvider *dpp, + const string& shard, const utime_t& last_run, const utime_t& round_start) { @@ -338,7 +340,7 @@ bool RGWObjectExpirer::process_single_shard(const string& shard, } bool need_trim; - garbage_chunk(entries, need_trim); + garbage_chunk(dpp, entries, need_trim); if (need_trim) { trim_chunk(shard, last_run, round_start, marker, out_marker); @@ -358,7 +360,8 @@ bool RGWObjectExpirer::process_single_shard(const string& shard, } /* Returns true if all shards have been processed successfully. */ -bool RGWObjectExpirer::inspect_all_shards(const utime_t& last_run, +bool RGWObjectExpirer::inspect_all_shards(const DoutPrefixProvider *dpp, + const utime_t& last_run, const utime_t& round_start) { CephContext * const cct = store->ctx(); @@ -371,7 +374,7 @@ bool RGWObjectExpirer::inspect_all_shards(const utime_t& last_run, ldout(store->ctx(), 20) << "processing shard = " << shard << dendl; - if (! process_single_shard(shard, last_run, round_start)) { + if (! process_single_shard(dpp, shard, last_run, round_start)) { all_done = false; } } @@ -406,7 +409,7 @@ void *RGWObjectExpirer::OEWorker::entry() { do { utime_t start = ceph_clock_now(); ldout(cct, 2) << "object expiration: start" << dendl; - if (oe->inspect_all_shards(last_run, start)) { + if (oe->inspect_all_shards(this, last_run, start)) { /* All shards have been processed properly. Next time we can start * from this moment. */ last_run = start; @@ -439,3 +442,17 @@ void RGWObjectExpirer::OEWorker::stop() cond.notify_all(); } +CephContext *RGWObjectExpirer::OEWorker::get_cct() const +{ + return cct; +} + +unsigned RGWObjectExpirer::OEWorker::get_subsys() const +{ + return dout_subsys; +} + +std::ostream& RGWObjectExpirer::OEWorker::gen_prefix(std::ostream& out) const +{ + return out << "rgw object expirer Worker thread: "; +} diff --git a/src/rgw/rgw_object_expirer_core.h b/src/rgw/rgw_object_expirer_core.h index f76fe56cb6561..b259f1c43b2c3 100644 --- a/src/rgw/rgw_object_expirer_core.h +++ b/src/rgw/rgw_object_expirer_core.h @@ -78,7 +78,7 @@ protected: const std::string& bucket_id, RGWBucketInfo& bucket_info); - class OEWorker : public Thread { + class OEWorker : public Thread, public DoutPrefixProvider { CephContext *cct; RGWObjectExpirer *oe; ceph::mutex lock = ceph::make_mutex("OEWorker"); @@ -93,6 +93,10 @@ protected: void *entry() override; void stop(); + + CephContext *get_cct() const override; + unsigned get_subsys() const; + std::ostream& gen_prefix(std::ostream& out) const; }; OEWorker *worker{nullptr}; @@ -117,9 +121,10 @@ public: bucket_id, obj_key); } - int garbage_single_object(objexp_hint_entry& hint); + int garbage_single_object(const DoutPrefixProvider *dpp, objexp_hint_entry& hint); - void garbage_chunk(std::list& entries, /* in */ + void garbage_chunk(const DoutPrefixProvider *dpp, + std::list& entries, /* in */ bool& need_trim); /* out */ void trim_chunk(const std::string& shard, @@ -128,11 +133,13 @@ public: const string& from_marker, const string& to_marker); - bool process_single_shard(const std::string& shard, + bool process_single_shard(const DoutPrefixProvider *dpp, + const std::string& shard, const utime_t& last_run, const utime_t& round_start); - bool inspect_all_shards(const utime_t& last_run, + bool inspect_all_shards(const DoutPrefixProvider *dpp, + const utime_t& last_run, const utime_t& round_start); bool going_down(); diff --git a/src/rgw/rgw_oidc_provider.cc b/src/rgw/rgw_oidc_provider.cc index b9aceac83d04d..35496e14fef0f 100644 --- a/src/rgw/rgw_oidc_provider.cc +++ b/src/rgw/rgw_oidc_provider.cc @@ -57,7 +57,7 @@ int RGWOIDCProvider::get_tenant_url_from_arn(string& tenant, string& url) return 0; } -int RGWOIDCProvider::create(bool exclusive, optional_yield y) +int RGWOIDCProvider::create(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) { int ret; @@ -68,7 +68,7 @@ int RGWOIDCProvider::create(bool exclusive, optional_yield y) string idp_url = url_remove_prefix(provider_url); /* check to see the name is not used */ - ret = read_url(idp_url, tenant); + ret = read_url(dpp, idp_url, tenant); if (exclusive && ret == 0) { ldout(cct, 0) << "ERROR: url " << provider_url << " already in use" << id << dendl; @@ -137,7 +137,7 @@ int RGWOIDCProvider::delete_obj(optional_yield y) return ret; } -int RGWOIDCProvider::get() +int RGWOIDCProvider::get(const DoutPrefixProvider *dpp) { string url, tenant; auto ret = get_tenant_url_from_arn(tenant, url); @@ -152,7 +152,7 @@ int RGWOIDCProvider::get() return -EINVAL; } - ret = read_url(url, tenant); + ret = read_url(dpp, url, tenant); if (ret < 0) { return ret; } @@ -186,7 +186,7 @@ void RGWOIDCProvider::decode_json(JSONObj *obj) JSONDecoder::decode_json("OpenIDConnectProviderArn", arn, obj); } -int RGWOIDCProvider::read_url(const string& url, const string& tenant) +int RGWOIDCProvider::read_url(const DoutPrefixProvider *dpp, const string& url, const string& tenant) { auto svc = ctl->svc; auto& pool = svc->zone->get_zone_params().oidc_pool; @@ -194,7 +194,7 @@ int RGWOIDCProvider::read_url(const string& url, const string& tenant) bufferlist bl; auto obj_ctx = svc->sysobj->init_obj_ctx(); - int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, NULL, NULL, null_yield); + int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, NULL, NULL, null_yield, dpp); if (ret < 0) { return ret; } @@ -243,7 +243,7 @@ bool RGWOIDCProvider::validate_input() return true; } -int RGWOIDCProvider::get_providers(RGWRados *store, +int RGWOIDCProvider::get_providers(const DoutPrefixProvider *dpp, RGWRados *store, const string& tenant, vector& providers) { @@ -269,7 +269,7 @@ int RGWOIDCProvider::get_providers(RGWRados *store, bufferlist bl; auto obj_ctx = svc->sysobj->init_obj_ctx(); - int ret = rgw_get_system_obj(obj_ctx, pool, iter, bl, NULL, NULL, null_yield); + int ret = rgw_get_system_obj(obj_ctx, pool, iter, bl, NULL, NULL, null_yield, dpp); if (ret < 0) { return ret; } diff --git a/src/rgw/rgw_oidc_provider.h b/src/rgw/rgw_oidc_provider.h index f8ecb7b59a912..88fa8fb309251 100644 --- a/src/rgw/rgw_oidc_provider.h +++ b/src/rgw/rgw_oidc_provider.h @@ -36,7 +36,7 @@ class RGWOIDCProvider int get_tenant_url_from_arn(string& tenant, string& url); int store_url(const string& url, bool exclusive, optional_yield y); - int read_url(const string& url, const string& tenant); + int read_url(const DoutPrefixProvider *dpp, const string& url, const string& tenant); bool validate_input(); public: @@ -110,15 +110,15 @@ public: const vector& get_client_ids() const { return client_ids;} const vector& get_thumbprints() const { return thumbprints; } - int create(bool exclusive, optional_yield y); + int create(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y); int delete_obj(optional_yield y); - int get(); + int get(const DoutPrefixProvider *dpp); void dump(Formatter *f) const; void dump_all(Formatter *f) const; void decode_json(JSONObj *obj); static const string& get_url_oid_prefix(); - static int get_providers(RGWRados *store, + static int get_providers(const DoutPrefixProvider *dpp, RGWRados *store, const string& tenant, vector& providers); }; diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index d6bc277e6dbd0..a1862b190a2a4 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -209,7 +209,8 @@ static int get_user_policy_from_attr(CephContext * const cct, * object: name of the object to get the ACL for. * Returns: 0 on success, -ERR# otherwise. */ -int rgw_op_get_bucket_policy_from_attr(CephContext *cct, +int rgw_op_get_bucket_policy_from_attr(const DoutPrefixProvider *dpp, + CephContext *cct, rgw::sal::RGWStore *store, RGWBucketInfo& bucket_info, map& bucket_attrs, @@ -226,7 +227,7 @@ int rgw_op_get_bucket_policy_from_attr(CephContext *cct, ldout(cct, 0) << "WARNING: couldn't find acl header for bucket, generating default" << dendl; std::unique_ptr user = store->get_user(bucket_info.owner); /* object exists, but policy is broken */ - int r = user->load_by_id(y); + int r = user->load_by_id(dpp, y); if (r < 0) return r; @@ -235,7 +236,8 @@ int rgw_op_get_bucket_policy_from_attr(CephContext *cct, return 0; } -static int get_obj_policy_from_attr(CephContext *cct, +static int get_obj_policy_from_attr(const DoutPrefixProvider *dpp, + CephContext *cct, rgw::sal::RGWStore *store, RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, @@ -250,7 +252,7 @@ static int get_obj_policy_from_attr(CephContext *cct, std::unique_ptr rop = obj->get_read_op(&obj_ctx); - ret = rop->get_attr(RGW_ATTR_ACL, bl, y); + ret = rop->get_attr(dpp, RGW_ATTR_ACL, bl, y); if (ret >= 0) { ret = decode_policy(cct, bl, policy); if (ret < 0) @@ -259,7 +261,7 @@ static int get_obj_policy_from_attr(CephContext *cct, /* object exists, but policy is broken */ ldout(cct, 0) << "WARNING: couldn't find acl header for object, generating default" << dendl; std::unique_ptr user = store->get_user(bucket_info.owner); - ret = user->load_by_id(y); + ret = user->load_by_id(dpp, y); if (ret < 0) return ret; @@ -268,7 +270,7 @@ static int get_obj_policy_from_attr(CephContext *cct, if (storage_class) { bufferlist scbl; - int r = rop->get_attr(RGW_ATTR_STORAGE_CLASS, scbl, y); + int r = rop->get_attr(dpp, RGW_ATTR_STORAGE_CLASS, scbl, y); if (r >= 0) { *storage_class = scbl.to_str(); } else { @@ -326,14 +328,15 @@ vector get_iam_user_policy_from_attr(CephContext* cct, return policies; } -static int get_obj_head(struct req_state *s, +static int get_obj_head(const DoutPrefixProvider *dpp, + struct req_state *s, rgw::sal::RGWObject* obj, bufferlist *pbl) { std::unique_ptr read_op = obj->get_read_op(s->obj_ctx); obj->set_prefetch_data(s->obj_ctx); - int ret = read_op->prepare(s->yield); + int ret = read_op->prepare(s->yield, dpp); if (ret < 0) { return ret; } @@ -342,7 +345,7 @@ static int get_obj_head(struct req_state *s, return 0; } - ret = read_op->read(0, s->cct->_conf->rgw_max_chunk_size, *pbl, s->yield); + ret = read_op->read(0, s->cct->_conf->rgw_max_chunk_size, *pbl, s->yield, dpp); return 0; } @@ -365,7 +368,7 @@ struct multipart_upload_info }; WRITE_CLASS_ENCODER(multipart_upload_info) -static int get_multipart_info(struct req_state *s, +static int get_multipart_info(const DoutPrefixProvider *dpp, struct req_state *s, rgw::sal::RGWObject* obj, multipart_upload_info *upload_info) { @@ -374,7 +377,7 @@ static int get_multipart_info(struct req_state *s, bufferlist headbl; bufferlist *pheadbl = (upload_info ? &headbl : nullptr); - int op_ret = get_obj_head(s, obj, pheadbl); + int op_ret = get_obj_head(dpp, s, obj, pheadbl); if (op_ret < 0) { if (op_ret == -ENOENT) { return -ERR_NO_SUCH_UPLOAD; @@ -395,7 +398,7 @@ static int get_multipart_info(struct req_state *s, return 0; } -static int get_multipart_info(struct req_state *s, +static int get_multipart_info(const DoutPrefixProvider *dpp, struct req_state *s, const string& meta_oid, multipart_upload_info *upload_info) { @@ -406,10 +409,11 @@ static int get_multipart_info(struct req_state *s, meta_obj = s->bucket->get_object(rgw_obj_key(meta_oid, string(), mp_ns)); meta_obj->set_in_extra_data(true); - return get_multipart_info(s, meta_obj.get(), upload_info); + return get_multipart_info(dpp, s, meta_obj.get(), upload_info); } -static int read_bucket_policy(rgw::sal::RGWStore *store, +static int read_bucket_policy(const DoutPrefixProvider *dpp, + rgw::sal::RGWStore *store, struct req_state *s, RGWBucketInfo& bucket_info, map& bucket_attrs, @@ -418,7 +422,7 @@ static int read_bucket_policy(rgw::sal::RGWStore *store, optional_yield y) { if (!s->system_request && bucket_info.flags & BUCKET_SUSPENDED) { - ldpp_dout(s, 0) << "NOTICE: bucket " << bucket_info.bucket.name + ldpp_dout(dpp, 0) << "NOTICE: bucket " << bucket_info.bucket.name << " is suspended" << dendl; return -ERR_USER_SUSPENDED; } @@ -427,7 +431,7 @@ static int read_bucket_policy(rgw::sal::RGWStore *store, return 0; } - int ret = rgw_op_get_bucket_policy_from_attr(s->cct, store, bucket_info, bucket_attrs, policy, y); + int ret = rgw_op_get_bucket_policy_from_attr(dpp, s->cct, store, bucket_info, bucket_attrs, policy, y); if (ret == -ENOENT) { ret = -ERR_NO_SUCH_BUCKET; } @@ -435,7 +439,8 @@ static int read_bucket_policy(rgw::sal::RGWStore *store, return ret; } -static int read_obj_policy(rgw::sal::RGWStore *store, +static int read_obj_policy(const DoutPrefixProvider *dpp, + rgw::sal::RGWStore *store, struct req_state *s, RGWBucketInfo& bucket_info, map& bucket_attrs, @@ -453,7 +458,7 @@ static int read_obj_policy(rgw::sal::RGWStore *store, rgw_obj obj; if (!s->system_request && bucket_info.flags & BUCKET_SUSPENDED) { - ldpp_dout(s, 0) << "NOTICE: bucket " << bucket_info.bucket.name + ldpp_dout(dpp, 0) << "NOTICE: bucket " << bucket_info.bucket.name << " is suspended" << dendl; return -ERR_USER_SUSPENDED; } @@ -471,13 +476,13 @@ static int read_obj_policy(rgw::sal::RGWStore *store, policy = get_iam_policy_from_attr(s->cct, bucket_attrs, bucket->get_tenant()); RGWObjectCtx *obj_ctx = static_cast(s->obj_ctx); - int ret = get_obj_policy_from_attr(s->cct, store, *obj_ctx, + int ret = get_obj_policy_from_attr(dpp, s->cct, store, *obj_ctx, bucket_info, bucket_attrs, acl, storage_class, object, s->yield); if (ret == -ENOENT) { /* object does not exist checking the bucket's ACL to make sure that we send a proper error code */ RGWAccessControlPolicy bucket_policy(s->cct); - ret = rgw_op_get_bucket_policy_from_attr(s->cct, store, bucket_info, bucket_attrs, &bucket_policy, y); + ret = rgw_op_get_bucket_policy_from_attr(dpp, s->cct, store, bucket_info, bucket_attrs, &bucket_policy, y); if (ret < 0) { return ret; } @@ -509,7 +514,7 @@ static int read_obj_policy(rgw::sal::RGWStore *store, * only_bucket: If true, reads the user and bucket ACLs rather than the object ACL. * Returns: 0 on success, -ERR# otherwise. */ -int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* s, optional_yield y) +int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore* store, struct req_state* s, optional_yield y) { int ret = 0; auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); @@ -540,9 +545,9 @@ int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* /* check if copy source is within the current domain */ if (!s->src_bucket_name.empty()) { std::unique_ptr src_bucket; - ret = store->get_bucket(nullptr, s->src_tenant_name, s->src_bucket_name, &src_bucket, y); + ret = store->get_bucket(dpp, nullptr, s->src_tenant_name, s->src_bucket_name, &src_bucket, y); if (ret == 0) { - ret = src_bucket->load_by_name(s->src_tenant_name, s->src_bucket_name, + ret = src_bucket->load_by_name(dpp, s->src_tenant_name, s->src_bucket_name, s->bucket_instance_id, &obj_ctx, s->yield); } if (ret == 0) { @@ -562,12 +567,12 @@ int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* if (!s->bucket_name.empty()) { s->bucket_exists = true; - ret = store->get_bucket(s->user.get(), rgw_bucket(rgw_bucket_key(s->bucket_tenant, s->bucket_name, s->bucket_instance_id)), &s->bucket, y); + ret = store->get_bucket(dpp, s->user.get(), rgw_bucket(rgw_bucket_key(s->bucket_tenant, s->bucket_name, s->bucket_instance_id)), &s->bucket, y); if (ret < 0) { if (ret != -ENOENT) { string bucket_log; bucket_log = rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name); - ldpp_dout(s, 0) << "NOTICE: couldn't get bucket from bucket_name (name=" + ldpp_dout(dpp, 0) << "NOTICE: couldn't get bucket from bucket_name (name=" << bucket_log << ")" << dendl; return ret; } @@ -577,7 +582,7 @@ int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* s->bucket_mtime = s->bucket->get_modification_time(); s->bucket_attrs = s->bucket->get_attrs(); - ret = read_bucket_policy(store, s, s->bucket->get_info(), + ret = read_bucket_policy(dpp, store, s, s->bucket->get_info(), s->bucket->get_attrs(), s->bucket_acl.get(), s->bucket->get_key(), y); acct_acl_user = { @@ -606,7 +611,7 @@ int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* } if (!store->get_zonegroup().equals(s->bucket->get_info().zonegroup)) { - ldpp_dout(s, 0) << "NOTICE: request for data in a different zonegroup (" + ldpp_dout(dpp, 0) << "NOTICE: request for data in a different zonegroup (" << s->bucket->get_info().zonegroup << " != " << store->get_zonegroup().get_id() << ")" << dendl; /* we now need to make sure that the operation actually requires copy source, that is @@ -628,7 +633,7 @@ int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* s->dest_placement.inherit_from(s->bucket->get_placement_rule()); if (!store->svc()->zone->get_zone_params().valid_placement(s->dest_placement)) { - ldpp_dout(s, 0) << "NOTICE: invalid dest placement: " << s->dest_placement.to_str() << dendl; + ldpp_dout(dpp, 0) << "NOTICE: invalid dest placement: " << s->dest_placement.to_str() << dendl; return -EINVAL; } @@ -638,7 +643,7 @@ int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* /* handle user ACL only for those APIs which support it */ if (s->user_acl) { map uattrs; - ret = store->ctl()->user->get_attrs_by_uid(acct_acl_user.uid, &uattrs, s->yield); + ret = store->ctl()->user->get_attrs_by_uid(dpp, acct_acl_user.uid, &uattrs, s->yield); if (!ret) { ret = get_user_policy_from_attr(s->cct, store, uattrs, *s->user_acl); } @@ -654,7 +659,7 @@ int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* acct_acl_user.display_name); ret = 0; } else if (ret < 0) { - ldpp_dout(s, 0) << "NOTICE: couldn't get user attrs for handling ACL " + ldpp_dout(dpp, 0) << "NOTICE: couldn't get user attrs for handling ACL " "(user_id=" << s->user->get_id() << ", ret=" << ret << ")" << dendl; return ret; } @@ -664,7 +669,7 @@ int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* if (! s->user->get_id().empty() && s->auth.identity->get_identity_type() != TYPE_ROLE) { try { map uattrs; - if (ret = store->ctl()->user->get_attrs_by_uid(s->user->get_id(), &uattrs, s->yield); ! ret) { + if (ret = store->ctl()->user->get_attrs_by_uid(dpp, s->user->get_id(), &uattrs, s->yield); ! ret) { auto user_policies = get_iam_user_policy_from_attr(s->cct, store, uattrs, s->user->get_tenant()); s->iam_user_policies.insert(s->iam_user_policies.end(), std::make_move_iterator(user_policies.begin()), @@ -686,13 +691,13 @@ int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* // Really this is a can't happen condition. We parse the policy // when it's given to us, so perhaps we should abort or otherwise // raise bloody murder. - ldpp_dout(s, 0) << "Error reading IAM Policy: " << e.what() << dendl; + ldpp_dout(dpp, 0) << "Error reading IAM Policy: " << e.what() << dendl; ret = -EACCES; } bool success = store->svc()->zone->get_redirect_zone_endpoint(&s->redirect_zone_endpoint); if (success) { - ldpp_dout(s, 20) << "redirect_zone_endpoint=" << s->redirect_zone_endpoint << dendl; + ldpp_dout(dpp, 20) << "redirect_zone_endpoint=" << s->redirect_zone_endpoint << dendl; } return ret; @@ -704,7 +709,7 @@ int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* * only_bucket: If true, reads the bucket ACL rather than the object ACL. * Returns: 0 on success, -ERR# otherwise. */ -int rgw_build_object_policies(rgw::sal::RGWRadosStore *store, struct req_state *s, +int rgw_build_object_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, struct req_state *s, bool prefetch_data, optional_yield y) { int ret = 0; @@ -721,7 +726,7 @@ int rgw_build_object_policies(rgw::sal::RGWRadosStore *store, struct req_state * if (prefetch_data) { s->object->set_prefetch_data(s->obj_ctx); } - ret = read_obj_policy(store, s, s->bucket->get_info(), s->bucket_attrs, + ret = read_obj_policy(dpp, store, s, s->bucket->get_info(), s->bucket_attrs, s->object_acl.get(), nullptr, s->iam_policy, s->bucket.get(), s->object.get(), y); } @@ -752,9 +757,9 @@ static int rgw_iam_add_tags_from_bl(struct req_state* s, bufferlist& bl){ return 0; } -static int rgw_iam_add_existing_objtags(rgw::sal::RGWRadosStore* store, struct req_state* s, std::uint64_t action) { +static int rgw_iam_add_existing_objtags(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore* store, struct req_state* s, std::uint64_t action) { s->object->set_atomic(s->obj_ctx); - int op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield); + int op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield, dpp); if (op_ret < 0) return op_ret; rgw::sal::RGWAttrs attrs = s->object->get_attrs(); @@ -871,10 +876,10 @@ void rgw_bucket_object_pre_exec(struct req_state *s) // general, they should just return op_ret. namespace { template -int retry_raced_bucket_write(rgw::sal::RGWBucket* b, const F& f) { +int retry_raced_bucket_write(const DoutPrefixProvider *dpp, rgw::sal::RGWBucket* b, const F& f) { auto r = f(); for (auto i = 0u; i < 15u && r == -ECANCELED; ++i) { - r = b->try_refresh_info(nullptr); + r = b->try_refresh_info(dpp, nullptr); if (r >= 0) { r = f(); } @@ -905,11 +910,11 @@ int RGWGetObj::verify_permission(optional_yield y) action = rgw::IAM::s3GetObjectVersion; } if (s->iam_policy && s->iam_policy->has_partial_conditional(S3_EXISTING_OBJTAG)) - rgw_iam_add_existing_objtags(store, s, action); + rgw_iam_add_existing_objtags(this, store, s, action); if (! s->iam_user_policies.empty()) { for (auto& user_policy : s->iam_user_policies) { if (user_policy.has_partial_conditional(S3_EXISTING_OBJTAG)) - rgw_iam_add_existing_objtags(store, s, action); + rgw_iam_add_existing_objtags(this, store, s, action); } } } @@ -954,12 +959,12 @@ int RGWGetObjTags::verify_permission(optional_yield y) // TODO since we are parsing the bl now anyway, we probably change // the send_response function to accept RGWObjTag instead of a bl if (s->iam_policy && s->iam_policy->has_partial_conditional(S3_EXISTING_OBJTAG)){ - rgw_iam_add_existing_objtags(store, s, iam_action); + rgw_iam_add_existing_objtags(this, store, s, iam_action); } if (! s->iam_user_policies.empty()) { for (auto& user_policy : s->iam_user_policies) { if (user_policy.has_partial_conditional(S3_EXISTING_OBJTAG)) { - rgw_iam_add_existing_objtags(store, s, iam_action); + rgw_iam_add_existing_objtags(this, store, s, iam_action); } } } @@ -980,7 +985,7 @@ void RGWGetObjTags::execute(optional_yield y) s->object->set_atomic(s->obj_ctx); - op_ret = s->object->get_obj_attrs(s->obj_ctx, y); + op_ret = s->object->get_obj_attrs(s->obj_ctx, y, this); if (op_ret < 0) { ldpp_dout(this, 0) << "ERROR: failed to get obj attrs, obj=" << s->object << " ret=" << op_ret << dendl; @@ -1003,12 +1008,12 @@ int RGWPutObjTags::verify_permission(optional_yield y) rgw::IAM::s3PutObjectVersionTagging; if(s->iam_policy && s->iam_policy->has_partial_conditional(S3_EXISTING_OBJTAG)){ - rgw_iam_add_existing_objtags(store, s, iam_action); + rgw_iam_add_existing_objtags(this, store, s, iam_action); } if (! s->iam_user_policies.empty()) { for (auto& user_policy : s->iam_user_policies) { if (user_policy.has_partial_conditional(S3_EXISTING_OBJTAG)) { - rgw_iam_add_existing_objtags(store, s, iam_action); + rgw_iam_add_existing_objtags(this, store, s, iam_action); } } } @@ -1029,7 +1034,7 @@ void RGWPutObjTags::execute(optional_yield y) } s->object->set_atomic(s->obj_ctx); - op_ret = s->object->modify_obj_attrs(s->obj_ctx, RGW_ATTR_TAGS, tags_bl, y); + op_ret = s->object->modify_obj_attrs(s->obj_ctx, RGW_ATTR_TAGS, tags_bl, y, this); if (op_ret == -ECANCELED){ op_ret = -ERR_TAG_CONFLICT; } @@ -1049,12 +1054,12 @@ int RGWDeleteObjTags::verify_permission(optional_yield y) rgw::IAM::s3DeleteObjectVersionTagging; if (s->iam_policy && s->iam_policy->has_partial_conditional(S3_EXISTING_OBJTAG)){ - rgw_iam_add_existing_objtags(store, s, iam_action); + rgw_iam_add_existing_objtags(this, store, s, iam_action); } if (! s->iam_user_policies.empty()) { for (auto& user_policy : s->iam_user_policies) { if (user_policy.has_partial_conditional(S3_EXISTING_OBJTAG)) { - rgw_iam_add_existing_objtags(store, s, iam_action); + rgw_iam_add_existing_objtags(this, store, s, iam_action); } } } @@ -1069,7 +1074,7 @@ void RGWDeleteObjTags::execute(optional_yield y) if (rgw::sal::RGWObject::empty(s->object.get())) return; - op_ret = s->object->delete_obj_attrs(s->obj_ctx, RGW_ATTR_TAGS, y); + op_ret = s->object->delete_obj_attrs(this, s->obj_ctx, RGW_ATTR_TAGS, y); } int RGWGetBucketTags::verify_permission(optional_yield y) @@ -1115,10 +1120,10 @@ void RGWPutBucketTags::execute(optional_yield y) ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; } - op_ret = retry_raced_bucket_write(s->bucket.get(), [this, y] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this, y] { rgw::sal::RGWAttrs attrs = s->bucket->get_attrs(); attrs[RGW_ATTR_TAGS] = tags_bl; - return s->bucket->set_instance_attrs(attrs, y); + return s->bucket->set_instance_attrs(this, attrs, y); }); } @@ -1142,10 +1147,10 @@ void RGWDeleteBucketTags::execute(optional_yield y) return; } - op_ret = retry_raced_bucket_write(s->bucket.get(), [this, y] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this, y] { rgw::sal::RGWAttrs attrs = s->bucket->get_attrs(); attrs.erase(RGW_ATTR_TAGS); - op_ret = s->bucket->set_instance_attrs(attrs, y); + op_ret = s->bucket->set_instance_attrs(this, attrs, y); if (op_ret < 0) { ldpp_dout(this, 0) << "RGWDeleteBucketTags() failed to remove RGW_ATTR_TAGS on bucket=" << s->bucket->get_name() @@ -1190,7 +1195,7 @@ void RGWPutBucketReplication::execute(optional_yield y) { return; } - op_ret = retry_raced_bucket_write(s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { auto sync_policy = (s->bucket->get_info().sync_policy ? *s->bucket->get_info().sync_policy : rgw_sync_policy_info()); for (auto& group : sync_policy_groups) { @@ -1199,7 +1204,7 @@ void RGWPutBucketReplication::execute(optional_yield y) { s->bucket->get_info().set_sync_policy(std::move(sync_policy)); - int ret = s->bucket->put_instance_info(false, real_time()); + int ret = s->bucket->put_instance_info(this, false, real_time()); if (ret < 0) { ldpp_dout(this, 0) << "ERROR: put_bucket_instance_info (bucket=" << s->bucket << ") returned ret=" << ret << dendl; return ret; @@ -1228,7 +1233,7 @@ void RGWDeleteBucketReplication::execute(optional_yield y) return; } - op_ret = retry_raced_bucket_write(s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { if (!s->bucket->get_info().sync_policy) { return 0; } @@ -1239,7 +1244,7 @@ void RGWDeleteBucketReplication::execute(optional_yield y) s->bucket->get_info().set_sync_policy(std::move(sync_policy)); - int ret = s->bucket->put_instance_info(false, real_time()); + int ret = s->bucket->put_instance_info(this, false, real_time()); if (ret < 0) { ldpp_dout(this, 0) << "ERROR: put_bucket_instance_info (bucket=" << s->bucket << ") returned ret=" << ret << dendl; return ret; @@ -1291,7 +1296,7 @@ int RGWOp::init_quota() if (s->user->get_id() == s->bucket_owner.get_id()) { user = s->user.get(); } else { - int r = owner_user.load_by_id(s->yield); + int r = owner_user.load_by_id(this, s->yield); if (r < 0) return r; user = &owner_user; @@ -1506,7 +1511,7 @@ int RGWGetObj::read_user_manifest_part(rgw::sal::RGWBucket* bucket, read_op->params.if_match = ent.meta.etag.c_str(); } - op_ret = read_op->prepare(s->yield); + op_ret = read_op->prepare(s->yield, this); if (op_ret < 0) return op_ret; op_ret = part->range_to_ofs(ent.meta.accounted_size, cur_ofs, cur_end); @@ -1561,13 +1566,14 @@ int RGWGetObj::read_user_manifest_part(rgw::sal::RGWBucket* bucket, perfcounter->inc(l_rgw_get_b, cur_end - cur_ofs); filter->fixup_range(cur_ofs, cur_end); - op_ret = read_op->iterate(cur_ofs, cur_end, filter, s->yield); + op_ret = read_op->iterate(this, cur_ofs, cur_end, filter, s->yield); if (op_ret >= 0) op_ret = filter->flush(); return op_ret; } -static int iterate_user_manifest_parts(CephContext * const cct, +static int iterate_user_manifest_parts(const DoutPrefixProvider *dpp, + CephContext * const cct, rgw::sal::RGWStore* const store, const off_t ofs, const off_t end, @@ -1603,7 +1609,7 @@ static int iterate_user_manifest_parts(CephContext * const cct, MD5 etag_sum; do { static constexpr auto MAX_LIST_OBJS = 100u; - int r = bucket->list(params, MAX_LIST_OBJS, results, y); + int r = bucket->list(dpp, params, MAX_LIST_OBJS, results, y); if (r < 0) { return r; } @@ -1790,14 +1796,14 @@ int RGWGetObj::handle_user_manifest(const char *prefix, optional_yield y) if (bucket_name.compare(s->bucket->get_name()) != 0) { map bucket_attrs; - r = store->get_bucket(s->user.get(), s->user->get_tenant(), bucket_name, &ubucket, y); + r = store->get_bucket(this, s->user.get(), s->user->get_tenant(), bucket_name, &ubucket, y); if (r < 0) { ldpp_dout(this, 0) << "could not get bucket info for bucket=" << bucket_name << dendl; return r; } bucket_acl = &_bucket_acl; - r = read_bucket_policy(store, s, ubucket->get_info(), bucket_attrs, bucket_acl, ubucket->get_key(), y); + r = read_bucket_policy(this, store, s, ubucket->get_info(), bucket_attrs, bucket_acl, ubucket->get_key(), y); if (r < 0) { ldpp_dout(this, 0) << "failed to read bucket policy" << dendl; return r; @@ -1815,7 +1821,7 @@ int RGWGetObj::handle_user_manifest(const char *prefix, optional_yield y) * - total length (of the parts we are going to send to client), * - overall DLO's content size, * - md5 sum of overall DLO's content (for etag of Swift API). */ - r = iterate_user_manifest_parts(s->cct, store, ofs, end, + r = iterate_user_manifest_parts(this, s->cct, store, ofs, end, pbucket, obj_prefix, bucket_acl, *bucket_policy, nullptr, &s->obj_size, &lo_etag, nullptr /* cb */, nullptr /* cb arg */, y); @@ -1829,7 +1835,7 @@ int RGWGetObj::handle_user_manifest(const char *prefix, optional_yield y) return r; } - r = iterate_user_manifest_parts(s->cct, store, ofs, end, + r = iterate_user_manifest_parts(this, s->cct, store, ofs, end, pbucket, obj_prefix, bucket_acl, *bucket_policy, &total_len, nullptr, nullptr, nullptr, nullptr, y); @@ -1843,7 +1849,7 @@ int RGWGetObj::handle_user_manifest(const char *prefix, optional_yield y) return 0; } - r = iterate_user_manifest_parts(s->cct, store, ofs, end, + r = iterate_user_manifest_parts(this, s->cct, store, ofs, end, pbucket, obj_prefix, bucket_acl, *bucket_policy, nullptr, nullptr, nullptr, get_obj_user_manifest_iterate_cb, (void *)this, y); @@ -1919,7 +1925,7 @@ int RGWGetObj::handle_slo_manifest(bufferlist& bl, optional_yield y) std::unique_ptr tmp_bucket; auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); - int r = store->get_bucket(s->user.get(), s->user->get_tenant(), bucket_name, &tmp_bucket, y); + int r = store->get_bucket(this, s->user.get(), s->user->get_tenant(), bucket_name, &tmp_bucket, y); if (r < 0) { ldpp_dout(this, 0) << "could not get bucket info for bucket=" << bucket_name << dendl; @@ -1927,7 +1933,7 @@ int RGWGetObj::handle_slo_manifest(bufferlist& bl, optional_yield y) } bucket = tmp_bucket.get(); bucket_acl = &_bucket_acl; - r = read_bucket_policy(store, s, tmp_bucket->get_info(), tmp_bucket->get_attrs(), bucket_acl, + r = read_bucket_policy(this, store, s, tmp_bucket->get_info(), tmp_bucket->get_attrs(), bucket_acl, tmp_bucket->get_key(), y); if (r < 0) { ldpp_dout(this, 0) << "failed to read bucket ACL for bucket " @@ -2073,7 +2079,7 @@ void RGWGetObj::execute(optional_yield y) read_op->params.if_nomatch = if_nomatch; read_op->params.lastmod = &lastmod; - op_ret = read_op->prepare(s->yield); + op_ret = read_op->prepare(s->yield, this); if (op_ret < 0) goto done_err; version_id = s->object->get_instance(); @@ -2119,7 +2125,7 @@ void RGWGetObj::execute(optional_yield y) op_ret = rgw_compression_info_from_attrset(attrs, need_decompress, cs_info); if (op_ret < 0) { - ldpp_dout(s, 0) << "ERROR: failed to decode compression info, cannot decompress" << dendl; + ldpp_dout(this, 0) << "ERROR: failed to decode compression info, cannot decompress" << dendl; goto done_err; } if (need_decompress) { @@ -2196,7 +2202,7 @@ void RGWGetObj::execute(optional_yield y) ofs_x = ofs; end_x = end; filter->fixup_range(ofs_x, end_x); - op_ret = read_op->iterate(ofs_x, end_x, filter, s->yield); + op_ret = read_op->iterate(this, ofs_x, end_x, filter, s->yield); if (op_ret >= 0) op_ret = filter->flush(); @@ -2283,7 +2289,7 @@ void RGWListBuckets::execute(optional_yield y) } if (supports_account_metadata()) { - op_ret = store->ctl()->user->get_attrs_by_uid(s->user->get_id(), &attrs, s->yield); + op_ret = store->ctl()->user->get_attrs_by_uid(this, s->user->get_id(), &attrs, s->yield); if (op_ret < 0) { goto send_end; } @@ -2299,7 +2305,7 @@ void RGWListBuckets::execute(optional_yield y) read_count = max_buckets; } - op_ret = s->user->list_buckets(marker, end_marker, read_count, should_get_stats(), buckets, y); + op_ret = s->user->list_buckets(this, marker, end_marker, read_count, should_get_stats(), buckets, y); if (op_ret < 0) { /* hmm.. something wrong here.. the user was authenticated, so it @@ -2402,13 +2408,13 @@ void RGWGetUsage::execute(optional_yield y) } } - op_ret = rgw_user_sync_all_stats(store, s->user->get_id(), y); + op_ret = rgw_user_sync_all_stats(this, store, s->user->get_id(), y); if (op_ret < 0) { ldpp_dout(this, 0) << "ERROR: failed to sync user stats" << dendl; return; } - op_ret = rgw_user_get_all_buckets_stats(store, s->user->get_id(), buckets_usage, y); + op_ret = rgw_user_get_all_buckets_stats(this, store, s->user->get_id(), buckets_usage, y); if (op_ret < 0) { ldpp_dout(this, 0) << "ERROR: failed to get user's buckets stats" << dendl; return; @@ -2442,7 +2448,7 @@ void RGWStatAccount::execute(optional_yield y) do { lastmarker = nullptr; - op_ret = rgw_read_user_buckets(store, s->user->get_id(), buckets, marker, + op_ret = rgw_read_user_buckets(this, store, s->user->get_id(), buckets, marker, string(), max_buckets, true, y); if (op_ret < 0) { /* hmm.. something wrong here.. the user was authenticated, so it @@ -2568,7 +2574,7 @@ void RGWSetBucketVersioning::execute(optional_yield y) bool modified = mfa_set_status; - op_ret = retry_raced_bucket_write(s->bucket.get(), [&] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [&] { if (mfa_set_status) { if (mfa_status) { s->bucket->get_info().flags |= BUCKET_MFA_ENABLED; @@ -2588,7 +2594,7 @@ void RGWSetBucketVersioning::execute(optional_yield y) return op_ret; } s->bucket->set_attrs(rgw::sal::RGWAttrs(s->bucket_attrs)); - return s->bucket->put_instance_info(false, real_time()); + return s->bucket->put_instance_info(this, false, real_time()); }); if (!modified) { @@ -2642,10 +2648,10 @@ void RGWSetBucketWebsite::execute(optional_yield y) return; } - op_ret = retry_raced_bucket_write(s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { s->bucket->get_info().has_website = true; s->bucket->get_info().website_conf = website_conf; - op_ret = s->bucket->put_instance_info(false, real_time()); + op_ret = s->bucket->put_instance_info(this, false, real_time()); return op_ret; }); @@ -2676,10 +2682,10 @@ void RGWDeleteBucketWebsite::execute(optional_yield y) << "returned err=" << op_ret << dendl; return; } - op_ret = retry_raced_bucket_write(s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { s->bucket->get_info().has_website = false; s->bucket->get_info().website_conf = RGWBucketWebsiteConf(); - op_ret = s->bucket->put_instance_info(false, real_time()); + op_ret = s->bucket->put_instance_info(this, false, real_time()); return op_ret; }); if (op_ret < 0) { @@ -2711,11 +2717,11 @@ void RGWStatBucket::execute(optional_yield y) return; } - op_ret = store->get_bucket(s->user.get(), s->bucket->get_key(), &bucket, y); + op_ret = store->get_bucket(this, s->user.get(), s->bucket->get_key(), &bucket, y); if (op_ret) { return; } - op_ret = bucket->update_container_stats(); + op_ret = bucket->update_container_stats(s); } int RGWListBucket::verify_permission(optional_yield y) @@ -2774,7 +2780,7 @@ void RGWListBucket::execute(optional_yield y) } if (need_container_stats()) { - op_ret = s->bucket->update_container_stats(); + op_ret = s->bucket->update_container_stats(s); } rgw::sal::RGWBucket::ListParams params; @@ -2788,7 +2794,7 @@ void RGWListBucket::execute(optional_yield y) rgw::sal::RGWBucket::ListResults results; - op_ret = s->bucket->list(params, max, results, y); + op_ret = s->bucket->list(this, params, max, results, y); if (op_ret >= 0) { next_marker = results.next_marker; is_truncated = results.is_truncated; @@ -2842,7 +2848,7 @@ int RGWCreateBucket::verify_permission(optional_yield y) if (s->user->get_max_buckets()) { rgw::sal::RGWBucketList buckets; string marker; - op_ret = rgw_read_user_buckets(store, s->user->get_id(), buckets, + op_ret = rgw_read_user_buckets(this, store, s->user->get_id(), buckets, marker, string(), s->user->get_max_buckets(), false, y); if (op_ret < 0) { @@ -3072,7 +3078,7 @@ void RGWCreateBucket::execute(optional_yield y) /* we need to make sure we read bucket info, it's not read before for this * specific request */ - op_ret = store->get_bucket(s->user.get(), s->bucket_tenant, s->bucket_name, &s->bucket, y); + op_ret = store->get_bucket(this, s->user.get(), s->bucket_tenant, s->bucket_name, &s->bucket, y); if (op_ret < 0 && op_ret != -ENOENT) return; s->bucket_exists = (op_ret != -ENOENT); @@ -3117,7 +3123,7 @@ void RGWCreateBucket::execute(optional_yield y) if (need_metadata_upload()) { /* It's supposed that following functions WILL NOT change any special * attributes (like RGW_ATTR_ACL) if they are already present in attrs. */ - op_ret = rgw_get_request_metadata(s->cct, s->info, attrs, false); + op_ret = rgw_get_request_metadata(this, s->cct, s->info, attrs, false); if (op_ret < 0) { return; } @@ -3148,7 +3154,7 @@ void RGWCreateBucket::execute(optional_yield y) /* We're replacing bucket with the newly created one */ ldpp_dout(this, 10) << "user=" << s->user << " bucket=" << tmp_bucket << dendl; - op_ret = store->create_bucket(*s->user, tmp_bucket, zonegroup_id, + op_ret = store->create_bucket(this, *s->user, tmp_bucket, zonegroup_id, placement_rule, info.swift_ver_location, pquota_info, policy, attrs, info, ep_objv, @@ -3177,10 +3183,10 @@ void RGWCreateBucket::execute(optional_yield y) } op_ret = store->ctl()->bucket->link_bucket(s->user->get_id(), s->bucket->get_key(), - s->bucket->get_creation_time(), y, false); + s->bucket->get_creation_time(), y, s, false); if (op_ret && !existed && op_ret != -EEXIST) { /* if it exists (or previously existed), don't remove it! */ - op_ret = store->ctl()->bucket->unlink_bucket(s->user->get_id(), s->bucket->get_key(), y); + op_ret = store->ctl()->bucket->unlink_bucket(s->user->get_id(), s->bucket->get_key(), y, this); if (op_ret < 0) { ldpp_dout(this, 0) << "WARNING: failed to unlink bucket: ret=" << op_ret << dendl; @@ -3198,7 +3204,7 @@ void RGWCreateBucket::execute(optional_yield y) do { map battrs; - op_ret = s->bucket->get_bucket_info(y); + op_ret = s->bucket->get_bucket_info(this, y); if (op_ret < 0) { return; } else if (!s->bucket->is_owner(s->user.get())) { @@ -3211,7 +3217,7 @@ void RGWCreateBucket::execute(optional_yield y) attrs.clear(); - op_ret = rgw_get_request_metadata(s->cct, s->info, attrs, false); + op_ret = rgw_get_request_metadata(this, s->cct, s->info, attrs, false); if (op_ret < 0) { return; } @@ -3235,7 +3241,7 @@ void RGWCreateBucket::execute(optional_yield y) /* This will also set the quota on the bucket. */ op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs, &s->bucket->get_info().objv_tracker, - y); + y, this); } while (op_ret == -ECANCELED && tries++ < 20); /* Restore the proper return code. */ @@ -3296,7 +3302,7 @@ void RGWDeleteBucket::execute(optional_yield y) ldpp_dout(this, 1) << "WARNING: failed to sync user stats before bucket delete: op_ret= " << op_ret << dendl; } - op_ret = s->bucket->check_empty(y); + op_ret = s->bucket->check_empty(this, y); if (op_ret < 0) { return; } @@ -3327,8 +3333,7 @@ void RGWDeleteBucket::execute(optional_yield y) } } - op_ret = s->bucket->remove_bucket(false, prefix, delimiter, false, nullptr, - y); + op_ret = s->bucket->remove_bucket(this, false, prefix, delimiter, false, nullptr, y); if (op_ret < 0 && op_ret == -ECANCELED) { // lost a race, either with mdlog sync or another delete bucket operation. // in either case, we've already called ctl.bucket->unlink_bucket() @@ -3382,14 +3387,14 @@ int RGWPutObj::init_processing(optional_yield y) { } } std::unique_ptr bucket; - ret = store->get_bucket(s->user.get(), copy_source_tenant_name, copy_source_bucket_name, + ret = store->get_bucket(this, s->user.get(), copy_source_tenant_name, copy_source_bucket_name, &bucket, y); if (ret < 0) { ldpp_dout(this, 5) << __func__ << "(): get_bucket() returned ret=" << ret << dendl; return ret; } - ret = bucket->get_bucket_info(y); + ret = bucket->get_bucket_info(this, y); if (ret < 0) { ldpp_dout(this, 5) << __func__ << "(): get_bucket_info() returned ret=" << ret << dendl; return ret; @@ -3453,7 +3458,7 @@ int RGWPutObj::verify_permission(optional_yield y) cs_object->set_prefetch_data(s->obj_ctx); /* check source object permissions */ - if (read_obj_policy(store, s, copy_source_bucket_info, cs_attrs, &cs_acl, nullptr, + if (read_obj_policy(this, store, s, copy_source_bucket_info, cs_attrs, &cs_acl, nullptr, policy, cs_bucket.get(), cs_object.get(), y, true) < 0) { return -EACCES; } @@ -3617,7 +3622,7 @@ int RGWPutObj::get_data(const off_t fst, const off_t lst, bufferlist& bl) std::unique_ptr obj = bucket->get_object(rgw_obj_key(copy_source_object_name, copy_source_version_id)); std::unique_ptr read_op(obj->get_read_op(s->obj_ctx)); - ret = read_op->prepare(s->yield); + ret = read_op->prepare(s->yield, this); if (ret < 0) return ret; @@ -3626,7 +3631,7 @@ int RGWPutObj::get_data(const off_t fst, const off_t lst, bufferlist& bl) bool need_decompress; op_ret = rgw_compression_info_from_attrset(obj->get_attrs(), need_decompress, cs_info); if (op_ret < 0) { - ldpp_dout(s, 0) << "ERROR: failed to decode compression info" << dendl; + ldpp_dout(this, 0) << "ERROR: failed to decode compression info" << dendl; return -EIO; } @@ -3655,7 +3660,7 @@ int RGWPutObj::get_data(const off_t fst, const off_t lst, bufferlist& bl) return ret; filter->fixup_range(new_ofs, new_end); - ret = read_op->iterate(new_ofs, new_end, filter, s->yield); + ret = read_op->iterate(this, new_ofs, new_end, filter, s->yield); if (ret >= 0) ret = filter->flush(); @@ -3792,7 +3797,7 @@ void RGWPutObj::execute(optional_yield y) if (multipart) { RGWMPObj mp(s->object->get_name(), multipart_upload_id); - op_ret = get_multipart_info(s, mp.get_meta(), &upload_info); + op_ret = get_multipart_info(this, s, mp.get_meta(), &upload_info); if (op_ret < 0) { if (op_ret != -ENOENT) { ldpp_dout(this, 0) << "ERROR: get_multipart_info returned " << op_ret << ": " << cpp_strerror(-op_ret) << dendl; @@ -3846,7 +3851,7 @@ void RGWPutObj::execute(optional_yield y) rgw::sal::RGWRadosBucket bucket(store, copy_source_bucket_info); RGWObjState *astate; - op_ret = obj.get_obj_state(&obj_ctx, bucket, &astate, s->yield); + op_ret = obj.get_obj_state(this, &obj_ctx, bucket, &astate, s->yield); if (op_ret < 0) { ldpp_dout(this, 0) << "ERROR: get copy source obj state returned with error" << op_ret << dendl; return; @@ -4008,7 +4013,7 @@ void RGWPutObj::execute(optional_yield y) emplace_attr(RGW_ATTR_ETAG, std::move(bl)); populate_with_generic_attrs(s, attrs); - op_ret = rgw_get_request_metadata(s->cct, s->info, attrs); + op_ret = rgw_get_request_metadata(this, s->cct, s->info, attrs); if (op_ret < 0) { return; } @@ -4056,7 +4061,7 @@ void RGWPutObj::execute(optional_yield y) } // send request to notification manager - const auto ret = rgw::notify::publish_commit(s->object.get(), s->obj_size, mtime, etag, event_type, res); + const auto ret = rgw::notify::publish_commit(s->object.get(), s->obj_size, mtime, etag, event_type, res, this); if (ret < 0) { ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl; // too late to rollback operation, hence op_ret is not set here @@ -4289,7 +4294,7 @@ void RGWPostObj::execute(optional_yield y) } while (is_next_file_to_upload()); // send request to notification manager - const auto ret = rgw::notify::publish_commit(s->object.get(), ofs, ceph::real_clock::now(), etag, event_type, res); + const auto ret = rgw::notify::publish_commit(s->object.get(), ofs, ceph::real_clock::now(), etag, event_type, res, this); if (ret < 0) { ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl; // too late to rollback operation, hence op_ret is not set here @@ -4341,7 +4346,7 @@ int RGWPutMetadataAccount::init_processing(optional_yield y) return op_ret; } - op_ret = store->ctl()->user->get_attrs_by_uid(s->user->get_id(), &orig_attrs, + op_ret = store->ctl()->user->get_attrs_by_uid(this, s->user->get_id(), &orig_attrs, s->yield, &acct_op_tracker); if (op_ret < 0) { @@ -4354,7 +4359,7 @@ int RGWPutMetadataAccount::init_processing(optional_yield y) attrs.emplace(RGW_ATTR_ACL, std::move(acl_bl)); } - op_ret = rgw_get_request_metadata(s->cct, s->info, attrs, false); + op_ret = rgw_get_request_metadata(this, s->cct, s->info, attrs, false); if (op_ret < 0) { return op_ret; } @@ -4404,7 +4409,7 @@ void RGWPutMetadataAccount::execute(optional_yield y) { /* Params have been extracted earlier. See init_processing(). */ RGWUserInfo new_uinfo; - op_ret = store->ctl()->user->get_info_by_uid(s->user->get_id(), &new_uinfo, s->yield, + op_ret = store->ctl()->user->get_info_by_uid(this, s->user->get_id(), &new_uinfo, s->yield, RGWUserCtl::GetParams() .set_objv_tracker(&acct_op_tracker)); if (op_ret < 0) { @@ -4425,7 +4430,7 @@ void RGWPutMetadataAccount::execute(optional_yield y) /* We are passing here the current (old) user info to allow the function * optimize-out some operations. */ - op_ret = store->ctl()->user->store_info(new_uinfo, s->yield, + op_ret = store->ctl()->user->store_info(this, new_uinfo, s->yield, RGWUserCtl::PutParams() .set_old_info(&s->user->get_info()) .set_objv_tracker(&acct_op_tracker) @@ -4453,7 +4458,7 @@ void RGWPutMetadataBucket::execute(optional_yield y) return; } - op_ret = rgw_get_request_metadata(s->cct, s->info, attrs, false); + op_ret = rgw_get_request_metadata(this, s->cct, s->info, attrs, false); if (op_ret < 0) { return; } @@ -4464,7 +4469,7 @@ void RGWPutMetadataBucket::execute(optional_yield y) return; } - op_ret = retry_raced_bucket_write(s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { /* Encode special metadata first as we're using std::map::emplace under * the hood. This method will add the new items only if the map doesn't * contain such keys yet. */ @@ -4515,7 +4520,7 @@ void RGWPutMetadataBucket::execute(optional_yield y) /* Setting attributes also stores the provided bucket info. Due * to this fact, the new quota settings can be serialized with * the same call. */ - op_ret = s->bucket->set_instance_attrs(attrs, s->yield); + op_ret = s->bucket->set_instance_attrs(this, attrs, s->yield); return op_ret; }); } @@ -4548,13 +4553,13 @@ void RGWPutMetadataObject::execute(optional_yield y) return; } - op_ret = rgw_get_request_metadata(s->cct, s->info, attrs); + op_ret = rgw_get_request_metadata(this, s->cct, s->info, attrs); if (op_ret < 0) { return; } /* check if obj exists, read orig attrs */ - op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield, &target_obj); + op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield, s, &target_obj); if (op_ret < 0) { return; } @@ -4579,7 +4584,7 @@ void RGWPutMetadataObject::execute(optional_yield y) } } - op_ret = s->object->set_obj_attrs(s->obj_ctx, &attrs, &rmattrs, s->yield, &target_obj); + op_ret = s->object->set_obj_attrs(this, s->obj_ctx, &attrs, &rmattrs, s->yield, &target_obj); } int RGWDeleteObj::handle_slo_manifest(bufferlist& bl, optional_yield y) @@ -4709,7 +4714,7 @@ void RGWDeleteObj::execute(optional_yield y) bool check_obj_lock = s->object->have_instance() && s->bucket->get_info().obj_lock_enabled(); if (!rgw::sal::RGWObject::empty(s->object.get())) { - op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield); + op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield, this); if (op_ret < 0) { if (need_object_expiration() || multipart_delete) { return; @@ -4784,7 +4789,7 @@ void RGWDeleteObj::execute(optional_yield y) return; } - op_ret = s->object->delete_object(obj_ctx, s->owner, s->bucket_owner, unmod_since, + op_ret = s->object->delete_object(this, obj_ctx, s->owner, s->bucket_owner, unmod_since, s->system_request, epoch, version_id, s->yield); if (op_ret >= 0) { delete_marker = s->object->get_delete_marker(); @@ -4808,7 +4813,7 @@ void RGWDeleteObj::execute(optional_yield y) const auto obj_state = obj_ctx->get_state(s->object->get_obj()); // send request to notification manager - const auto ret = rgw::notify::publish_commit(s->object.get(), obj_state->size, obj_state->mtime, attrs[RGW_ATTR_ETAG].to_str(), event_type, res); + const auto ret = rgw::notify::publish_commit(s->object.get(), obj_state->size, obj_state->mtime, attrs[RGW_ATTR_ETAG].to_str(), event_type, res, this); if (ret < 0) { ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl; // too late to rollback operation, hence op_ret is not set here @@ -4820,7 +4825,8 @@ void RGWDeleteObj::execute(optional_yield y) bool RGWCopyObj::parse_copy_location(const std::string_view& url_src, string& bucket_name, - rgw_obj_key& key) + rgw_obj_key& key, + req_state* s) { std::string_view name_str; std::string_view params_str; @@ -4852,7 +4858,7 @@ bool RGWCopyObj::parse_copy_location(const std::string_view& url_src, if (! params_str.empty()) { RGWHTTPArgs args; args.set(std::string(params_str)); - args.parse(); + args.parse(s); key.instance = args.get("versionId", NULL); } @@ -4882,7 +4888,7 @@ int RGWCopyObj::verify_permission(optional_yield y) return op_ret; } - op_ret = src_bucket->load_by_name(src_tenant_name, src_bucket_name, s->bucket_instance_id, + op_ret = src_bucket->load_by_name(this, src_tenant_name, src_bucket_name, s->bucket_instance_id, s->sysobj_ctx, s->yield); if (op_ret < 0) { if (op_ret == -ENOENT) { @@ -4900,7 +4906,7 @@ int RGWCopyObj::verify_permission(optional_yield y) rgw_placement_rule src_placement; /* check source object permissions */ - op_ret = read_obj_policy(store, s, src_bucket->get_info(), src_bucket->get_attrs(), &src_acl, &src_placement.storage_class, + op_ret = read_obj_policy(this, store, s, src_bucket->get_info(), src_bucket->get_attrs(), &src_acl, &src_placement.storage_class, src_policy, src_bucket.get(), src_object.get(), y); if (op_ret < 0) { return op_ret; @@ -4952,7 +4958,7 @@ int RGWCopyObj::verify_permission(optional_yield y) } return op_ret; } - op_ret = dest_bucket->load_by_name(dest_tenant_name, dest_bucket_name, std::string(), + op_ret = dest_bucket->load_by_name(this, dest_tenant_name, dest_bucket_name, std::string(), s->sysobj_ctx, s->yield); if (op_ret < 0) { if (op_ret == -ENOENT) { @@ -4967,7 +4973,7 @@ int RGWCopyObj::verify_permission(optional_yield y) dest_object->set_atomic(s->obj_ctx); /* check dest bucket permissions */ - op_ret = read_bucket_policy(store, s, dest_bucket->get_info(), + op_ret = read_bucket_policy(this, store, s, dest_bucket->get_info(), dest_bucket->get_attrs(), &dest_bucket_policy, dest_bucket->get_key(), y); if (op_ret < 0) { @@ -5032,7 +5038,7 @@ int RGWCopyObj::init_common() dest_policy.encode(aclbl); emplace_attr(RGW_ATTR_ACL, std::move(aclbl)); - op_ret = rgw_get_request_metadata(s->cct, s->info, attrs); + op_ret = rgw_get_request_metadata(this, s->cct, s->info, attrs); if (op_ret < 0) { return op_ret; } @@ -5097,7 +5103,7 @@ void RGWCopyObj::execute(optional_yield y) if (!s->system_request) { // no quota enforcement for system requests // get src object size (cached in obj_ctx from verify_permission()) RGWObjState* astate = nullptr; - op_ret = src_object->get_obj_state(s->obj_ctx, *src_bucket, &astate, + op_ret = src_object->get_obj_state(this, s->obj_ctx, *src_bucket, &astate, s->yield, true); if (op_ret < 0) { return; @@ -5149,7 +5155,7 @@ void RGWCopyObj::execute(optional_yield y) s->yield); // send request to notification manager - const auto ret = rgw::notify::publish_commit(s->object.get(), s->obj_size, mtime, etag, event_type, res); + const auto ret = rgw::notify::publish_commit(s->object.get(), s->obj_size, mtime, etag, event_type, res, this); if (ret < 0) { ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl; // too late to rollback operation, hence op_ret is not set here @@ -5165,12 +5171,12 @@ int RGWGetACLs::verify_permission(optional_yield y) rgw::IAM::s3GetObjectVersionAcl; if (s->iam_policy && s->iam_policy->has_partial_conditional(S3_EXISTING_OBJTAG)){ - rgw_iam_add_existing_objtags(store, s, iam_action); + rgw_iam_add_existing_objtags(this, store, s, iam_action); } if (! s->iam_user_policies.empty()) { for (auto& user_policy : s->iam_user_policies) { if (user_policy.has_partial_conditional(S3_EXISTING_OBJTAG)) { - rgw_iam_add_existing_objtags(store, s, iam_action); + rgw_iam_add_existing_objtags(this, store, s, iam_action); } } } @@ -5214,7 +5220,7 @@ int RGWPutACLs::verify_permission(optional_yield y) rgw_add_grant_to_iam_environment(s->env, s); if (!rgw::sal::RGWObject::empty(s->object.get())) { auto iam_action = s->object->get_instance().empty() ? rgw::IAM::s3PutObjectAcl : rgw::IAM::s3PutObjectVersionAcl; - op_ret = rgw_iam_add_existing_objtags(store, s, iam_action); + op_ret = rgw_iam_add_existing_objtags(this, store, s, iam_action); perm = verify_object_permission(this, s, iam_action); } else { perm = verify_bucket_permission(this, s, rgw::IAM::s3PutBucketAcl); @@ -5376,7 +5382,7 @@ void RGWPutACLs::execute(optional_yield y) *_dout << dendl; } - op_ret = policy->rebuild(store->ctl()->user, &owner, new_policy, s->err.message); + op_ret = policy->rebuild(this, store->ctl()->user, &owner, new_policy, s->err.message); if (op_ret < 0) return; @@ -5398,13 +5404,13 @@ void RGWPutACLs::execute(optional_yield y) if (!rgw::sal::RGWObject::empty(s->object.get())) { s->object->set_atomic(s->obj_ctx); //if instance is empty, we should modify the latest object - op_ret = s->object->modify_obj_attrs(s->obj_ctx, RGW_ATTR_ACL, bl, s->yield); + op_ret = s->object->modify_obj_attrs(s->obj_ctx, RGW_ATTR_ACL, bl, s->yield, this); } else { map attrs = s->bucket_attrs; attrs[RGW_ATTR_ACL] = bl; op_ret = store->ctl()->bucket->set_bucket_instance_attrs(s->bucket->get_info(), attrs, &s->bucket->get_info().objv_tracker, - s->yield); + s->yield, this); } if (op_ret == -ECANCELED) { op_ret = 0; /* lost a race, but it's ok because acls are immutable */ @@ -5556,10 +5562,10 @@ void RGWPutCORS::execute(optional_yield y) return; } - op_ret = retry_raced_bucket_write(s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { rgw::sal::RGWAttrs attrs(s->bucket_attrs); attrs[RGW_ATTR_CORS] = cors_bl; - return s->bucket->set_instance_attrs(attrs, s->yield); + return s->bucket->set_instance_attrs(this, attrs, s->yield); }); } @@ -5578,7 +5584,7 @@ void RGWDeleteCORS::execute(optional_yield y) return; } - op_ret = retry_raced_bucket_write(s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { op_ret = read_bucket_cors(); if (op_ret < 0) return op_ret; @@ -5591,7 +5597,7 @@ void RGWDeleteCORS::execute(optional_yield y) rgw::sal::RGWAttrs attrs(s->bucket_attrs); attrs.erase(RGW_ATTR_CORS); - op_ret = s->bucket->set_instance_attrs(attrs, s->yield); + op_ret = s->bucket->set_instance_attrs(this, attrs, s->yield); if (op_ret < 0) { ldpp_dout(this, 0) << "RGWLC::RGWDeleteCORS() failed to set attrs on bucket=" << s->bucket->get_name() << " returned err=" << op_ret << dendl; @@ -5694,7 +5700,7 @@ void RGWSetRequestPayment::execute(optional_yield y) return; s->bucket->get_info().requester_pays = requester_pays; - op_ret = s->bucket->put_instance_info(false, real_time()); + op_ret = s->bucket->put_instance_info(this, false, real_time()); if (op_ret < 0) { ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket->get_name() << " returned err=" << op_ret << dendl; @@ -5762,7 +5768,7 @@ void RGWInitMultipart::execute(optional_yield y) if (op_ret != 0) return; - op_ret = rgw_get_request_metadata(s->cct, s->info, attrs); + op_ret = rgw_get_request_metadata(this, s->cct, s->info, attrs); if (op_ret < 0) { return; } @@ -5809,11 +5815,11 @@ void RGWInitMultipart::execute(optional_yield y) op_ret = obj_op->prepare(s->yield); - op_ret = obj_op->write_meta(bl.length(), 0, s->yield); + op_ret = obj_op->write_meta(this, bl.length(), 0, s->yield); } while (op_ret == -EEXIST); // send request to notification manager - const auto ret = rgw::notify::publish_commit(s->object.get(), s->obj_size, ceph::real_clock::now(), attrs[RGW_ATTR_ETAG].to_str(), event_type, res); + const auto ret = rgw::notify::publish_commit(s->object.get(), s->obj_size, ceph::real_clock::now(), attrs[RGW_ATTR_ETAG].to_str(), event_type, res, this); if (ret < 0) { ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl; // too late to rollback operation, hence op_ret is not set here @@ -5961,7 +5967,7 @@ void RGWCompleteMultipart::execute(optional_yield y) return; } - op_ret = meta_obj->get_obj_attrs(s->obj_ctx, s->yield); + op_ret = meta_obj->get_obj_attrs(s->obj_ctx, s->yield, this); if (op_ret < 0) { ldpp_dout(this, 0) << "ERROR: failed to get obj attrs, obj=" << meta_obj << " ret=" << op_ret << dendl; @@ -6118,13 +6124,13 @@ void RGWCompleteMultipart::execute(optional_yield y) if (op_ret < 0) return; - op_ret = obj_op->write_meta(ofs, accounted_size, s->yield); + op_ret = obj_op->write_meta(this, ofs, accounted_size, s->yield); if (op_ret < 0) return; // remove the upload obj string version_id; - int r = meta_obj->delete_object(s->obj_ctx, ACLOwner(), ACLOwner(), ceph::real_time(), false, 0, version_id, null_yield); + int r = meta_obj->delete_object(this, s->obj_ctx, ACLOwner(), ACLOwner(), ceph::real_time(), false, 0, version_id, null_yield); if (r >= 0) { /* serializer's exclusive lock is released */ serializer->clear_locked(); @@ -6133,7 +6139,7 @@ void RGWCompleteMultipart::execute(optional_yield y) } // send request to notification manager - const auto ret = rgw::notify::publish_commit(s->object.get(), ofs, ceph::real_clock::now(), final_etag_str, event_type, res); + const auto ret = rgw::notify::publish_commit(s->object.get(), ofs, ceph::real_clock::now(), final_etag_str, event_type, res, this); if (ret < 0) { ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl; // too late to rollback operation, hence op_ret is not set here @@ -6204,12 +6210,12 @@ void RGWAbortMultipart::execute(optional_yield y) mp.init(s->object->get_name(), upload_id); meta_oid = mp.get_meta(); - op_ret = get_multipart_info(s, meta_oid, nullptr); + op_ret = get_multipart_info(this, s, meta_oid, nullptr); if (op_ret < 0) return; RGWObjectCtx *obj_ctx = static_cast(s->obj_ctx); - op_ret = abort_multipart_upload(store, s->cct, obj_ctx, s->bucket->get_info(), mp); + op_ret = abort_multipart_upload(this, store, s->cct, obj_ctx, s->bucket->get_info(), mp); } int RGWListMultipart::verify_permission(optional_yield y) @@ -6237,7 +6243,7 @@ void RGWListMultipart::execute(optional_yield y) mp.init(s->object->get_name(), upload_id); meta_oid = mp.get_meta(); - op_ret = get_multipart_info(s, meta_oid, nullptr); + op_ret = get_multipart_info(this, s, meta_oid, nullptr); if (op_ret < 0) return; @@ -6283,7 +6289,7 @@ void RGWListBucketMultiparts::execute(optional_yield y) } marker_meta = marker.get_meta(); - op_ret = list_bucket_multiparts(store, s->bucket->get_info(), prefix, marker_meta, delimiter, + op_ret = list_bucket_multiparts(this, store, s->bucket->get_info(), prefix, marker_meta, delimiter, max_uploads, &objs, &common_prefixes, &is_truncated); if (op_ret < 0) { return; @@ -6476,7 +6482,7 @@ void RGWDeleteMultiObj::execute(optional_yield y) // verify_object_lock bool check_obj_lock = obj->have_instance() && bucket->get_info().obj_lock_enabled(); if (check_obj_lock) { - int get_attrs_response = obj->get_obj_attrs(s->obj_ctx, s->yield); + int get_attrs_response = obj->get_obj_attrs(s->obj_ctx, s->yield, this); if (get_attrs_response < 0) { if (get_attrs_response == -ENOENT) { // object maybe delete_marker, skip check_obj_lock @@ -6509,7 +6515,7 @@ void RGWDeleteMultiObj::execute(optional_yield y) obj->set_atomic(obj_ctx); - op_ret = obj->delete_object(obj_ctx, s->owner, s->bucket_owner, ceph::real_time(), + op_ret = obj->delete_object(this, obj_ctx, s->owner, s->bucket_owner, ceph::real_time(), false, 0, version_id, s->yield); if (op_ret == -ENOENT) { op_ret = 0; @@ -6522,7 +6528,7 @@ void RGWDeleteMultiObj::execute(optional_yield y) const auto etag = obj_state->get_attr(RGW_ATTR_ETAG, etag_bl) ? etag_bl.to_str() : ""; // send request to notification manager - const auto ret = rgw::notify::publish_commit(obj.get(), obj_state->size, obj_state->mtime, etag, event_type, res); + const auto ret = rgw::notify::publish_commit(obj.get(), obj_state->size, obj_state->mtime, etag, event_type, res, this); if (ret < 0) { ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl; // too late to rollback operation, hence op_ret is not set here @@ -6550,7 +6556,7 @@ bool RGWBulkDelete::Deleter::verify_permission(RGWBucketInfo& binfo, optional_yield y) { RGWAccessControlPolicy bacl(store->ctx()); - int ret = read_bucket_policy(store, s, binfo, battrs, &bacl, binfo.bucket, y); + int ret = read_bucket_policy(dpp, store, s, binfo, battrs, &bacl, binfo.bucket, y); if (ret < 0) { return false; } @@ -6571,12 +6577,12 @@ bool RGWBulkDelete::Deleter::delete_single(const acct_path_t& path, optional_yie ACLOwner bowner; RGWObjVersionTracker ot; - int ret = store->get_bucket(s->user.get(), s->user->get_tenant(), path.bucket_name, &bucket, y); + int ret = store->get_bucket(dpp, s->user.get(), s->user->get_tenant(), path.bucket_name, &bucket, y); if (ret < 0) { goto binfo_fail; } - ret = bucket->get_bucket_info(s->yield); + ret = bucket->get_bucket_info(dpp, s->yield); if (ret < 0) { goto binfo_fail; } @@ -6594,12 +6600,12 @@ bool RGWBulkDelete::Deleter::delete_single(const acct_path_t& path, optional_yie std::unique_ptr obj = bucket->get_object(path.obj_key); obj->set_atomic(s->obj_ctx); - ret = obj->delete_object(s->obj_ctx, bowner, bucket_owner, ceph::real_time(), false, 0, version_id, s->yield); + ret = obj->delete_object(dpp, s->obj_ctx, bowner, bucket_owner, ceph::real_time(), false, 0, version_id, s->yield); if (ret < 0) { goto delop_fail; } } else { - ret = bucket->remove_bucket(false, string(), string(), true, &s->info, s->yield); + ret = bucket->remove_bucket(dpp, false, string(), string(), true, &s->info, s->yield); if (ret < 0) { goto delop_fail; } @@ -6611,10 +6617,10 @@ bool RGWBulkDelete::Deleter::delete_single(const acct_path_t& path, optional_yie binfo_fail: if (-ENOENT == ret) { - ldpp_dout(s, 20) << "cannot find bucket = " << path.bucket_name << dendl; + ldpp_dout(dpp, 20) << "cannot find bucket = " << path.bucket_name << dendl; num_unfound++; } else { - ldpp_dout(s, 20) << "cannot get bucket info, ret = " << ret << dendl; + ldpp_dout(dpp, 20) << "cannot get bucket info, ret = " << ret << dendl; fail_desc_t failed_item = { .err = ret, @@ -6625,7 +6631,7 @@ binfo_fail: return false; auth_fail: - ldpp_dout(s, 20) << "wrong auth for " << path << dendl; + ldpp_dout(dpp, 20) << "wrong auth for " << path << dendl; { fail_desc_t failed_item = { .err = ret, @@ -6637,7 +6643,7 @@ auth_fail: delop_fail: if (-ENOENT == ret) { - ldpp_dout(s, 20) << "cannot find entry " << path << dendl; + ldpp_dout(dpp, 20) << "cannot find entry " << path << dendl; num_unfound++; } else { fail_desc_t failed_item = { @@ -6651,9 +6657,9 @@ delop_fail: bool RGWBulkDelete::Deleter::delete_chunk(const std::list& paths, optional_yield y) { - ldpp_dout(s, 20) << "in delete_chunk" << dendl; + ldpp_dout(dpp, 20) << "in delete_chunk" << dendl; for (auto path : paths) { - ldpp_dout(s, 20) << "bulk deleting path: " << path << dendl; + ldpp_dout(dpp, 20) << "bulk deleting path: " << path << dendl; delete_single(path, y); } @@ -6775,7 +6781,7 @@ int RGWBulkUploadOp::handle_dir_verify_permission(optional_yield y) if (s->user->get_max_buckets() > 0) { rgw::sal::RGWBucketList buckets; std::string marker; - op_ret = rgw_read_user_buckets(store, s->user->get_user(), buckets, + op_ret = rgw_read_user_buckets(this, store, s->user->get_user(), buckets, marker, std::string(), s->user->get_max_buckets(), false, y); if (op_ret < 0) { @@ -6854,7 +6860,7 @@ int RGWBulkUploadOp::handle_dir(const std::string_view path, optional_yield y) placement_rule.storage_class = s->info.storage_class; forward_req_info(s->cct, info, bucket_name); - op_ret = store->create_bucket(*s->user, new_bucket, + op_ret = store->create_bucket(this, *s->user, new_bucket, store->get_zonegroup().get_id(), placement_rule, swift_ver_location, pquota_info, policy, attrs, @@ -6888,10 +6894,10 @@ int RGWBulkUploadOp::handle_dir(const std::string_view path, optional_yield y) op_ret = store->ctl()->bucket->link_bucket(s->user->get_id(), new_bucket, out_info.creation_time, - s->yield, false); + s->yield, s, false); if (op_ret && !existed && op_ret != -EEXIST) { /* if it exists (or previously existed), don't remove it! */ - op_ret = store->ctl()->bucket->unlink_bucket(s->user->get_id(), new_bucket, s->yield); + op_ret = store->ctl()->bucket->unlink_bucket(s->user->get_id(), new_bucket, s->yield, this); if (op_ret < 0) { ldpp_dout(this, 0) << "WARNING: failed to unlink bucket: ret=" << op_ret << dendl; } @@ -6911,7 +6917,7 @@ bool RGWBulkUploadOp::handle_file_verify_permission(RGWBucketInfo& binfo, optional_yield y) { RGWAccessControlPolicy bacl(store->ctx()); - op_ret = read_bucket_policy(store, s, binfo, battrs, &bacl, binfo.bucket, y); + op_ret = read_bucket_policy(this, store, s, binfo, battrs, &bacl, binfo.bucket, y); if (op_ret < 0) { ldpp_dout(this, 20) << "cannot read_policy() for bucket" << dendl; return false; @@ -6962,7 +6968,7 @@ int RGWBulkUploadOp::handle_file(const std::string_view path, std::unique_ptr bucket; ACLOwner bowner; - op_ret = store->get_bucket(s->user.get(), rgw_bucket(rgw_bucket_key(s->user->get_tenant(), bucket_name)), &bucket, y); + op_ret = store->get_bucket(this, s->user.get(), rgw_bucket(rgw_bucket_key(s->user->get_tenant(), bucket_name)), &bucket, y); if (op_ret == -ENOENT) { ldpp_dout(this, 20) << "non existent directory=" << bucket_name << dendl; } else if (op_ret < 0) { @@ -7260,7 +7266,7 @@ void RGWGetAttrs::execute(optional_yield y) s->object->set_atomic(s->obj_ctx); - op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield); + op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield, this); if (op_ret < 0) { ldpp_dout(this, 0) << "ERROR: failed to get obj attrs, obj=" << s->object << " ret=" << op_ret << dendl; @@ -7316,7 +7322,7 @@ void RGWRMAttrs::execute(optional_yield y) s->object->set_atomic(s->obj_ctx); - op_ret = s->object->set_obj_attrs(s->obj_ctx, nullptr, &attrs, y); + op_ret = s->object->set_obj_attrs(this, s->obj_ctx, nullptr, &attrs, y); if (op_ret < 0) { ldpp_dout(this, 0) << "ERROR: failed to delete obj attrs, obj=" << s->object << " ret=" << op_ret << dendl; @@ -7353,14 +7359,14 @@ void RGWSetAttrs::execute(optional_yield y) if (!rgw::sal::RGWObject::empty(s->object.get())) { rgw::sal::RGWAttrs a(attrs); - op_ret = s->object->set_obj_attrs(s->obj_ctx, &a, nullptr, y); + op_ret = s->object->set_obj_attrs(this, s->obj_ctx, &a, nullptr, y); } else { for (auto& iter : attrs) { s->bucket_attrs[iter.first] = std::move(iter.second); } op_ret = store->ctl()->bucket->set_bucket_instance_attrs( s->bucket->get_info(), attrs, &s->bucket->get_info().objv_tracker, - s->yield); + s->yield, this); } } /* RGWSetAttrs::execute() */ @@ -7378,14 +7384,14 @@ void RGWGetObjLayout::execute(optional_yield y) std::unique_ptr stat_op(s->object->get_read_op(s->obj_ctx)); - op_ret = stat_op->prepare(y); + op_ret = stat_op->prepare(y, this); if (op_ret < 0) { return; } head_obj = stat_op->result.head_obj; - op_ret = stat_op->get_manifest(&manifest, y); + op_ret = stat_op->get_manifest(this, &manifest, y); } @@ -7413,7 +7419,7 @@ void RGWConfigBucketMetaSearch::execute(optional_yield y) s->bucket->get_info().mdsearch_config = mdsearch_config; - op_ret = s->bucket->put_instance_info(false, real_time()); + op_ret = s->bucket->put_instance_info(this, false, real_time()); if (op_ret < 0) { ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket->get_name() << " returned err=" << op_ret << dendl; @@ -7454,7 +7460,7 @@ void RGWDelBucketMetaSearch::execute(optional_yield y) { s->bucket->get_info().mdsearch_config.clear(); - op_ret = s->bucket->put_instance_info(false, real_time()); + op_ret = s->bucket->put_instance_info(this, false, real_time()); if (op_ret < 0) { ldpp_dout(this, 0) << "NOTICE: put_bucket_info on bucket=" << s->bucket->get_name() << " returned err=" << op_ret << dendl; @@ -7478,9 +7484,9 @@ int RGWHandler::init(rgw::sal::RGWRadosStore *_store, return 0; } -int RGWHandler::do_init_permissions(optional_yield y) +int RGWHandler::do_init_permissions(const DoutPrefixProvider *dpp, optional_yield y) { - int ret = rgw_build_bucket_policies(store, s, y); + int ret = rgw_build_bucket_policies(dpp, store, s, y); if (ret < 0) { ldpp_dout(s, 10) << "init_permissions on " << s->bucket << " failed, ret=" << ret << dendl; @@ -7497,7 +7503,7 @@ int RGWHandler::do_read_permissions(RGWOp *op, bool only_bucket, optional_yield /* already read bucket info */ return 0; } - int ret = rgw_build_object_policies(store, s, op->prefetch_data(), y); + int ret = rgw_build_object_policies(op, store, s, op->prefetch_data(), y); if (ret < 0) { ldpp_dout(op, 10) << "read_permissions on " << s->bucket << ":" @@ -7591,10 +7597,10 @@ void RGWPutBucketPolicy::execute(optional_yield y) return; } - op_ret = retry_raced_bucket_write(s->bucket.get(), [&p, this, &attrs] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [&p, this, &attrs] { attrs[RGW_ATTR_IAM_POLICY].clear(); attrs[RGW_ATTR_IAM_POLICY].append(p.text); - op_ret = s->bucket->set_instance_attrs(attrs, s->yield); + op_ret = s->bucket->set_instance_attrs(this, attrs, s->yield); return op_ret; }); } catch (rgw::IAM::PolicyParseException& e) { @@ -7665,10 +7671,10 @@ int RGWDeleteBucketPolicy::verify_permission(optional_yield y) void RGWDeleteBucketPolicy::execute(optional_yield y) { - op_ret = retry_raced_bucket_write(s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { rgw::sal::RGWAttrs attrs(s->bucket_attrs); attrs.erase(RGW_ATTR_IAM_POLICY); - op_ret = s->bucket->set_instance_attrs(attrs, s->yield); + op_ret = s->bucket->set_instance_attrs(this, attrs, s->yield); return op_ret; }); } @@ -7725,9 +7731,9 @@ void RGWPutBucketObjectLock::execute(optional_yield y) return; } - op_ret = retry_raced_bucket_write(s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { s->bucket->get_info().obj_lock = obj_lock; - op_ret = s->bucket->put_instance_info(false, real_time()); + op_ret = s->bucket->put_instance_info(this, false, real_time()); return op_ret; }); return; @@ -7808,7 +7814,7 @@ void RGWPutObjRetention::execute(optional_yield y) obj_retention.encode(bl); //check old retention - op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield); + op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield, this); if (op_ret < 0) { ldpp_dout(this, 0) << "ERROR: get obj attr error"<< dendl; return; @@ -7832,7 +7838,7 @@ void RGWPutObjRetention::execute(optional_yield y) } } - op_ret = s->object->modify_obj_attrs(s->obj_ctx, RGW_ATTR_OBJECT_RETENTION, bl, s->yield); + op_ret = s->object->modify_obj_attrs(s->obj_ctx, RGW_ATTR_OBJECT_RETENTION, bl, s->yield, this); return; } @@ -7857,7 +7863,7 @@ void RGWGetObjRetention::execute(optional_yield y) op_ret = -ERR_INVALID_REQUEST; return; } - op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield); + op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield, this); if (op_ret < 0) { ldpp_dout(this, 0) << "ERROR: failed to get obj attrs, obj=" << s->object << " ret=" << op_ret << dendl; @@ -7927,7 +7933,7 @@ void RGWPutObjLegalHold::execute(optional_yield y) { bufferlist bl; obj_legal_hold.encode(bl); //if instance is empty, we should modify the latest object - op_ret = s->object->modify_obj_attrs(s->obj_ctx, RGW_ATTR_OBJECT_LEGAL_HOLD, bl, s->yield); + op_ret = s->object->modify_obj_attrs(s->obj_ctx, RGW_ATTR_OBJECT_LEGAL_HOLD, bl, s->yield, this); return; } @@ -7952,7 +7958,7 @@ void RGWGetObjLegalHold::execute(optional_yield y) return; } map attrs; - op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield); + op_ret = s->object->get_obj_attrs(s->obj_ctx, s->yield, this); if (op_ret < 0) { ldpp_dout(this, 0) << "ERROR: failed to get obj attrs, obj=" << s->object << " ret=" << op_ret << dendl; @@ -8046,10 +8052,10 @@ void RGWPutBucketPublicAccessBlock::execute(optional_yield y) bufferlist bl; access_conf.encode(bl); - op_ret = retry_raced_bucket_write(s->bucket.get(), [this, &bl] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this, &bl] { rgw::sal::RGWAttrs attrs(s->bucket_attrs); attrs[RGW_ATTR_PUBLIC_ACCESS] = bl; - return s->bucket->set_instance_attrs(attrs, s->yield); + return s->bucket->set_instance_attrs(this, attrs, s->yield); }); } @@ -8105,10 +8111,10 @@ int RGWDeleteBucketPublicAccessBlock::verify_permission(optional_yield y) void RGWDeleteBucketPublicAccessBlock::execute(optional_yield y) { - op_ret = retry_raced_bucket_write(s->bucket.get(), [this] { + op_ret = retry_raced_bucket_write(this, s->bucket.get(), [this] { rgw::sal::RGWAttrs attrs(s->bucket_attrs); attrs.erase(RGW_ATTR_PUBLIC_ACCESS); - op_ret = s->bucket->set_instance_attrs(attrs, s->yield); + op_ret = s->bucket->set_instance_attrs(this, attrs, s->yield); return op_ret; }); } diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index 33ed580782dff..48f27de297c91 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -74,7 +74,8 @@ class StrategyRegistry; } } -int rgw_op_get_bucket_policy_from_attr(CephContext *cct, +int rgw_op_get_bucket_policy_from_attr(const DoutPrefixProvider *dpp, + CephContext *cct, rgw::sal::RGWStore *store, RGWBucketInfo& bucket_info, map& bucket_attrs, @@ -86,7 +87,7 @@ protected: rgw::sal::RGWRadosStore* store{nullptr}; struct req_state *s{nullptr}; - int do_init_permissions(optional_yield y); + int do_init_permissions(const DoutPrefixProvider *dpp, optional_yield y); int do_read_permissions(RGWOp* op, bool only_bucket, optional_yield y); public: @@ -1475,7 +1476,8 @@ public: static bool parse_copy_location(const std::string_view& src, string& bucket_name, - rgw_obj_key& object); + rgw_obj_key& object, + struct req_state *s); void emplace_attr(std::string&& key, buffer::list&& bl) { attrs.emplace(std::move(key), std::move(bl)); @@ -1945,8 +1947,8 @@ public: uint32_t op_mask() override { return RGW_OP_TYPE_READ; } }; -extern int rgw_build_bucket_policies(rgw::sal::RGWRadosStore* store, struct req_state* s, optional_yield y); -extern int rgw_build_object_policies(rgw::sal::RGWRadosStore *store, struct req_state *s, +extern int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore* store, struct req_state* s, optional_yield y); +extern int rgw_build_object_policies(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, struct req_state *s, bool prefetch_data, optional_yield y); extern void rgw_build_iam_environment(rgw::sal::RGWRadosStore* store, struct req_state* s); @@ -2013,7 +2015,8 @@ static inline void format_xattr(std::string &xattr) * On failure returns a negative error code. * */ -inline int rgw_get_request_metadata(CephContext* const cct, +inline int rgw_get_request_metadata(const DoutPrefixProvider *dpp, + CephContext* const cct, struct req_info& info, std::map& attrs, const bool allow_empty_attrs = true) @@ -2031,10 +2034,10 @@ inline int rgw_get_request_metadata(CephContext* const cct, std::string& xattr = kv.second; if (blocklisted_headers.count(name) == 1) { - lsubdout(cct, rgw, 10) << "skipping x>> " << name << dendl; + ldpp_dout(dpp, 10) << "skipping x>> " << name << dendl; continue; } else if (allow_empty_attrs || !xattr.empty()) { - lsubdout(cct, rgw, 10) << "x>> " << name << ":" << xattr << dendl; + ldpp_dout(dpp, 10) << "x>> " << name << ":" << xattr << dendl; format_xattr(xattr); std::string attr_name(RGW_ATTR_PREFIX); diff --git a/src/rgw/rgw_orphan.cc b/src/rgw/rgw_orphan.cc index 4aae077961082..50574e4ac8897 100644 --- a/src/rgw/rgw_orphan.cc +++ b/src/rgw/rgw_orphan.cc @@ -486,7 +486,7 @@ done: return ret; } -int RGWOrphanSearch::build_linked_oids_for_bucket(const string& bucket_instance_id, map >& oids) +int RGWOrphanSearch::build_linked_oids_for_bucket(const DoutPrefixProvider *dpp, const string& bucket_instance_id, map >& oids) { RGWObjectCtx obj_ctx(store); auto sysobj_ctx = store->svc()->sysobj->init_obj_ctx(); @@ -503,7 +503,7 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const string& bucket_instance_ RGWBucketInfo cur_bucket_info; ret = store->getRados()->get_bucket_info(store->svc(), orphan_bucket.tenant, - orphan_bucket.name, cur_bucket_info, nullptr, null_yield); + orphan_bucket.name, cur_bucket_info, nullptr, null_yield, dpp); if (ret < 0) { if (ret == -ENOENT) { /* probably raced with bucket removal */ @@ -528,7 +528,7 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const string& bucket_instance_ } RGWBucketInfo bucket_info; - ret = store->getRados()->get_bucket_instance_info(sysobj_ctx, bucket_instance_id, bucket_info, nullptr, nullptr, null_yield); + ret = store->getRados()->get_bucket_instance_info(sysobj_ctx, bucket_instance_id, bucket_info, nullptr, nullptr, null_yield, dpp); if (ret < 0) { if (ret == -ENOENT) { /* probably raced with bucket removal */ @@ -554,7 +554,7 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const string& bucket_instance_ do { vector result; - ret = list_op.list_objects(max_list_bucket_entries, + ret = list_op.list_objects(dpp, max_list_bucket_entries, &result, nullptr, &truncated, null_yield); if (ret < 0) { cerr << "ERROR: store->list_objects(): " << cpp_strerror(-ret) << std::endl; @@ -622,7 +622,7 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const string& bucket_instance_ return 0; } -int RGWOrphanSearch::build_linked_oids_index() +int RGWOrphanSearch::build_linked_oids_index(const DoutPrefixProvider *dpp) { map > oids; map::iterator iter = buckets_instance_index.find(search_stage.shard); @@ -651,7 +651,7 @@ int RGWOrphanSearch::build_linked_oids_index() for (map::iterator eiter = entries.begin(); eiter != entries.end(); ++eiter) { ldout(store->ctx(), 20) << " indexed entry: " << eiter->first << dendl; - ret = build_linked_oids_for_bucket(eiter->first, oids); + ret = build_linked_oids_for_bucket(dpp, eiter->first, oids); if (ret < 0) { lderr(store->ctx()) << __func__ << ": ERROR: build_linked_oids_for_bucket() indexed entry=" << eiter->first << " returned ret=" << ret << dendl; @@ -804,7 +804,7 @@ int RGWOrphanSearch::compare_oid_indexes() return 0; } -int RGWOrphanSearch::run() +int RGWOrphanSearch::run(const DoutPrefixProvider *dpp) { int r; @@ -854,7 +854,7 @@ int RGWOrphanSearch::run() case ORPHAN_SEARCH_STAGE_ITERATE_BI: ldout(store->ctx(), 0) << __func__ << "(): building index of all linked objects" << dendl; - r = build_linked_oids_index(); + r = build_linked_oids_index(dpp); if (r < 0) { lderr(store->ctx()) << __func__ << ": ERROR: build_all_objs_index returned ret=" << r << dendl; return r; @@ -1143,6 +1143,7 @@ int RGWRadosList::build_buckets_instance_index() int RGWRadosList::process_bucket( + const DoutPrefixProvider *dpp, const std::string& bucket_instance_id, const std::string& prefix, const std::set& entries_filter) @@ -1159,7 +1160,8 @@ int RGWRadosList::process_bucket( bucket_info, nullptr, nullptr, - null_yield); + null_yield, + dpp); if (ret < 0) { if (ret == -ENOENT) { // probably raced with bucket removal @@ -1192,7 +1194,7 @@ int RGWRadosList::process_bucket( std::vector result; constexpr int64_t LIST_OBJS_MAX_ENTRIES = 100; - ret = list_op.list_objects(LIST_OBJS_MAX_ENTRIES, &result, + ret = list_op.list_objects(dpp, LIST_OBJS_MAX_ENTRIES, &result, NULL, &truncated, null_yield); if (ret == -ENOENT) { // race with bucket delete? @@ -1302,7 +1304,7 @@ int RGWRadosList::process_bucket( } -int RGWRadosList::run() +int RGWRadosList::run(const DoutPrefixProvider *dpp) { int ret; void* handle = nullptr; @@ -1324,7 +1326,7 @@ int RGWRadosList::run() buckets, &truncated); for (std::string& bucket_id : buckets) { - ret = run(bucket_id); + ret = run(dpp, bucket_id); if (ret == -ENOENT) { continue; } else if (ret < 0) { @@ -1337,7 +1339,7 @@ int RGWRadosList::run() } // RGWRadosList::run() -int RGWRadosList::run(const std::string& start_bucket_name) +int RGWRadosList::run(const DoutPrefixProvider *dpp, const std::string& start_bucket_name) { RGWSysObjectCtx sys_obj_ctx = store->svc()->sysobj->init_obj_ctx(); RGWObjectCtx obj_ctx(store); @@ -1359,7 +1361,8 @@ int RGWRadosList::run(const std::string& start_bucket_name) bucket_name, bucket_info, nullptr, - null_yield); + null_yield, + dpp); if (ret == -ENOENT) { std::cerr << "WARNING: bucket " << bucket_name << " does not exist; could it have been deleted very recently?" << @@ -1377,10 +1380,10 @@ int RGWRadosList::run(const std::string& start_bucket_name) static const std::string empty_prefix; auto do_process_bucket = - [&bucket_id, this] + [dpp, &bucket_id, this] (const std::string& prefix, const std::set& entries_filter) -> int { - int ret = process_bucket(bucket_id, prefix, entries_filter); + int ret = process_bucket(dpp, bucket_id, prefix, entries_filter); if (ret == -ENOENT) { // bucket deletion race? return 0; @@ -1425,7 +1428,8 @@ int RGWRadosList::run(const std::string& start_bucket_name) start_bucket_name, bucket_info, nullptr, - null_yield); + null_yield, + dpp); if (ret == -ENOENT) { // bucket deletion race? return 0; @@ -1435,7 +1439,7 @@ int RGWRadosList::run(const std::string& start_bucket_name) return ret; } - ret = do_incomplete_multipart(store, bucket_info); + ret = do_incomplete_multipart(dpp, store, bucket_info); if (ret < 0) { lderr(store->ctx()) << "RGWRadosList::" << __func__ << ": ERROR: do_incomplete_multipart returned ret=" << ret << dendl; @@ -1447,6 +1451,7 @@ int RGWRadosList::run(const std::string& start_bucket_name) int RGWRadosList::do_incomplete_multipart( + const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore* store, RGWBucketInfo& bucket_info) { @@ -1469,7 +1474,7 @@ int RGWRadosList::do_incomplete_multipart( do { std::vector objs; std::map common_prefixes; - ret = list_op.list_objects(max_uploads, &objs, &common_prefixes, + ret = list_op.list_objects(dpp, max_uploads, &objs, &common_prefixes, &is_listing_truncated, null_yield); if (ret == -ENOENT) { // could bucket have been removed while this is running? diff --git a/src/rgw/rgw_orphan.h b/src/rgw/rgw_orphan.h index ae1e61b780e7d..fc4fc0ea16f5a 100644 --- a/src/rgw/rgw_orphan.h +++ b/src/rgw/rgw_orphan.h @@ -201,11 +201,11 @@ public: int build_all_oids_index(); int build_buckets_instance_index(); - int build_linked_oids_for_bucket(const string& bucket_instance_id, map >& oids); - int build_linked_oids_index(); + int build_linked_oids_for_bucket(const DoutPrefixProvider *dpp, const string& bucket_instance_id, map >& oids); + int build_linked_oids_index(const DoutPrefixProvider *dpp); int compare_oid_indexes(); - int run(); + int run(const DoutPrefixProvider *dpp); int finish(); }; @@ -275,17 +275,19 @@ public: tenant_name(_tenant_name) {} - int process_bucket(const std::string& bucket_instance_id, + int process_bucket(const DoutPrefixProvider *dpp, + const std::string& bucket_instance_id, const std::string& prefix, const std::set& entries_filter); - int do_incomplete_multipart(rgw::sal::RGWRadosStore* store, + int do_incomplete_multipart(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore* store, RGWBucketInfo& bucket_info); int build_linked_oids_index(); - int run(const std::string& bucket_id); - int run(); + int run(const DoutPrefixProvider *dpp, const std::string& bucket_id); + int run(const DoutPrefixProvider *dpp); }; // class RGWRadosList #endif diff --git a/src/rgw/rgw_os_lib.cc b/src/rgw/rgw_os_lib.cc index d9b58f24319dd..5742a9c6f555b 100644 --- a/src/rgw/rgw_os_lib.cc +++ b/src/rgw/rgw_os_lib.cc @@ -29,7 +29,7 @@ namespace rgw { } s->info.args.set(p); - s->info.args.parse(); + s->info.args.parse(s); if (*req_name != '/') return 0; diff --git a/src/rgw/rgw_otp.cc b/src/rgw/rgw_otp.cc index 30d825cb3ca3b..7417fe608049e 100644 --- a/src/rgw/rgw_otp.cc +++ b/src/rgw/rgw_otp.cc @@ -91,7 +91,7 @@ class RGWOTPMetadataHandler : public RGWOTPMetadataHandlerBase { return new RGWOTPMetadataObject(std::move(devices), objv, mtime); } - int do_get(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject **obj, optional_yield y) override { + int do_get(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject **obj, optional_yield y, const DoutPrefixProvider *dpp) override { RGWObjVersionTracker objv_tracker; std::unique_ptr mdo(new RGWOTPMetadataObject); @@ -104,7 +104,8 @@ class RGWOTPMetadataHandler : public RGWOTPMetadataHandlerBase { &mdo->get_devs(), &mdo->get_mtime(), &objv_tracker, - y); + y, + dpp); if (ret < 0) { return ret; } @@ -119,6 +120,7 @@ class RGWOTPMetadataHandler : public RGWOTPMetadataHandlerBase { int do_put(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject *_obj, RGWObjVersionTracker& objv_tracker, optional_yield y, + const DoutPrefixProvider *dpp, RGWMDLogSyncType type, bool from_remote_zone) override { RGWOTPMetadataObject *obj = static_cast(_obj); @@ -138,7 +140,7 @@ class RGWOTPMetadataHandler : public RGWOTPMetadataHandlerBase { } int do_remove(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWObjVersionTracker& objv_tracker, - optional_yield y) override { + optional_yield y, const DoutPrefixProvider *dpp) override { RGWSI_MBOTP_RemoveParams params; RGWSI_OTP_BE_Ctx be_ctx(op->ctx()); @@ -173,11 +175,12 @@ void RGWOTPCtl::init(RGWOTPMetadataHandler *_meta_handler) int RGWOTPCtl::read_all(const rgw_user& uid, RGWOTPInfo *info, optional_yield y, + const DoutPrefixProvider *dpp, const GetParams& params) { info->uid = uid; return meta_handler->call([&](RGWSI_OTP_BE_Ctx& ctx) { - return svc.otp->read_all(ctx, uid, &info->devices, params.mtime, params.objv_tracker, y); + return svc.otp->read_all(ctx, uid, &info->devices, params.mtime, params.objv_tracker, y, dpp); }); } diff --git a/src/rgw/rgw_otp.h b/src/rgw/rgw_otp.h index ca323b5f1e79b..57ef4b2a26545 100644 --- a/src/rgw/rgw_otp.h +++ b/src/rgw/rgw_otp.h @@ -103,6 +103,7 @@ public: }; int read_all(const rgw_user& uid, RGWOTPInfo *info, optional_yield y, + const DoutPrefixProvider *dpp, const GetParams& params = {}); int store_all(const RGWOTPInfo& info, optional_yield y, const PutParams& params = {}); diff --git a/src/rgw/rgw_process.cc b/src/rgw/rgw_process.cc index 39d207b86aa5f..57c72e9365c46 100644 --- a/src/rgw/rgw_process.cc +++ b/src/rgw/rgw_process.cc @@ -231,7 +231,7 @@ int process_request(rgw::sal::RGWRadosStore* const store, abort_early(s, nullptr, init_error, nullptr, yield); goto done; } - dout(10) << "handler=" << typeid(*handler).name() << dendl; + ldpp_dout(s, 10) << "handler=" << typeid(*handler).name() << dendl; should_log = mgr->get_logging(); @@ -265,7 +265,7 @@ int process_request(rgw::sal::RGWRadosStore* const store, goto done; } req->op = op; - dout(10) << "op=" << typeid(*op).name() << dendl; + ldpp_dout(op, 10) << "op=" << typeid(*op).name() << dendl; s->op_type = op->get_type(); diff --git a/src/rgw/rgw_pubsub.cc b/src/rgw/rgw_pubsub.cc index f1bacc83710eb..5af3240863ac8 100644 --- a/src/rgw/rgw_pubsub.cc +++ b/src/rgw/rgw_pubsub.cc @@ -841,7 +841,7 @@ void RGWPubSub::SubWithEvents::list_events_result::dump(Formatter *f) } template -int RGWPubSub::SubWithEvents::list_events(const string& marker, int max_events) +int RGWPubSub::SubWithEvents::list_events(const DoutPrefixProvider *dpp, const string& marker, int max_events) { RGWRados *store = ps->store->getRados(); rgw_pubsub_sub_config sub_conf; @@ -871,7 +871,7 @@ int RGWPubSub::SubWithEvents::list_events(const string& marker, int m std::vector objs; - ret = list_op.list_objects(max_events, &objs, nullptr, &list.is_truncated, null_yield); + ret = list_op.list_objects(dpp, max_events, &objs, nullptr, &list.is_truncated, null_yield); if (ret < 0) { ldout(store->ctx(), 1) << "ERROR: failed to list bucket: bucket=" << sub_conf.dest.bucket_name << " ret=" << ret << dendl; return ret; @@ -906,7 +906,7 @@ int RGWPubSub::SubWithEvents::list_events(const string& marker, int m } template -int RGWPubSub::SubWithEvents::remove_event(const string& event_id) +int RGWPubSub::SubWithEvents::remove_event(const DoutPrefixProvider *dpp, const string& event_id) { rgw::sal::RGWRadosStore *store = ps->store; rgw_pubsub_sub_config sub_conf; @@ -937,7 +937,7 @@ int RGWPubSub::SubWithEvents::remove_event(const string& event_id) del_op.params.bucket_owner = bucket_info.owner; del_op.params.versioning_status = bucket_info.versioning_status(); - ret = del_op.delete_obj(null_yield); + ret = del_op.delete_obj(null_yield, dpp); if (ret < 0) { ldout(store->ctx(), 1) << "ERROR: failed to remove event (obj=" << obj << "): ret=" << ret << dendl; } diff --git a/src/rgw/rgw_pubsub.h b/src/rgw/rgw_pubsub.h index 6d4d382affe95..80c93bd87fc83 100644 --- a/src/rgw/rgw_pubsub.h +++ b/src/rgw/rgw_pubsub.h @@ -694,8 +694,8 @@ public: static const int DEFAULT_MAX_EVENTS = 100; // followint virtual methods should only be called in derived - virtual int list_events(const string& marker, int max_events) {ceph_assert(false);} - virtual int remove_event(const string& event_id) {ceph_assert(false);} + virtual int list_events(const DoutPrefixProvider *dpp, const string& marker, int max_events) {ceph_assert(false);} + virtual int remove_event(const DoutPrefixProvider *dpp, const string& event_id) {ceph_assert(false);} virtual void dump(Formatter* f) const {ceph_assert(false);} }; @@ -715,8 +715,8 @@ public: virtual ~SubWithEvents() = default; - int list_events(const string& marker, int max_events) override; - int remove_event(const string& event_id) override; + int list_events(const DoutPrefixProvider *dpp, const string& marker, int max_events) override; + int remove_event(const DoutPrefixProvider *dpp, const string& event_id) override; void dump(Formatter* f) const override; }; diff --git a/src/rgw/rgw_putobj_processor.cc b/src/rgw/rgw_putobj_processor.cc index 11b8db58499fb..66428b2c16deb 100644 --- a/src/rgw/rgw_putobj_processor.cc +++ b/src/rgw/rgw_putobj_processor.cc @@ -158,7 +158,7 @@ RadosWriter::~RadosWriter() if (need_to_remove_head) { std::string version_id; ldpp_dout(dpp, 5) << "NOTE: we are going to process the head obj (" << *raw_head << ")" << dendl; - int r = head_obj->delete_object(&obj_ctx, ACLOwner(), bucket->get_acl_owner(), ceph::real_time(), + int r = head_obj->delete_object(dpp, &obj_ctx, ACLOwner(), bucket->get_acl_owner(), ceph::real_time(), false, 0, version_id, null_yield); if (r < 0 && r != -ENOENT) { ldpp_dout(dpp, 0) << "WARNING: failed to remove obj (" << *raw_head << "), leaked" << dendl; @@ -179,7 +179,7 @@ int ManifestObjectProcessor::next(uint64_t offset, uint64_t *pstripe_size) rgw_raw_obj stripe_obj = manifest_gen.get_cur_obj(store); uint64_t chunk_size = 0; - r = store->get_raw_chunk_size(stripe_obj, &chunk_size); + r = store->get_raw_chunk_size(dpp, stripe_obj, &chunk_size); if (r < 0) { return r; } @@ -210,7 +210,7 @@ int AtomicObjectProcessor::prepare(optional_yield y) uint64_t chunk_size = 0; uint64_t alignment; - int r = head_obj->get_max_chunk_size(bucket->get_placement_rule(), + int r = head_obj->get_max_chunk_size(dpp, bucket->get_placement_rule(), &max_head_chunk_size, &alignment); if (r < 0) { return r; @@ -220,7 +220,7 @@ int AtomicObjectProcessor::prepare(optional_yield y) if (bucket->get_placement_rule() != tail_placement_rule) { if (!head_obj->placement_rules_match(bucket->get_placement_rule(), tail_placement_rule)) { same_pool = false; - r = head_obj->get_max_chunk_size(tail_placement_rule, &chunk_size); + r = head_obj->get_max_chunk_size(dpp, tail_placement_rule, &chunk_size); if (r < 0) { return r; } @@ -313,7 +313,7 @@ int AtomicObjectProcessor::complete(size_t accounted_size, return r; } - r = obj_op->write_meta(actual_size, accounted_size, y); + r = obj_op->write_meta(dpp, actual_size, accounted_size, y); if (r < 0) { return r; } @@ -362,7 +362,7 @@ int MultipartObjectProcessor::prepare_head() uint64_t stripe_size; uint64_t alignment; - int r = target_obj->get_max_chunk_size(tail_placement_rule, &chunk_size, &alignment); + int r = target_obj->get_max_chunk_size(dpp, tail_placement_rule, &chunk_size, &alignment); if (r < 0) { ldpp_dout(dpp, 0) << "ERROR: unexpected: get_max_chunk_size(): placement_rule=" << tail_placement_rule.to_str() << " obj=" << target_obj << " returned r=" << r << dendl; return r; @@ -440,7 +440,7 @@ int MultipartObjectProcessor::complete(size_t accounted_size, return r; } - r = obj_op->write_meta(actual_size, accounted_size, y); + r = obj_op->write_meta(dpp, actual_size, accounted_size, y); if (r < 0) return r; @@ -504,7 +504,7 @@ int AppendObjectProcessor::process_first_chunk(bufferlist &&data, rgw::putobj::D int AppendObjectProcessor::prepare(optional_yield y) { RGWObjState *astate; - int r = head_obj->get_obj_state(&obj_ctx, *bucket, &astate, y); + int r = head_obj->get_obj_state(dpp, &obj_ctx, *bucket, &astate, y); if (r < 0) { return r; } @@ -571,7 +571,7 @@ int AppendObjectProcessor::prepare(optional_yield y) rgw_raw_obj stripe_obj = manifest_gen.get_cur_obj(store); uint64_t chunk_size = 0; - r = store->get_raw_chunk_size(stripe_obj, &chunk_size); + r = store->get_raw_chunk_size(dpp, stripe_obj, &chunk_size); if (r < 0) { return r; } @@ -654,7 +654,7 @@ int AppendObjectProcessor::complete(size_t accounted_size, const string &etag, c if (r < 0) { return r; } - r = obj_op->write_meta(actual_size + cur_size, accounted_size + *cur_accounted_size, y); + r = obj_op->write_meta(dpp, actual_size + cur_size, accounted_size + *cur_accounted_size, y); if (r < 0) { return r; } diff --git a/src/rgw/rgw_quota.cc b/src/rgw/rgw_quota.cc index 49ec8f10517a7..2b26362472128 100644 --- a/src/rgw/rgw_quota.cc +++ b/src/rgw/rgw_quota.cc @@ -65,7 +65,7 @@ protected: } }; - virtual int fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, optional_yield y) = 0; + virtual int fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, optional_yield y, const DoutPrefixProvider *dpp) = 0; virtual bool map_find(const rgw_user& user, const rgw_bucket& bucket, RGWQuotaCacheStats& qs) = 0; @@ -81,7 +81,7 @@ public: async_refcount->put_wait(); /* wait for all pending async requests to complete */ } - int get_stats(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, RGWQuotaInfo& quota, optional_yield y); + int get_stats(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, RGWQuotaInfo& quota, optional_yield y, const DoutPrefixProvider *dpp); void adjust_stats(const rgw_user& user, rgw_bucket& bucket, int objs_delta, uint64_t added_bytes, uint64_t removed_bytes); virtual bool can_use_cached_stats(RGWQuotaInfo& quota, RGWStorageStats& stats); @@ -196,7 +196,7 @@ void RGWQuotaCache::set_stats(const rgw_user& user, const rgw_bucket& bucket, } template -int RGWQuotaCache::get_stats(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, RGWQuotaInfo& quota, optional_yield y) { +int RGWQuotaCache::get_stats(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, RGWQuotaInfo& quota, optional_yield y, const DoutPrefixProvider *dpp) { RGWQuotaCacheStats qs; utime_t now = ceph_clock_now(); if (map_find(user, bucket, qs)) { @@ -216,7 +216,7 @@ int RGWQuotaCache::get_stats(const rgw_user& user, const rgw_bucket& bucket, } } - int ret = fetch_stats_from_storage(user, bucket, stats, y); + int ret = fetch_stats_from_storage(user, bucket, stats, y, dpp); if (ret < 0 && ret != -ENOENT) return ret; @@ -297,7 +297,8 @@ int BucketAsyncRefreshHandler::init_fetch() auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); - int r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket, bucket_info, NULL, NULL, null_yield); + const DoutPrefix dp(store->ctx(), dout_subsys, "rgw bucket async refresh handler: "); + int r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket, bucket_info, NULL, NULL, null_yield, &dp); if (r < 0) { ldout(store->ctx(), 0) << "could not get bucket info for bucket=" << bucket << " r=" << r << dendl; return r; @@ -351,7 +352,7 @@ protected: stats_map.add(bucket, qs); } - int fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, optional_yield y) override; + int fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, optional_yield y, const DoutPrefixProvider *dpp) override; public: explicit RGWBucketStatsCache(rgw::sal::RGWRadosStore *_store) : RGWQuotaCache(_store, _store->ctx()->_conf->rgw_bucket_quota_cache_size) { @@ -362,13 +363,13 @@ public: } }; -int RGWBucketStatsCache::fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, optional_yield y) +int RGWBucketStatsCache::fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, optional_yield y, const DoutPrefixProvider *dpp) { RGWBucketInfo bucket_info; RGWSysObjectCtx obj_ctx = store->svc()->sysobj->init_obj_ctx(); - int r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket, bucket_info, NULL, NULL, y); + int r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket, bucket_info, NULL, NULL, y, dpp); if (r < 0) { ldout(store->ctx(), 0) << "could not get bucket info for bucket=" << bucket << " r=" << r << dendl; return r; @@ -466,7 +467,8 @@ class RGWUserStatsCache : public RGWQuotaCache { rgw_bucket bucket = iter->first; rgw_user& user = iter->second; ldout(cct, 20) << "BucketsSyncThread: sync user=" << user << " bucket=" << bucket << dendl; - int r = stats->sync_bucket(user, bucket, null_yield); + const DoutPrefix dp(cct, dout_subsys, "rgw bucket sync thread: "); + int r = stats->sync_bucket(user, bucket, null_yield, &dp); if (r < 0) { ldout(cct, 0) << "WARNING: sync_bucket() returned r=" << r << dendl; } @@ -511,7 +513,8 @@ class RGWUserStatsCache : public RGWQuotaCache { void *entry() override { ldout(cct, 20) << "UserSyncThread: start" << dendl; do { - int ret = stats->sync_all_users(null_yield); + const DoutPrefix dp(cct, dout_subsys, "rgw user sync thread: "); + int ret = stats->sync_all_users(&dp, null_yield); if (ret < 0) { ldout(cct, 5) << "ERROR: sync_all_users() returned ret=" << ret << dendl; } @@ -548,10 +551,10 @@ protected: stats_map.add(user, qs); } - int fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, optional_yield y) override; - int sync_bucket(const rgw_user& rgw_user, rgw_bucket& bucket, optional_yield y); - int sync_user(const rgw_user& user, optional_yield y); - int sync_all_users(optional_yield y); + int fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, optional_yield y, const DoutPrefixProvider *dpp) override; + int sync_bucket(const rgw_user& rgw_user, rgw_bucket& bucket, optional_yield y, const DoutPrefixProvider *dpp); + int sync_user(const DoutPrefixProvider *dpp, const rgw_user& user, optional_yield y); + int sync_all_users(const DoutPrefixProvider *dpp, optional_yield y); void data_modified(const rgw_user& user, rgw_bucket& bucket) override; @@ -618,7 +621,8 @@ public: int RGWUserStatsCache::fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { int r = store->ctl()->user->read_stats(user, &stats, y); if (r < 0) { @@ -629,11 +633,11 @@ int RGWUserStatsCache::fetch_stats_from_storage(const rgw_user& user, return 0; } -int RGWUserStatsCache::sync_bucket(const rgw_user& user, rgw_bucket& bucket, optional_yield y) +int RGWUserStatsCache::sync_bucket(const rgw_user& user, rgw_bucket& bucket, optional_yield y, const DoutPrefixProvider *dpp) { RGWBucketInfo bucket_info; - int r = store->ctl()->bucket->read_bucket_instance_info(bucket, &bucket_info, y); + int r = store->ctl()->bucket->read_bucket_instance_info(bucket, &bucket_info, y, dpp); if (r < 0) { ldout(store->ctx(), 0) << "could not get bucket info for bucket=" << bucket << " r=" << r << dendl; return r; @@ -646,10 +650,10 @@ int RGWUserStatsCache::sync_bucket(const rgw_user& user, rgw_bucket& bucket, opt return r; } - return store->getRados()->check_bucket_shards(bucket_info, bucket, ent.count); + return store->getRados()->check_bucket_shards(bucket_info, bucket, ent.count, dpp); } -int RGWUserStatsCache::sync_user(const rgw_user& user, optional_yield y) +int RGWUserStatsCache::sync_user(const DoutPrefixProvider *dpp, const rgw_user& user, optional_yield y) { string user_str = user.to_str(); RGWStorageStats stats; @@ -674,7 +678,7 @@ int RGWUserStatsCache::sync_user(const rgw_user& user, optional_yield y) // check if enough time passed since last full sync /* FIXME: missing check? */ - ret = rgw_user_sync_all_stats(store, user, y); + ret = rgw_user_sync_all_stats(dpp, store, user, y); if (ret < 0) { ldout(store->ctx(), 0) << "ERROR: failed user stats sync, ret=" << ret << dendl; return ret; @@ -683,7 +687,7 @@ int RGWUserStatsCache::sync_user(const rgw_user& user, optional_yield y) return 0; } -int RGWUserStatsCache::sync_all_users(optional_yield y) +int RGWUserStatsCache::sync_all_users(const DoutPrefixProvider *dpp, optional_yield y) { string key = "user"; void *handle; @@ -709,7 +713,7 @@ int RGWUserStatsCache::sync_all_users(optional_yield y) ++iter) { rgw_user user(*iter); ldout(store->ctx(), 20) << "RGWUserStatsCache: sync user=" << user << dendl; - int ret = sync_user(user, y); + int ret = sync_user(dpp, user, y); if (ret < 0) { ldout(store->ctx(), 5) << "ERROR: sync_user() failed, user=" << user << " ret=" << ret << dendl; @@ -944,10 +948,11 @@ public: * fetch that info and not rely on cached data */ + const DoutPrefix dp(store->ctx(), dout_subsys, "rgw quota handler: "); if (bucket_quota.enabled) { RGWStorageStats bucket_stats; int ret = bucket_stats_cache.get_stats(user, bucket, bucket_stats, - bucket_quota, y); + bucket_quota, y, &dp); if (ret < 0) { return ret; } @@ -960,7 +965,7 @@ public: if (user_quota.enabled) { RGWStorageStats user_stats; int ret = user_stats_cache.get_stats(user, bucket, user_stats, - user_quota, y); + user_quota, y, &dp); if (ret < 0) { return ret; } diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 5a455340d233a..9efc65a8fe1b7 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -730,7 +730,7 @@ void RGWRados::get_max_aligned_size(uint64_t size, uint64_t alignment, uint64_t *max_size = size - (size % alignment); } -int RGWRados::get_max_chunk_size(const rgw_pool& pool, uint64_t *max_chunk_size, uint64_t *palignment) +int RGWRados::get_max_chunk_size(const rgw_pool& pool, uint64_t *max_chunk_size, const DoutPrefixProvider *dpp, uint64_t *palignment) { uint64_t alignment; int r = get_required_alignment(pool, &alignment); @@ -746,20 +746,20 @@ int RGWRados::get_max_chunk_size(const rgw_pool& pool, uint64_t *max_chunk_size, get_max_aligned_size(config_chunk_size, alignment, max_chunk_size); - ldout(cct, 20) << "max_chunk_size=" << *max_chunk_size << dendl; + ldpp_dout(dpp, 20) << "max_chunk_size=" << *max_chunk_size << dendl; return 0; } int RGWRados::get_max_chunk_size(const rgw_placement_rule& placement_rule, const rgw_obj& obj, - uint64_t *max_chunk_size, uint64_t *palignment) + uint64_t *max_chunk_size, const DoutPrefixProvider *dpp, uint64_t *palignment) { rgw_pool pool; if (!get_obj_data_pool(placement_rule, obj, &pool)) { - ldout(cct, 0) << "ERROR: failed to get data pool for object " << obj << dendl; + ldpp_dout(dpp, 0) << "ERROR: failed to get data pool for object " << obj << dendl; return -EIO; } - return get_max_chunk_size(pool, max_chunk_size, palignment); + return get_max_chunk_size(pool, max_chunk_size, dpp, palignment); } class RGWIndexCompletionManager; @@ -788,7 +788,7 @@ struct complete_op_data { } }; -class RGWIndexCompletionThread : public RGWRadosThread { +class RGWIndexCompletionThread : public RGWRadosThread, public DoutPrefixProvider { RGWRados *store; uint64_t interval_msec() override { @@ -813,6 +813,10 @@ public: signal(); } + + CephContext *get_cct() const override { return store->ctx(); } + unsigned get_subsys() const { return dout_subsys; } + std::ostream& gen_prefix(std::ostream& out) const { return out << "rgw index completion thread: "; } }; int RGWIndexCompletionThread::process() @@ -835,14 +839,14 @@ int RGWIndexCompletionThread::process() RGWRados::BucketShard bs(store); RGWBucketInfo bucket_info; - int r = bs.init(c->obj.bucket, c->obj, &bucket_info); + int r = bs.init(c->obj.bucket, c->obj, &bucket_info, this); if (r < 0) { ldout(cct, 0) << "ERROR: " << __func__ << "(): failed to initialize BucketShard, obj=" << c->obj << " r=" << r << dendl; /* not much to do */ continue; } - r = store->guard_reshard(&bs, c->obj, bucket_info, + r = store->guard_reshard(this, &bs, c->obj, bucket_info, [&](RGWRados::BucketShard *bs) -> int { librados::ObjectWriteOperation o; cls_rgw_guard_bucket_resharding(o, -ERR_BUSY_RESHARDING); @@ -855,7 +859,7 @@ int RGWIndexCompletionThread::process() /* ignoring error, can't do anything about it */ continue; } - r = store->svc.datalog_rados->add_entry(bucket_info, bs.shard_id); + r = store->svc.datalog_rados->add_entry(this, bucket_info, bs.shard_id); if (r < 0) { lderr(store->ctx()) << "ERROR: failed writing data log" << dendl; } @@ -1156,7 +1160,7 @@ int RGWRados::update_service_map(std::map&& status) * Initialize the RADOS instance and prepare to do other ops * Returns 0 on success, -ERR# on failure. */ -int RGWRados::init_complete() +int RGWRados::init_complete(const DoutPrefixProvider *dpp) { int ret; @@ -1230,7 +1234,7 @@ int RGWRados::init_complete() for (const auto &pt: zonegroup.placement_targets) { if (zone_params.placement_pools.find(pt.second.name) == zone_params.placement_pools.end()){ - ldout(cct, 0) << "WARNING: This zone does not contain the placement target " + ldpp_dout(dpp, 0) << "WARNING: This zone does not contain the placement target " << pt.second.name << " present in zonegroup" << dendl; } } @@ -1239,7 +1243,7 @@ int RGWRados::init_complete() meta_sync_processor_thread = new RGWMetaSyncProcessorThread(this->store, async_processor); ret = meta_sync_processor_thread->init(); if (ret < 0) { - ldout(cct, 0) << "ERROR: failed to initialize meta sync thread" << dendl; + ldpp_dout(dpp, 0) << "ERROR: failed to initialize meta sync thread" << dendl; return ret; } meta_sync_processor_thread->start(); @@ -1251,7 +1255,7 @@ int RGWRados::init_complete() bucket_trim.emplace(this->store, config); ret = bucket_trim->init(); if (ret < 0) { - ldout(cct, 0) << "ERROR: failed to start bucket trim manager" << dendl; + ldpp_dout(dpp, 0) << "ERROR: failed to start bucket trim manager" << dendl; return ret; } svc.datalog_rados->set_observer(&*bucket_trim); @@ -1262,7 +1266,7 @@ int RGWRados::init_complete() auto *thread = new RGWDataSyncProcessorThread(this->store, svc.rados->get_async_processor(), source_zone); ret = thread->init(); if (ret < 0) { - ldout(cct, 0) << "ERROR: failed to initialize data sync thread" << dendl; + ldpp_dout(dpp, 0) << "ERROR: failed to initialize data sync thread" << dendl; return ret; } thread->start(); @@ -1273,7 +1277,7 @@ int RGWRados::init_complete() sync_log_trimmer = new RGWSyncLogTrimThread(this->store, &*bucket_trim, interval); ret = sync_log_trimmer->init(); if (ret < 0) { - ldout(cct, 0) << "ERROR: failed to initialize sync log trim thread" << dendl; + ldpp_dout(dpp, 0) << "ERROR: failed to initialize sync log trim thread" << dendl; return ret; } sync_log_trimmer->start(); @@ -1297,10 +1301,10 @@ int RGWRados::init_complete() zone.bucket_index_max_shards); if (bucket_index_max_shards > get_max_bucket_shards()) { bucket_index_max_shards = get_max_bucket_shards(); - ldout(cct, 1) << __func__ << " bucket index max shards is too large, reset to value: " + ldpp_dout(dpp, 1) << __func__ << " bucket index max shards is too large, reset to value: " << get_max_bucket_shards() << dendl; } - ldout(cct, 20) << __func__ << " bucket index max shards: " << bucket_index_max_shards << dendl; + ldpp_dout(dpp, 20) << __func__ << " bucket index max shards: " << bucket_index_max_shards << dendl; bool need_tombstone_cache = !svc.zone->get_zone_data_notify_to_map().empty(); /* have zones syncing from us */ @@ -1323,33 +1327,33 @@ int RGWRados::init_complete() if (ret < 0) { return ret; } - ret = rgw::notify::init(cct, store); + ret = rgw::notify::init(cct, store, dpp); if (ret < 0 ) { - ldout(cct, 1) << "ERROR: failed to initialize notification manager" << dendl; + ldpp_dout(dpp, 1) << "ERROR: failed to initialize notification manager" << dendl; } return ret; } -int RGWRados::init_svc(bool raw) +int RGWRados::init_svc(bool raw, const DoutPrefixProvider *dpp) { if (raw) { - return svc.init_raw(cct, use_cache, null_yield); + return svc.init_raw(cct, use_cache, null_yield, dpp); } - return svc.init(cct, use_cache, run_sync_thread, null_yield); + return svc.init(cct, use_cache, run_sync_thread, null_yield, dpp); } -int RGWRados::init_ctl() +int RGWRados::init_ctl(const DoutPrefixProvider *dpp) { - return ctl.init(&svc); + return ctl.init(&svc, dpp); } /** * Initialize the RADOS instance and prepare to do other ops * Returns 0 on success, -ERR# on failure. */ -int RGWRados::initialize() +int RGWRados::initialize(const DoutPrefixProvider *dpp) { int ret; @@ -1357,15 +1361,15 @@ int RGWRados::initialize() cct->_conf.get_val("rgw_inject_notify_timeout_probability"); max_notify_retries = cct->_conf.get_val("rgw_max_notify_retries"); - ret = init_svc(false); + ret = init_svc(false, dpp); if (ret < 0) { - ldout(cct, 0) << "ERROR: failed to init services (ret=" << cpp_strerror(-ret) << ")" << dendl; + ldpp_dout(dpp, 0) << "ERROR: failed to init services (ret=" << cpp_strerror(-ret) << ")" << dendl; return ret; } - ret = init_ctl(); + ret = init_ctl(dpp); if (ret < 0) { - ldout(cct, 0) << "ERROR: failed to init ctls (ret=" << cpp_strerror(-ret) << ")" << dendl; + ldpp_dout(dpp, 0) << "ERROR: failed to init ctls (ret=" << cpp_strerror(-ret) << ")" << dendl; return ret; } @@ -1375,7 +1379,7 @@ int RGWRados::initialize() if (ret < 0) return ret; - return init_complete(); + return init_complete(dpp); } /** @@ -1727,7 +1731,7 @@ int rgw_policy_from_attrset(CephContext *cct, map& attrset, } -int RGWRados::Bucket::update_bucket_id(const string& new_bucket_id) +int RGWRados::Bucket::update_bucket_id(const string& new_bucket_id, const DoutPrefixProvider *dpp) { rgw_bucket bucket = bucket_info.bucket; bucket.update_bucket_id(new_bucket_id); @@ -1735,7 +1739,7 @@ int RGWRados::Bucket::update_bucket_id(const string& new_bucket_id) auto obj_ctx = store->svc.sysobj->init_obj_ctx(); bucket_info.objv_tracker.clear(); - int ret = store->get_bucket_instance_info(obj_ctx, bucket, bucket_info, nullptr, nullptr, null_yield); + int ret = store->get_bucket_instance_info(obj_ctx, bucket, bucket_info, nullptr, nullptr, null_yield, dpp); if (ret < 0) { return ret; } @@ -1762,6 +1766,7 @@ int RGWRados::Bucket::update_bucket_id(const string& new_bucket_id) * max, then truncated. */ int RGWRados::Bucket::List::list_objects_ordered( + const DoutPrefixProvider *dpp, int64_t max_p, vector *result, map *common_prefixes, @@ -1830,7 +1835,8 @@ int RGWRados::Bucket::List::list_objects_ordered( ent_map_t ent_map; ent_map.reserve(read_ahead); - int r = store->cls_bucket_list_ordered(target->get_bucket_info(), + int r = store->cls_bucket_list_ordered(dpp, + target->get_bucket_info(), shard_id, cur_marker, cur_prefix, @@ -2042,7 +2048,8 @@ done: * is_truncated: if number of objects in the bucket is bigger than max, then * truncated. */ -int RGWRados::Bucket::List::list_objects_unordered(int64_t max_p, +int RGWRados::Bucket::List::list_objects_unordered(const DoutPrefixProvider *dpp, + int64_t max_p, vector *result, map *common_prefixes, bool *is_truncated, @@ -2089,7 +2096,8 @@ int RGWRados::Bucket::List::list_objects_unordered(int64_t max_p, std::vector ent_list; ent_list.reserve(read_ahead); - int r = store->cls_bucket_list_unordered(target->get_bucket_info(), + int r = store->cls_bucket_list_unordered(dpp, + target->get_bucket_info(), shard_id, cur_marker, cur_prefix, @@ -2201,6 +2209,7 @@ int RGWRados::create_bucket(const RGWUserInfo& owner, rgw_bucket& bucket, rgw_bucket *pmaster_bucket, uint32_t *pmaster_num_shards, optional_yield y, + const DoutPrefixProvider *dpp, bool exclusive) { #define MAX_CREATE_RETRIES 20 /* need to bound retries */ @@ -2260,7 +2269,7 @@ int RGWRados::create_bucket(const RGWUserInfo& owner, rgw_bucket& bucket, return r; } - ret = put_linked_bucket_info(info, exclusive, ceph::real_time(), pep_objv, &attrs, true); + ret = put_linked_bucket_info(info, exclusive, ceph::real_time(), pep_objv, &attrs, true, dpp); if (ret == -ECANCELED) { ret = -EEXIST; } @@ -2282,7 +2291,7 @@ int RGWRados::create_bucket(const RGWUserInfo& owner, rgw_bucket& bucket, if (r < 0) { ldout(cct, 0) << "WARNING: could not remove bucket index (r=" << r << ")" << dendl; } - r = ctl.bucket->remove_bucket_instance_info(info.bucket, info, null_yield); + r = ctl.bucket->remove_bucket_instance_info(info.bucket, info, null_yield, dpp); if (r < 0) { ldout(cct, 0) << "WARNING: " << __func__ << "(): failed to remove bucket instance info: bucket instance=" << info.bucket.get_key() << ": r=" << r << dendl; /* continue anyway */ @@ -2543,7 +2552,7 @@ done_err: * fixes an issue where head objects were supposed to have a locator created, but ended * up without one */ -int RGWRados::fix_tail_obj_locator(const RGWBucketInfo& bucket_info, rgw_obj_key& key, bool fix, bool *need_fix, optional_yield y) +int RGWRados::fix_tail_obj_locator(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, rgw_obj_key& key, bool fix, bool *need_fix, optional_yield y) { const rgw_bucket& bucket = bucket_info.bucket; rgw_obj obj(bucket, key); @@ -2560,7 +2569,7 @@ int RGWRados::fix_tail_obj_locator(const RGWBucketInfo& bucket_info, rgw_obj_key RGWObjState *astate = NULL; RGWObjectCtx rctx(this->store); - r = get_obj_state(&rctx, bucket_info, obj, &astate, false, y); + r = get_obj_state(dpp, &rctx, bucket_info, obj, &astate, false, y); if (r < 0) return r; @@ -2623,7 +2632,8 @@ int RGWRados::fix_tail_obj_locator(const RGWBucketInfo& bucket_info, rgw_obj_key int RGWRados::BucketShard::init(const rgw_bucket& _bucket, const rgw_obj& obj, - RGWBucketInfo* bucket_info_out) + RGWBucketInfo* bucket_info_out, + const DoutPrefixProvider *dpp) { bucket = _bucket; @@ -2633,7 +2643,7 @@ int RGWRados::BucketShard::init(const rgw_bucket& _bucket, RGWBucketInfo* bucket_info_p = bucket_info_out ? bucket_info_out : &bucket_info; - int ret = store->get_bucket_instance_info(obj_ctx, bucket, *bucket_info_p, NULL, NULL, null_yield); + int ret = store->get_bucket_instance_info(obj_ctx, bucket, *bucket_info_p, NULL, NULL, null_yield, dpp); if (ret < 0) { return ret; } @@ -2652,7 +2662,8 @@ int RGWRados::BucketShard::init(const rgw_bucket& _bucket, int RGWRados::BucketShard::init(const rgw_bucket& _bucket, int sid, const rgw::bucket_index_layout_generation& idx_layout, - RGWBucketInfo* bucket_info_out) + RGWBucketInfo* bucket_info_out, + const DoutPrefixProvider *dpp) { bucket = _bucket; shard_id = sid; @@ -2663,7 +2674,7 @@ int RGWRados::BucketShard::init(const rgw_bucket& _bucket, RGWBucketInfo bucket_info; RGWBucketInfo* bucket_info_p = bucket_info_out ? bucket_info_out : &bucket_info; - int ret = store->get_bucket_instance_info(obj_ctx, bucket, *bucket_info_p, NULL, NULL, null_yield); + int ret = store->get_bucket_instance_info(obj_ctx, bucket, *bucket_info_p, NULL, NULL, null_yield, dpp); if (ret < 0) { return ret; } @@ -2717,7 +2728,8 @@ int RGWRados::BucketShard::init(const RGWBucketInfo& bucket_info, const rgw::buc /* Execute @handler on last item in bucket listing for bucket specified * in @bucket_info. @obj_prefix and @obj_delim narrow down the listing * to objects matching these criterias. */ -int RGWRados::on_last_entry_in_listing(RGWBucketInfo& bucket_info, +int RGWRados::on_last_entry_in_listing(const DoutPrefixProvider *dpp, + RGWBucketInfo& bucket_info, const std::string& obj_prefix, const std::string& obj_delim, std::function handler) @@ -2742,7 +2754,7 @@ int RGWRados::on_last_entry_in_listing(RGWBucketInfo& bucket_info, static constexpr int MAX_LIST_OBJS = 100; std::vector entries(MAX_LIST_OBJS); - int ret = list_op.list_objects(MAX_LIST_OBJS, &entries, nullptr, + int ret = list_op.list_objects(dpp, MAX_LIST_OBJS, &entries, nullptr, &is_truncated, null_yield); if (ret < 0) { return ret; @@ -2779,7 +2791,7 @@ int RGWRados::swift_versioning_copy(RGWObjectCtx& obj_ctx, obj->set_atomic(&obj_ctx); RGWObjState * state = nullptr; - int r = get_obj_state(&obj_ctx, bucket->get_info(), obj->get_obj(), &state, false, y); + int r = get_obj_state(dpp, &obj_ctx, bucket->get_info(), obj->get_obj(), &state, false, y); if (r < 0) { return r; } @@ -2955,7 +2967,7 @@ int RGWRados::swift_versioning_restore(RGWObjectCtx& obj_ctx, } /* Need to remove the archived copy. */ - ret = delete_obj(obj_ctx, archive_binfo, archive_obj.get_obj(), + ret = delete_obj(dpp, obj_ctx, archive_binfo, archive_obj.get_obj(), archive_binfo.versioning_status()); return ret; @@ -2965,11 +2977,12 @@ int RGWRados::swift_versioning_restore(RGWObjectCtx& obj_ctx, const auto prefix = boost::str(boost::format("%03x%s") % obj_name.size() % obj_name); - return on_last_entry_in_listing(archive_binfo, prefix, std::string(), + return on_last_entry_in_listing(dpp, archive_binfo, prefix, std::string(), handler); } -int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_size, +int RGWRados::Object::Write::_do_write_meta(const DoutPrefixProvider *dpp, + uint64_t size, uint64_t accounted_size, map& attrs, bool assume_noent, bool modify_tail, void *_index_op, optional_yield y) @@ -2990,7 +3003,7 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si #endif RGWObjState *state; - int r = target->get_state(&state, false, y, assume_noent); + int r = target->get_state(dpp, &state, false, y, assume_noent); if (r < 0) return r; @@ -3014,7 +3027,7 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si if (!ptag && !index_op->get_optag()->empty()) { ptag = index_op->get_optag(); } - r = target->prepare_atomic_modification(op, reset_obj, ptag, meta.if_match, meta.if_nomatch, false, modify_tail, y); + r = target->prepare_atomic_modification(dpp, op, reset_obj, ptag, meta.if_match, meta.if_nomatch, false, modify_tail, y); if (r < 0) return r; @@ -3133,7 +3146,7 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si if (!index_op->is_prepared()) { tracepoint(rgw_rados, prepare_enter, req_id.c_str()); - r = index_op->prepare(CLS_RGW_OP_ADD, &state->write_tag, y); + r = index_op->prepare(dpp, CLS_RGW_OP_ADD, &state->write_tag, y); tracepoint(rgw_rados, prepare_exit, req_id.c_str()); if (r < 0) return r; @@ -3163,7 +3176,7 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si } tracepoint(rgw_rados, complete_enter, req_id.c_str()); - r = index_op->complete(poolid, epoch, size, accounted_size, + r = index_op->complete(dpp, poolid, epoch, size, accounted_size, meta.set_mtime, etag, content_type, storage_class, &acl_bl, meta.category, meta.remove_objs, meta.user_data, meta.appendable); @@ -3180,7 +3193,7 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si state = NULL; if (versioned_op && meta.olh_epoch) { - r = store->set_olh(target->get_ctx(), target->get_bucket_info(), obj, false, NULL, *meta.olh_epoch, real_time(), false, y, meta.zones_trace); + 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); if (r < 0) { return r; } @@ -3211,7 +3224,7 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si return 0; done_cancel: - int ret = index_op->cancel(); + int ret = index_op->cancel(dpp); if (ret < 0) { ldout(store->ctx(), 0) << "ERROR: index_op.cancel()() returned ret=" << ret << dendl; } @@ -3255,7 +3268,7 @@ done_cancel: return r; } -int RGWRados::Object::Write::write_meta(uint64_t size, uint64_t accounted_size, +int RGWRados::Object::Write::write_meta(const DoutPrefixProvider *dpp, uint64_t size, uint64_t accounted_size, map& attrs, optional_yield y) { RGWBucketInfo& bucket_info = target->get_bucket_info(); @@ -3267,13 +3280,13 @@ int RGWRados::Object::Write::write_meta(uint64_t size, uint64_t accounted_size, bool assume_noent = (meta.if_match == NULL && meta.if_nomatch == NULL); int r; if (assume_noent) { - r = _do_write_meta(size, accounted_size, attrs, assume_noent, meta.modify_tail, (void *)&index_op, y); + r = _do_write_meta(dpp, size, accounted_size, attrs, assume_noent, meta.modify_tail, (void *)&index_op, y); if (r == -EEXIST) { assume_noent = false; } } if (!assume_noent) { - r = _do_write_meta(size, accounted_size, attrs, assume_noent, meta.modify_tail, (void *)&index_op, y); + r = _do_write_meta(dpp, size, accounted_size, attrs, assume_noent, meta.modify_tail, (void *)&index_op, y); } return r; } @@ -3873,7 +3886,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx, if (copy_if_newer) { /* need to get mtime for destination */ - ret = get_obj_state(&obj_ctx, dest_bucket->get_info(), dest_obj->get_obj(), &dest_state, false, null_yield); + ret = get_obj_state(dpp, &obj_ctx, dest_bucket->get_info(), dest_obj->get_obj(), &dest_state, false, null_yield); if (ret < 0) goto set_err_state; @@ -3930,7 +3943,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx, auto& obj_attrs = cb.get_attrs(); RGWUserInfo owner_info; - if (ctl.user->get_info_by_uid(*override_owner, &owner_info, null_yield) < 0) { + if (ctl.user->get_info_by_uid(dpp, *override_owner, &owner_info, null_yield) < 0) { ldout(cct, 10) << "owner info does not exist" << dendl; return -EINVAL; } @@ -4040,7 +4053,7 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx, if (copy_if_newer && canceled) { ldout(cct, 20) << "raced with another write of obj: " << dest_obj << dendl; obj_ctx.invalidate(dest_obj->get_obj()); /* object was overwritten */ - ret = get_obj_state(&obj_ctx, dest_bucket->get_info(), dest_obj->get_obj(), &dest_state, false, null_yield); + ret = get_obj_state(dpp, &obj_ctx, dest_bucket->get_info(), dest_obj->get_obj(), &dest_state, false, null_yield); if (ret < 0) { ldout(cct, 0) << "ERROR: " << __func__ << ": get_err_state() returned ret=" << ret << dendl; goto set_err_state; @@ -4074,7 +4087,7 @@ 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(obj_ctx, dest_bucket->get_info(), dest_obj->get_obj(), false, nullptr, + ret = set_olh(dpp, obj_ctx, dest_bucket->get_info(), dest_obj->get_obj(), false, nullptr, *olh_epoch, real_time(), false, null_yield, zones_trace, log_data_change); } else { // we already have the latest copy @@ -4085,7 +4098,8 @@ set_err_state: } -int RGWRados::copy_obj_to_remote_dest(RGWObjState *astate, +int RGWRados::copy_obj_to_remote_dest(const DoutPrefixProvider *dpp, + RGWObjState *astate, map& src_attrs, RGWRados::Object::Read& read_op, const rgw_user& user_id, @@ -4103,7 +4117,7 @@ int RGWRados::copy_obj_to_remote_dest(RGWObjState *astate, return ret; } - ret = read_op.iterate(0, astate->size - 1, out_stream_req->get_out_cb(), null_yield); + ret = read_op.iterate(dpp, 0, astate->size - 1, out_stream_req->get_out_cb(), null_yield); if (ret < 0) { delete out_stream_req; return ret; @@ -4207,7 +4221,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx, read_op.params.lastmod = src_mtime; read_op.params.obj_size = &obj_size; - ret = read_op.prepare(y); + ret = read_op.prepare(y, dpp); if (ret < 0) { return ret; } @@ -4235,7 +4249,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx, RGWObjManifest manifest; RGWObjState *astate = NULL; - ret = get_obj_state(&obj_ctx, src_bucket->get_info(), src_obj->get_obj(), &astate, y); + ret = get_obj_state(dpp, &obj_ctx, src_bucket->get_info(), src_obj->get_obj(), &astate, y); if (ret < 0) { return ret; } @@ -4244,11 +4258,11 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx, if (remote_dest) { /* dest is in a different zonegroup, copy it there */ - return copy_obj_to_remote_dest(astate, attrs, read_op, user_id, dest_obj, mtime); + return copy_obj_to_remote_dest(dpp, astate, attrs, read_op, user_id, dest_obj, mtime); } uint64_t max_chunk_size; - ret = get_max_chunk_size(dest_bucket->get_placement_rule(), dest_obj->get_obj(), &max_chunk_size); + ret = get_max_chunk_size(dest_bucket->get_placement_rule(), dest_obj->get_obj(), &max_chunk_size, dpp); if (ret < 0) { ldpp_dout(dpp, 0) << "ERROR: failed to get max_chunk_size() for bucket " << dest_obj->get_bucket() << dendl; return ret; @@ -4379,7 +4393,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx, } if (copy_first) { - ret = read_op.read(0, max_chunk_size, first_chunk, y); + ret = read_op.read(0, max_chunk_size, first_chunk, y, dpp); if (ret < 0) { goto done_ret; } @@ -4400,7 +4414,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(obj_size, astate->accounted_size, attrs, y); + ret = write_op.write_meta(dpp, obj_size, astate->accounted_size, attrs, y); if (ret < 0) { goto done_ret; } @@ -4462,7 +4476,7 @@ int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx, do { bufferlist bl; - ret = read_op.read(ofs, end, bl, y); + ret = read_op.read(ofs, end, bl, y, dpp); if (ret < 0) { ldpp_dout(dpp, 0) << "ERROR: fail to read object data, ret = " << ret << dendl; return ret; @@ -4531,7 +4545,7 @@ int RGWRados::transition_obj(RGWObjectCtx& obj_ctx, read_op.params.lastmod = &read_mtime; read_op.params.obj_size = &obj_size; - int ret = read_op.prepare(y); + int ret = read_op.prepare(y, dpp); if (ret < 0) { return ret; } @@ -4565,7 +4579,7 @@ int RGWRados::transition_obj(RGWObjectCtx& obj_ctx, return 0; } -int RGWRados::check_bucket_empty(RGWBucketInfo& bucket_info, optional_yield y) +int RGWRados::check_bucket_empty(const DoutPrefixProvider *dpp, RGWBucketInfo& bucket_info, optional_yield y) { constexpr uint NUM_ENTRIES = 1000u; @@ -4577,7 +4591,8 @@ int RGWRados::check_bucket_empty(RGWBucketInfo& bucket_info, optional_yield y) std::vector ent_list; ent_list.reserve(NUM_ENTRIES); - int r = cls_bucket_list_unordered(bucket_info, + int r = cls_bucket_list_unordered(dpp, + bucket_info, RGW_NO_SHARD, marker, prefix, @@ -4609,7 +4624,7 @@ int RGWRados::check_bucket_empty(RGWBucketInfo& bucket_info, optional_yield y) * bucket: the name of the bucket to delete * Returns 0 on success, -ERR# otherwise. */ -int RGWRados::delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& objv_tracker, optional_yield y, bool check_empty) +int RGWRados::delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& objv_tracker, optional_yield y, const DoutPrefixProvider *dpp, bool check_empty) { const rgw_bucket& bucket = bucket_info.bucket; RGWSI_RADOS::Pool index_pool; @@ -4619,7 +4634,7 @@ int RGWRados::delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& ob return r; if (check_empty) { - r = check_bucket_empty(bucket_info, y); + r = check_bucket_empty(dpp, bucket_info, y); if (r < 0) { return r; } @@ -4632,6 +4647,7 @@ int RGWRados::delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& ob r = ctl.bucket->read_bucket_entrypoint_info(bucket_info.bucket, &ep, null_yield, + dpp, RGWBucketCtl::Bucket::GetParams() .set_objv_tracker(&objv_tracker)); if (r < 0 || @@ -4650,7 +4666,7 @@ int RGWRados::delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& ob } if (remove_ep) { - r = ctl.bucket->remove_bucket_entrypoint_info(bucket_info.bucket, null_yield, + r = ctl.bucket->remove_bucket_entrypoint_info(bucket_info.bucket, null_yield, dpp, RGWBucketCtl::Bucket::RemoveParams() .set_objv_tracker(&objv_tracker)); if (r < 0) @@ -4660,7 +4676,7 @@ int RGWRados::delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& ob /* if the bucket is not synced we can remove the meta file */ if (!svc.zone->is_syncing_bucket_meta(bucket)) { RGWObjVersionTracker objv_tracker; - r = ctl.bucket->remove_bucket_instance_info(bucket, bucket_info, null_yield); + r = ctl.bucket->remove_bucket_instance_info(bucket, bucket_info, null_yield, dpp); if (r < 0) { return r; } @@ -4674,7 +4690,7 @@ int RGWRados::delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& ob return 0; } -int RGWRados::set_bucket_owner(rgw_bucket& bucket, ACLOwner& owner) +int RGWRados::set_bucket_owner(rgw_bucket& bucket, ACLOwner& owner, const DoutPrefixProvider *dpp) { RGWBucketInfo info; map attrs; @@ -4682,9 +4698,9 @@ int RGWRados::set_bucket_owner(rgw_bucket& bucket, ACLOwner& owner) auto obj_ctx = svc.sysobj->init_obj_ctx(); if (bucket.bucket_id.empty()) { - r = get_bucket_info(&svc, bucket.tenant, bucket.name, info, NULL, null_yield, &attrs); + r = get_bucket_info(&svc, bucket.tenant, bucket.name, info, NULL, null_yield, dpp, &attrs); } else { - r = get_bucket_instance_info(obj_ctx, bucket, info, nullptr, &attrs, null_yield); + r = get_bucket_instance_info(obj_ctx, bucket, info, nullptr, &attrs, null_yield, dpp); } if (r < 0) { ldout(cct, 0) << "NOTICE: get_bucket_info on bucket=" << bucket.name << " returned err=" << r << dendl; @@ -4693,7 +4709,7 @@ int RGWRados::set_bucket_owner(rgw_bucket& bucket, ACLOwner& owner) info.owner = owner.get_id(); - r = put_bucket_instance_info(info, false, real_time(), &attrs); + r = put_bucket_instance_info(info, false, real_time(), &attrs, dpp); if (r < 0) { ldout(cct, 0) << "NOTICE: put_bucket_info on bucket=" << bucket.name << " returned err=" << r << dendl; return r; @@ -4703,7 +4719,7 @@ int RGWRados::set_bucket_owner(rgw_bucket& bucket, ACLOwner& owner) } -int RGWRados::set_buckets_enabled(vector& buckets, bool enabled) +int RGWRados::set_buckets_enabled(vector& buckets, bool enabled, const DoutPrefixProvider *dpp) { int ret = 0; @@ -4718,7 +4734,7 @@ int RGWRados::set_buckets_enabled(vector& buckets, bool enabled) RGWBucketInfo info; map attrs; - int r = get_bucket_info(&svc, bucket.tenant, bucket.name, info, NULL, null_yield, &attrs); + int r = get_bucket_info(&svc, bucket.tenant, bucket.name, info, NULL, null_yield, dpp, &attrs); if (r < 0) { ldout(cct, 0) << "NOTICE: get_bucket_info on bucket=" << bucket.name << " returned err=" << r << ", skipping bucket" << dendl; ret = r; @@ -4730,7 +4746,7 @@ int RGWRados::set_buckets_enabled(vector& buckets, bool enabled) info.flags |= BUCKET_SUSPENDED; } - r = put_bucket_instance_info(info, false, real_time(), &attrs); + r = put_bucket_instance_info(info, false, real_time(), &attrs, dpp); if (r < 0) { ldout(cct, 0) << "NOTICE: put_bucket_info on bucket=" << bucket.name << " returned err=" << r << ", skipping bucket" << dendl; ret = r; @@ -4740,10 +4756,10 @@ int RGWRados::set_buckets_enabled(vector& buckets, bool enabled) return ret; } -int RGWRados::bucket_suspended(rgw_bucket& bucket, bool *suspended) +int RGWRados::bucket_suspended(const DoutPrefixProvider *dpp, rgw_bucket& bucket, bool *suspended) { RGWBucketInfo bucket_info; - int ret = get_bucket_info(&svc, bucket.tenant, bucket.name, bucket_info, NULL, null_yield); + int ret = get_bucket_info(&svc, bucket.tenant, bucket.name, bucket_info, NULL, null_yield, dpp); if (ret < 0) { return ret; } @@ -4904,7 +4920,7 @@ int RGWRados::bucket_set_reshard(const RGWBucketInfo& bucket_info, const cls_rgw return CLSRGWIssueSetBucketResharding(index_pool.ioctx(), bucket_objs, entry, cct->_conf->rgw_bucket_index_max_aio)(); } -int RGWRados::defer_gc(void *ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, optional_yield y) +int RGWRados::defer_gc(const DoutPrefixProvider *dpp, void *ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, optional_yield y) { RGWObjectCtx *rctx = static_cast(ctx); std::string oid, key; @@ -4914,7 +4930,7 @@ int RGWRados::defer_gc(void *ctx, const RGWBucketInfo& bucket_info, const rgw_ob RGWObjState *state = NULL; - int r = get_obj_state(rctx, bucket_info, obj, &state, false, y); + int r = get_obj_state(dpp, rctx, bucket_info, obj, &state, false, y); if (r < 0) return r; @@ -4975,7 +4991,7 @@ struct tombstone_entry { * obj: name of the object to delete * Returns: 0 on success, -ERR# otherwise. */ -int RGWRados::Object::Delete::delete_obj(optional_yield y) +int RGWRados::Object::Delete::delete_obj(optional_yield y, const DoutPrefixProvider *dpp) { RGWRados *store = target->get_store(); rgw_obj& src_obj = target->get_obj(); @@ -5016,7 +5032,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y) meta.mtime = params.mtime; } - int r = store->set_olh(target->get_ctx(), target->get_bucket_info(), marker, true, &meta, params.olh_epoch, params.unmod_since, params.high_precision_time, y, params.zones_trace); + int r = store->set_olh(dpp, target->get_ctx(), target->get_bucket_info(), marker, true, &meta, params.olh_epoch, params.unmod_since, params.high_precision_time, y, params.zones_trace); if (r < 0) { return r; } @@ -5028,7 +5044,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y) return r; } result.delete_marker = dirent.is_delete_marker(); - r = store->unlink_obj_instance(target->get_ctx(), target->get_bucket_info(), obj, params.olh_epoch, y, params.zones_trace); + r = store->unlink_obj_instance(dpp, target->get_ctx(), target->get_bucket_info(), obj, params.olh_epoch, y, params.zones_trace); if (r < 0) { return r; } @@ -5036,13 +5052,13 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y) } BucketShard *bs; - int r = target->get_bucket_shard(&bs); + int r = target->get_bucket_shard(&bs, dpp); if (r < 0) { ldout(store->ctx(), 5) << "failed to get BucketShard object: r=" << r << dendl; return r; } - r = store->svc.datalog_rados->add_entry(target->bucket_info, bs->shard_id); + r = store->svc.datalog_rados->add_entry(dpp, target->bucket_info, bs->shard_id); if (r < 0) { lderr(store->ctx()) << "ERROR: failed writing data log" << dendl; return r; @@ -5058,7 +5074,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y) } RGWObjState *state; - r = target->get_state(&state, false, y); + r = target->get_state(dpp, &state, false, y); if (r < 0) return r; @@ -5112,7 +5128,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y) return -ENOENT; } - r = target->prepare_atomic_modification(op, false, NULL, NULL, NULL, true, false, y); + r = target->prepare_atomic_modification(dpp, op, false, NULL, NULL, NULL, true, false, y); if (r < 0) return r; @@ -5124,7 +5140,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y) index_op.set_zones_trace(params.zones_trace); index_op.set_bilog_flags(params.bilog_flags); - r = index_op.prepare(CLS_RGW_OP_DEL, &state->write_tag, y); + r = index_op.prepare(dpp, CLS_RGW_OP_DEL, &state->write_tag, y); if (r < 0) return r; @@ -5143,7 +5159,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y) tombstone_entry entry{*state}; obj_tombstone_cache->add(obj, entry); } - r = index_op.complete_del(poolid, ioctx.get_last_version(), state->mtime, params.remove_objs); + r = index_op.complete_del(dpp, poolid, ioctx.get_last_version(), state->mtime, params.remove_objs); int ret = target->complete_atomic_modification(); if (ret < 0) { @@ -5151,7 +5167,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y) } /* other than that, no need to propagate error */ } else { - int ret = index_op.cancel(); + int ret = index_op.cancel(dpp); if (ret < 0) { ldout(store->ctx(), 0) << "ERROR: index_op.cancel() returned ret=" << ret << dendl; } @@ -5170,7 +5186,8 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y) return 0; } -int RGWRados::delete_obj(RGWObjectCtx& obj_ctx, +int RGWRados::delete_obj(const DoutPrefixProvider *dpp, + RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, int versioning_status, @@ -5187,7 +5204,7 @@ int RGWRados::delete_obj(RGWObjectCtx& obj_ctx, del_op.params.expiration_time = expiration_time; del_op.params.zones_trace = zones_trace; - return del_op.delete_obj(null_yield); + return del_op.delete_obj(null_yield, dpp); } int RGWRados::delete_raw_obj(const rgw_raw_obj& obj) @@ -5208,7 +5225,7 @@ int RGWRados::delete_raw_obj(const rgw_raw_obj& obj) return 0; } -int RGWRados::delete_obj_index(const rgw_obj& obj, ceph::real_time mtime) +int RGWRados::delete_obj_index(const rgw_obj& obj, ceph::real_time mtime, const DoutPrefixProvider *dpp) { std::string oid, key; get_obj_bucket_and_oid_loc(obj, oid, key); @@ -5216,7 +5233,7 @@ int RGWRados::delete_obj_index(const rgw_obj& obj, ceph::real_time mtime) auto obj_ctx = svc.sysobj->init_obj_ctx(); RGWBucketInfo bucket_info; - int ret = get_bucket_instance_info(obj_ctx, obj.bucket, bucket_info, NULL, NULL, null_yield); + int ret = get_bucket_instance_info(obj_ctx, obj.bucket, bucket_info, NULL, NULL, null_yield, dpp); if (ret < 0) { ldout(cct, 0) << "ERROR: " << __func__ << "() get_bucket_instance_info(bucket=" << obj.bucket << ") returned ret=" << ret << dendl; return ret; @@ -5225,7 +5242,7 @@ int RGWRados::delete_obj_index(const rgw_obj& obj, ceph::real_time mtime) RGWRados::Bucket bop(this, bucket_info); RGWRados::Bucket::UpdateIndex index_op(&bop, obj); - return index_op.complete_del(-1 /* pool */, 0, mtime, NULL); + return index_op.complete_del(dpp, -1 /* pool */, 0, mtime, NULL); } static void generate_fake_tag(rgw::sal::RGWStore* store, map& attrset, RGWObjManifest& manifest, bufferlist& manifest_bl, bufferlist& tag_bl) @@ -5272,17 +5289,17 @@ static bool has_olh_tag(map& attrs) return (iter != attrs.end()); } -int RGWRados::get_olh_target_state(RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, +int RGWRados::get_olh_target_state(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState *olh_state, RGWObjState **target_state, optional_yield y) { ceph_assert(olh_state->is_olh); rgw_obj target; - int r = RGWRados::follow_olh(bucket_info, obj_ctx, olh_state, obj, &target); /* might return -EAGAIN */ + int r = RGWRados::follow_olh(dpp, bucket_info, obj_ctx, olh_state, obj, &target); /* might return -EAGAIN */ if (r < 0) { return r; } - r = get_obj_state(&obj_ctx, bucket_info, target, target_state, false, y); + r = get_obj_state(dpp, &obj_ctx, bucket_info, target, target_state, false, y); if (r < 0) { return r; } @@ -5290,7 +5307,7 @@ int RGWRados::get_olh_target_state(RGWObjectCtx& obj_ctx, const RGWBucketInfo& b return 0; } -int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, +int RGWRados::get_obj_state_impl(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state, bool follow_olh, optional_yield y, bool assume_noent) { if (obj.empty()) { @@ -5304,7 +5321,7 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket *state = s; if (s->has_attrs) { if (s->is_olh && need_follow_olh) { - return get_olh_target_state(*rctx, bucket_info, obj, s, state, y); + return get_olh_target_state(dpp, *rctx, bucket_info, obj, s, state, y); } return 0; } @@ -5457,7 +5474,7 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket ldout(cct, 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(*rctx, bucket_info, obj, s, state, y); + return get_olh_target_state(dpp, *rctx, bucket_info, obj, s, state, y); } else if (obj.key.have_null_instance() && !s->manifest) { // read null version, and the head object only have olh info s->exists = false; @@ -5468,22 +5485,22 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket return 0; } -int RGWRados::get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state, +int RGWRados::get_obj_state(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state, bool follow_olh, optional_yield y, bool assume_noent) { int ret; do { - ret = get_obj_state_impl(rctx, bucket_info, obj, state, follow_olh, y, assume_noent); + ret = get_obj_state_impl(dpp, rctx, bucket_info, obj, state, follow_olh, y, assume_noent); } while (ret == -EAGAIN); return ret; } -int RGWRados::Object::get_manifest(RGWObjManifest **pmanifest, optional_yield y) +int RGWRados::Object::get_manifest(const DoutPrefixProvider *dpp, RGWObjManifest **pmanifest, optional_yield y) { RGWObjState *astate; - int r = get_state(&astate, true, y); + int r = get_state(dpp, &astate, true, y); if (r < 0) { return r; } @@ -5493,10 +5510,10 @@ int RGWRados::Object::get_manifest(RGWObjManifest **pmanifest, optional_yield y) return 0; } -int RGWRados::Object::Read::get_attr(const char *name, bufferlist& dest, optional_yield y) +int RGWRados::Object::Read::get_attr(const DoutPrefixProvider *dpp, const char *name, bufferlist& dest, optional_yield y) { RGWObjState *state; - int r = source->get_state(&state, true, y); + int r = source->get_state(dpp, &state, true, y); if (r < 0) return r; if (!state->exists) @@ -5586,14 +5603,14 @@ int RGWRados::Object::Stat::finish() return 0; } -int RGWRados::append_atomic_test(RGWObjectCtx *rctx, +int RGWRados::append_atomic_test(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, ObjectOperation& op, RGWObjState **pstate, optional_yield y) { if (!rctx) return 0; - int r = get_obj_state(rctx, bucket_info, obj, pstate, false, y); + int r = get_obj_state(dpp, rctx, bucket_info, obj, pstate, false, y); if (r < 0) return r; @@ -5616,9 +5633,9 @@ int RGWRados::append_atomic_test(const RGWObjState* state, return 0; } -int RGWRados::Object::get_state(RGWObjState **pstate, bool follow_olh, optional_yield y, bool assume_noent) +int RGWRados::Object::get_state(const DoutPrefixProvider *dpp, RGWObjState **pstate, bool follow_olh, optional_yield y, bool assume_noent) { - return store->get_obj_state(&ctx, bucket_info, obj, pstate, follow_olh, y, assume_noent); + return store->get_obj_state(dpp, &ctx, bucket_info, obj, pstate, follow_olh, y, assume_noent); } void RGWRados::Object::invalidate_state() @@ -5626,11 +5643,12 @@ void RGWRados::Object::invalidate_state() ctx.invalidate(obj); } -int RGWRados::Object::prepare_atomic_modification(ObjectWriteOperation& op, bool reset_obj, const string *ptag, +int RGWRados::Object::prepare_atomic_modification(const DoutPrefixProvider *dpp, + ObjectWriteOperation& op, bool reset_obj, const string *ptag, const char *if_match, const char *if_nomatch, bool removal_op, bool modify_tail, optional_yield y) { - int r = get_state(&state, false, y); + int r = get_state(dpp, &state, false, y); if (r < 0) return r; @@ -5727,14 +5745,14 @@ int RGWRados::Object::prepare_atomic_modification(ObjectWriteOperation& op, bool * bl: the contents of the attr * Returns: 0 on success, -ERR# otherwise. */ -int RGWRados::set_attr(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& obj, const char *name, bufferlist& bl) +int RGWRados::set_attr(const DoutPrefixProvider *dpp, void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& obj, const char *name, bufferlist& bl) { map attrs; attrs[name] = bl; - return set_attrs(ctx, bucket_info, obj, attrs, NULL, null_yield); + return set_attrs(dpp, ctx, bucket_info, obj, attrs, NULL, null_yield); } -int RGWRados::set_attrs(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& src_obj, +int RGWRados::set_attrs(const DoutPrefixProvider *dpp, void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& src_obj, map& attrs, map* rmattrs, optional_yield y) @@ -5754,7 +5772,7 @@ int RGWRados::set_attrs(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& sr ObjectWriteOperation op; RGWObjState *state = NULL; - r = append_atomic_test(rctx, bucket_info, obj, op, &state, y); + r = append_atomic_test(dpp, rctx, bucket_info, obj, op, &state, y); if (r < 0) return r; @@ -5810,7 +5828,7 @@ int RGWRados::set_attrs(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& sr string tag; append_rand_alpha(cct, tag, tag, 32); state->write_tag = tag; - r = index_op.prepare(CLS_RGW_OP_ADD, &state->write_tag, y); + r = index_op.prepare(dpp, CLS_RGW_OP_ADD, &state->write_tag, y); if (r < 0) return r; @@ -5839,11 +5857,11 @@ int RGWRados::set_attrs(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& sr } uint64_t epoch = ioctx.get_last_version(); int64_t poolid = ioctx.get_id(); - r = index_op.complete(poolid, epoch, state->size, state->accounted_size, + r = index_op.complete(dpp, poolid, epoch, state->size, state->accounted_size, mtime, etag, content_type, storage_class, &acl_bl, RGWObjCategory::Main, NULL); } else { - int ret = index_op.cancel(); + int ret = index_op.cancel(dpp); if (ret < 0) { ldout(cct, 0) << "ERROR: complete_update_index_cancel() returned ret=" << ret << dendl; } @@ -5873,7 +5891,7 @@ int RGWRados::set_attrs(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& sr return 0; } -int RGWRados::Object::Read::prepare(optional_yield y) +int RGWRados::Object::Read::prepare(optional_yield y, const DoutPrefixProvider *dpp) { RGWRados *store = source->get_store(); CephContext *cct = store->ctx(); @@ -5883,7 +5901,7 @@ int RGWRados::Object::Read::prepare(optional_yield y) map::iterator iter; RGWObjState *astate; - int r = source->get_state(&astate, true, y); + int r = source->get_state(dpp, &astate, true, y); if (r < 0) return r; @@ -5910,7 +5928,7 @@ int RGWRados::Object::Read::prepare(optional_yield y) *params.attrs = astate->attrset; if (cct->_conf->subsys.should_gather()) { for (iter = params.attrs->begin(); iter != params.attrs->end(); ++iter) { - ldout(cct, 20) << "Read xattr: " << iter->first << dendl; + ldpp_dout(dpp, 20) << "Read xattr rgw_rados: " << iter->first << dendl; } } } @@ -5926,7 +5944,7 @@ int RGWRados::Object::Read::prepare(optional_yield y) if (conds.mod_ptr && !conds.if_nomatch) { dest_weight.init(*conds.mod_ptr, conds.mod_zone_id, conds.mod_pg_ver); - ldout(cct, 10) << "If-Modified-Since: " << dest_weight << " Last-Modified: " << src_weight << dendl; + ldpp_dout(dpp, 10) << "If-Modified-Since: " << dest_weight << " Last-Modified: " << src_weight << dendl; if (!(dest_weight < src_weight)) { return -ERR_NOT_MODIFIED; } @@ -5934,20 +5952,20 @@ int RGWRados::Object::Read::prepare(optional_yield y) if (conds.unmod_ptr && !conds.if_match) { dest_weight.init(*conds.unmod_ptr, conds.mod_zone_id, conds.mod_pg_ver); - ldout(cct, 10) << "If-UnModified-Since: " << dest_weight << " Last-Modified: " << src_weight << dendl; + ldpp_dout(dpp, 10) << "If-UnModified-Since: " << dest_weight << " Last-Modified: " << src_weight << dendl; if (dest_weight < src_weight) { return -ERR_PRECONDITION_FAILED; } } } if (conds.if_match || conds.if_nomatch) { - r = get_attr(RGW_ATTR_ETAG, etag, y); + r = get_attr(dpp, RGW_ATTR_ETAG, etag, y); if (r < 0) return r; if (conds.if_match) { string if_match_str = rgw_string_unquote(conds.if_match); - ldout(cct, 10) << "ETag: " << string(etag.c_str(), etag.length()) << " " << " If-Match: " << if_match_str << dendl; + ldpp_dout(dpp, 10) << "ETag: " << string(etag.c_str(), etag.length()) << " " << " If-Match: " << if_match_str << dendl; if (if_match_str.compare(0, etag.length(), etag.c_str(), etag.length()) != 0) { return -ERR_PRECONDITION_FAILED; } @@ -5955,7 +5973,7 @@ int RGWRados::Object::Read::prepare(optional_yield y) if (conds.if_nomatch) { string if_nomatch_str = rgw_string_unquote(conds.if_nomatch); - ldout(cct, 10) << "ETag: " << string(etag.c_str(), etag.length()) << " " << " If-NoMatch: " << if_nomatch_str << dendl; + ldpp_dout(dpp, 10) << "ETag: " << string(etag.c_str(), etag.length()) << " " << " If-NoMatch: " << if_nomatch_str << dendl; if (if_nomatch_str.compare(0, etag.length(), etag.c_str(), etag.length()) == 0) { return -ERR_NOT_MODIFIED; } @@ -5992,7 +6010,7 @@ int RGWRados::Object::Read::range_to_ofs(uint64_t obj_size, int64_t &ofs, int64_ return 0; } -int RGWRados::Bucket::UpdateIndex::guard_reshard(BucketShard **pbs, std::function call) +int RGWRados::Bucket::UpdateIndex::guard_reshard(const DoutPrefixProvider *dpp, BucketShard **pbs, std::function call) { RGWRados *store = target->get_store(); BucketShard *bs; @@ -6000,7 +6018,7 @@ int RGWRados::Bucket::UpdateIndex::guard_reshard(BucketShard **pbs, std::functio #define NUM_RESHARD_RETRIES 10 for (int i = 0; i < NUM_RESHARD_RETRIES; ++i) { - int ret = get_bucket_shard(&bs); + int ret = get_bucket_shard(&bs, dpp); if (ret < 0) { ldout(store->ctx(), 5) << "failed to get BucketShard object: ret=" << ret << dendl; return ret; @@ -6012,7 +6030,7 @@ int RGWRados::Bucket::UpdateIndex::guard_reshard(BucketShard **pbs, std::functio ldout(store->ctx(), 0) << "NOTICE: resharding operation on bucket index detected, blocking" << dendl; string new_bucket_id; r = store->block_while_resharding(bs, &new_bucket_id, - target->bucket_info, null_yield); + target->bucket_info, null_yield, dpp); if (r == -ERR_BUSY_RESHARDING) { continue; } @@ -6021,7 +6039,7 @@ int RGWRados::Bucket::UpdateIndex::guard_reshard(BucketShard **pbs, std::functio } ldout(store->ctx(), 20) << "reshard completion identified, new_bucket_id=" << new_bucket_id << dendl; i = 0; /* resharding is finished, make sure we can retry */ - r = target->update_bucket_id(new_bucket_id); + r = target->update_bucket_id(new_bucket_id, dpp); if (r < 0) { ldout(store->ctx(), 0) << "ERROR: update_bucket_id() new_bucket_id=" << new_bucket_id << " returned r=" << r << dendl; return r; @@ -6040,7 +6058,7 @@ int RGWRados::Bucket::UpdateIndex::guard_reshard(BucketShard **pbs, std::functio return 0; } -int RGWRados::Bucket::UpdateIndex::prepare(RGWModifyOp op, const string *write_tag, optional_yield y) +int RGWRados::Bucket::UpdateIndex::prepare(const DoutPrefixProvider *dpp, RGWModifyOp op, const string *write_tag, optional_yield y) { if (blind) { return 0; @@ -6055,7 +6073,7 @@ int RGWRados::Bucket::UpdateIndex::prepare(RGWModifyOp op, const string *write_t } } - int r = guard_reshard(nullptr, [&](BucketShard *bs) -> int { + int r = guard_reshard(dpp, nullptr, [&](BucketShard *bs) -> int { return store->cls_obj_prepare_op(*bs, op, optag, obj, bilog_flags, y, zones_trace); }); @@ -6067,7 +6085,7 @@ int RGWRados::Bucket::UpdateIndex::prepare(RGWModifyOp op, const string *write_t return 0; } -int RGWRados::Bucket::UpdateIndex::complete(int64_t poolid, uint64_t epoch, +int RGWRados::Bucket::UpdateIndex::complete(const DoutPrefixProvider *dpp, int64_t poolid, uint64_t epoch, uint64_t size, uint64_t accounted_size, ceph::real_time& ut, const string& etag, const string& content_type, const string& storage_class, @@ -6082,7 +6100,7 @@ int RGWRados::Bucket::UpdateIndex::complete(int64_t poolid, uint64_t epoch, RGWRados *store = target->get_store(); BucketShard *bs; - int ret = get_bucket_shard(&bs); + int ret = get_bucket_shard(&bs, dpp); if (ret < 0) { ldout(store->ctx(), 5) << "failed to get BucketShard object: ret=" << ret << dendl; return ret; @@ -6112,7 +6130,7 @@ int RGWRados::Bucket::UpdateIndex::complete(int64_t poolid, uint64_t epoch, ret = store->cls_obj_complete_add(*bs, obj, optag, poolid, epoch, ent, category, remove_objs, bilog_flags, zones_trace); - int r = store->svc.datalog_rados->add_entry(target->bucket_info, bs->shard_id); + int r = store->svc.datalog_rados->add_entry(dpp, target->bucket_info, bs->shard_id); if (r < 0) { lderr(store->ctx()) << "ERROR: failed writing data log" << dendl; } @@ -6120,7 +6138,8 @@ int RGWRados::Bucket::UpdateIndex::complete(int64_t poolid, uint64_t epoch, return ret; } -int RGWRados::Bucket::UpdateIndex::complete_del(int64_t poolid, uint64_t epoch, +int RGWRados::Bucket::UpdateIndex::complete_del(const DoutPrefixProvider *dpp, + int64_t poolid, uint64_t epoch, real_time& removed_mtime, list *remove_objs) { @@ -6130,7 +6149,7 @@ int RGWRados::Bucket::UpdateIndex::complete_del(int64_t poolid, uint64_t epoch, RGWRados *store = target->get_store(); BucketShard *bs; - int ret = get_bucket_shard(&bs); + int ret = get_bucket_shard(&bs, dpp); if (ret < 0) { ldout(store->ctx(), 5) << "failed to get BucketShard object: ret=" << ret << dendl; return ret; @@ -6138,7 +6157,7 @@ int RGWRados::Bucket::UpdateIndex::complete_del(int64_t poolid, uint64_t epoch, ret = store->cls_obj_complete_del(*bs, optag, poolid, epoch, obj, removed_mtime, remove_objs, bilog_flags, zones_trace); - int r = store->svc.datalog_rados->add_entry(target->bucket_info, bs->shard_id); + int r = store->svc.datalog_rados->add_entry(dpp, target->bucket_info, bs->shard_id); if (r < 0) { lderr(store->ctx()) << "ERROR: failed writing data log" << dendl; } @@ -6147,7 +6166,7 @@ int RGWRados::Bucket::UpdateIndex::complete_del(int64_t poolid, uint64_t epoch, } -int RGWRados::Bucket::UpdateIndex::cancel() +int RGWRados::Bucket::UpdateIndex::cancel(const DoutPrefixProvider *dpp) { if (blind) { return 0; @@ -6155,7 +6174,7 @@ int RGWRados::Bucket::UpdateIndex::cancel() RGWRados *store = target->get_store(); BucketShard *bs; - int ret = guard_reshard(&bs, [&](BucketShard *bs) -> int { + int ret = guard_reshard(dpp, &bs, [&](BucketShard *bs) -> int { return store->cls_obj_complete_cancel(*bs, optag, obj, bilog_flags, zones_trace); }); @@ -6164,7 +6183,7 @@ int RGWRados::Bucket::UpdateIndex::cancel() * for following the specific bucket shard log. Otherwise they end up staying behind, and users * have no way to tell that they're all caught up */ - int r = store->svc.datalog_rados->add_entry(target->bucket_info, bs->shard_id); + int r = store->svc.datalog_rados->add_entry(dpp, target->bucket_info, bs->shard_id); if (r < 0) { lderr(store->ctx()) << "ERROR: failed writing data log" << dendl; } @@ -6172,7 +6191,7 @@ int RGWRados::Bucket::UpdateIndex::cancel() return ret; } -int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y) +int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y, const DoutPrefixProvider *dpp) { RGWRados *store = source->get_store(); CephContext *cct = store->ctx(); @@ -6189,7 +6208,7 @@ int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl, optio uint64_t max_chunk_size; RGWObjState *astate; - int r = source->get_state(&astate, true, y); + int r = source->get_state(dpp, &astate, true, y); if (r < 0) return r; @@ -6217,9 +6236,9 @@ int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl, optio read_obj = state.head_obj; } - r = store->get_max_chunk_size(read_obj.pool, &max_chunk_size); + r = store->get_max_chunk_size(read_obj.pool, &max_chunk_size, dpp); if (r < 0) { - ldout(cct, 0) << "ERROR: failed to get max_chunk_size() for pool " << read_obj.pool << dendl; + ldpp_dout(dpp, 0) << "ERROR: failed to get max_chunk_size() for pool " << read_obj.pool << dendl; return r; } @@ -6231,7 +6250,7 @@ int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl, optio if (reading_from_head) { /* only when reading from the head object do we need to do the atomic test */ - r = store->append_atomic_test(&source->get_ctx(), source->get_bucket_info(), state.obj, op, &astate, y); + r = store->append_atomic_test(dpp, &source->get_ctx(), source->get_bucket_info(), state.obj, op, &astate, y); if (r < 0) return r; @@ -6255,7 +6274,7 @@ int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl, optio } } - ldout(cct, 20) << "rados->read obj-ofs=" << ofs << " read_ofs=" << read_ofs << " read_len=" << read_len << dendl; + ldpp_dout(dpp, 20) << "rados->read obj-ofs=" << ofs << " read_ofs=" << read_ofs << " read_len=" << read_len << dendl; op.read(read_ofs, read_len, pbl, NULL); if (state.cur_pool != read_obj.pool) { @@ -6276,7 +6295,7 @@ int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl, optio state.cur_ioctx->locator_set_key(read_obj.loc); r = state.cur_ioctx->operate(read_obj.oid, &op, NULL); - ldout(cct, 20) << "rados->read r=" << r << " bl.length=" << bl.length() << dendl; + ldpp_dout(dpp, 20) << "rados->read r=" << r << " bl.length=" << bl.length() << dendl; if (r < 0) { return r; @@ -6402,7 +6421,7 @@ int RGWRados::get_obj_iterate_cb(const rgw_raw_obj& read_obj, off_t obj_ofs, return d->flush(std::move(completed)); } -int RGWRados::Object::Read::iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb, +int RGWRados::Object::Read::iterate(const DoutPrefixProvider *dpp, int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y) { RGWRados *store = source->get_store(); @@ -6414,7 +6433,7 @@ int RGWRados::Object::Read::iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb, auto aio = rgw::make_throttle(window_size, y); get_obj_data data(store, cb, &*aio, ofs, y); - int r = store->iterate_obj(obj_ctx, source->get_bucket_info(), state.obj, + int r = store->iterate_obj(dpp, obj_ctx, source->get_bucket_info(), state.obj, ofs, end, chunk_size, _get_obj_iterate_cb, &data, y); if (r < 0) { ldout(cct, 0) << "iterate_obj() failed with " << r << dendl; @@ -6425,7 +6444,7 @@ int RGWRados::Object::Read::iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb, return data.drain(); } -int RGWRados::iterate_obj(RGWObjectCtx& obj_ctx, +int RGWRados::iterate_obj(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, off_t ofs, off_t end, uint64_t max_chunk_size, iterate_obj_cb cb, void *arg, optional_yield y) @@ -6439,7 +6458,7 @@ int RGWRados::iterate_obj(RGWObjectCtx& obj_ctx, obj_to_raw(bucket_info.placement_rule, obj, &head_obj); - int r = get_obj_state(&obj_ctx, bucket_info, obj, &astate, false, y); + int r = get_obj_state(dpp, &obj_ctx, bucket_info, obj, &astate, false, y); if (r < 0) { return r; } @@ -6621,7 +6640,8 @@ int RGWRados::olh_init_modification(const RGWBucketInfo& bucket_info, RGWObjStat return ret; } -int RGWRados::guard_reshard(BucketShard *bs, +int RGWRados::guard_reshard(const DoutPrefixProvider *dpp, + BucketShard *bs, const rgw_obj& obj_instance, const RGWBucketInfo& bucket_info, std::function call) @@ -6631,7 +6651,7 @@ int RGWRados::guard_reshard(BucketShard *bs, int r; for (int i = 0; i < NUM_RESHARD_RETRIES; ++i) { - r = bs->init(pobj->bucket, *pobj, nullptr /* no RGWBucketInfo */); + r = bs->init(pobj->bucket, *pobj, nullptr /* no RGWBucketInfo */, dpp); if (r < 0) { ldout(cct, 5) << "bs.init() returned ret=" << r << dendl; return r; @@ -6642,7 +6662,7 @@ int RGWRados::guard_reshard(BucketShard *bs, } ldout(cct, 0) << "NOTICE: resharding operation on bucket index detected, blocking" << dendl; string new_bucket_id; - r = block_while_resharding(bs, &new_bucket_id, bucket_info, null_yield); + r = block_while_resharding(bs, &new_bucket_id, bucket_info, null_yield, dpp); if (r == -ERR_BUSY_RESHARDING) { continue; } @@ -6667,7 +6687,8 @@ int RGWRados::guard_reshard(BucketShard *bs, int RGWRados::block_while_resharding(RGWRados::BucketShard *bs, string *new_bucket_id, const RGWBucketInfo& bucket_info, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { int ret = 0; cls_rgw_bucket_instance_entry entry; @@ -6678,10 +6699,10 @@ int RGWRados::block_while_resharding(RGWRados::BucketShard *bs, // new_bucket_id and returns 0, otherwise it returns a negative // error code auto fetch_new_bucket_id = - [this, &bucket_info](const std::string& log_tag, + [this, &bucket_info, dpp](const std::string& log_tag, std::string* new_bucket_id) -> int { RGWBucketInfo fresh_bucket_info = bucket_info; - int ret = try_refresh_bucket_info(fresh_bucket_info, nullptr); + int ret = try_refresh_bucket_info(fresh_bucket_info, nullptr, dpp); if (ret < 0) { ldout(cct, 0) << __func__ << " ERROR: failed to refresh bucket info after reshard at " << @@ -6767,7 +6788,7 @@ int RGWRados::block_while_resharding(RGWRados::BucketShard *bs, return -ERR_BUSY_RESHARDING; } -int RGWRados::bucket_index_link_olh(const RGWBucketInfo& bucket_info, RGWObjState& olh_state, const rgw_obj& obj_instance, +int RGWRados::bucket_index_link_olh(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, RGWObjState& olh_state, const rgw_obj& obj_instance, bool delete_marker, const string& op_tag, struct rgw_bucket_dir_entry_meta *meta, @@ -6789,7 +6810,7 @@ int RGWRados::bucket_index_link_olh(const RGWBucketInfo& bucket_info, RGWObjStat BucketShard bs(this); - r = guard_reshard(&bs, obj_instance, bucket_info, + r = guard_reshard(dpp, &bs, obj_instance, bucket_info, [&](BucketShard *bs) -> int { cls_rgw_obj_key key(obj_instance.key.get_index_key_name(), obj_instance.key.instance); auto& ref = bs->bucket_obj.get_ref(); @@ -6806,7 +6827,7 @@ int RGWRados::bucket_index_link_olh(const RGWBucketInfo& bucket_info, RGWObjStat return r; } - r = svc.datalog_rados->add_entry(bucket_info, bs.shard_id); + r = svc.datalog_rados->add_entry(dpp, bucket_info, bs.shard_id); if (r < 0) { ldout(cct, 0) << "ERROR: failed writing data log" << dendl; } @@ -6820,7 +6841,7 @@ void RGWRados::bucket_index_guard_olh_op(RGWObjState& olh_state, ObjectOperation op.cmpxattr(RGW_ATTR_OLH_ID_TAG, CEPH_OSD_CMPXATTR_OP_EQ, olh_state.olh_tag); } -int RGWRados::bucket_index_unlink_instance(const RGWBucketInfo& bucket_info, const rgw_obj& obj_instance, +int RGWRados::bucket_index_unlink_instance(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, const rgw_obj& obj_instance, const string& op_tag, const string& olh_tag, uint64_t olh_epoch, rgw_zone_set *_zones_trace) { rgw_rados_ref ref; @@ -6838,7 +6859,7 @@ int RGWRados::bucket_index_unlink_instance(const RGWBucketInfo& bucket_info, con BucketShard bs(this); cls_rgw_obj_key key(obj_instance.key.get_index_key_name(), obj_instance.key.instance); - r = guard_reshard(&bs, obj_instance, bucket_info, + r = guard_reshard(dpp, &bs, obj_instance, bucket_info, [&](BucketShard *bs) -> int { auto& ref = bs->bucket_obj.get_ref(); librados::ObjectWriteOperation op; @@ -6855,7 +6876,8 @@ int RGWRados::bucket_index_unlink_instance(const RGWBucketInfo& bucket_info, con return 0; } -int RGWRados::bucket_index_read_olh_log(const RGWBucketInfo& bucket_info, RGWObjState& state, +int RGWRados::bucket_index_read_olh_log(const DoutPrefixProvider *dpp, + const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& obj_instance, uint64_t ver_marker, map > *log, bool *is_truncated) @@ -6868,7 +6890,7 @@ int RGWRados::bucket_index_read_olh_log(const RGWBucketInfo& bucket_info, RGWObj BucketShard bs(this); int ret = - bs.init(obj_instance.bucket, obj_instance, nullptr /* no RGWBucketInfo */); + bs.init(obj_instance.bucket, obj_instance, nullptr /* no RGWBucketInfo */, dpp); if (ret < 0) { ldout(cct, 5) << "bs.init() returned ret=" << ret << dendl; return ret; @@ -6878,7 +6900,7 @@ int RGWRados::bucket_index_read_olh_log(const RGWBucketInfo& bucket_info, RGWObj cls_rgw_obj_key key(obj_instance.key.get_index_key_name(), string()); - ret = guard_reshard(&bs, obj_instance, bucket_info, + ret = guard_reshard(dpp, &bs, obj_instance, bucket_info, [&](BucketShard *bs) -> int { auto& ref = bs->bucket_obj.get_ref(); ObjectReadOperation op; @@ -6963,7 +6985,7 @@ int RGWRados::repair_olh(RGWObjState* state, const RGWBucketInfo& bucket_info, return 0; } -int RGWRados::bucket_index_trim_olh_log(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& obj_instance, uint64_t ver) +int RGWRados::bucket_index_trim_olh_log(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& obj_instance, uint64_t ver) { rgw_rados_ref ref; int r = get_obj_head_ref(bucket_info, obj_instance, &ref); @@ -6973,7 +6995,7 @@ int RGWRados::bucket_index_trim_olh_log(const RGWBucketInfo& bucket_info, RGWObj BucketShard bs(this); int ret = - bs.init(obj_instance.bucket, obj_instance, nullptr /* no RGWBucketInfo */); + bs.init(obj_instance.bucket, obj_instance, nullptr /* no RGWBucketInfo */, dpp); if (ret < 0) { ldout(cct, 5) << "bs.init() returned ret=" << ret << dendl; return ret; @@ -6983,7 +7005,7 @@ int RGWRados::bucket_index_trim_olh_log(const RGWBucketInfo& bucket_info, RGWObj cls_rgw_obj_key key(obj_instance.key.get_index_key_name(), string()); - ret = guard_reshard(&bs, obj_instance, bucket_info, + ret = guard_reshard(dpp, &bs, obj_instance, bucket_info, [&](BucketShard *pbs) -> int { ObjectWriteOperation op; cls_rgw_guard_bucket_resharding(op, -ERR_BUSY_RESHARDING); @@ -6998,7 +7020,7 @@ int RGWRados::bucket_index_trim_olh_log(const RGWBucketInfo& bucket_info, RGWObj return 0; } -int RGWRados::bucket_index_clear_olh(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& obj_instance) +int RGWRados::bucket_index_clear_olh(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& obj_instance) { rgw_rados_ref ref; int r = get_obj_head_ref(bucket_info, obj_instance, &ref); @@ -7012,7 +7034,7 @@ int RGWRados::bucket_index_clear_olh(const RGWBucketInfo& bucket_info, RGWObjSta cls_rgw_obj_key key(obj_instance.key.get_index_key_name(), string()); - int ret = guard_reshard(&bs, obj_instance, bucket_info, + int ret = guard_reshard(dpp, &bs, obj_instance, bucket_info, [&](BucketShard *pbs) -> int { ObjectWriteOperation op; auto& ref = pbs->bucket_obj.get_ref(); @@ -7040,7 +7062,7 @@ static int decode_olh_info(CephContext* cct, const bufferlist& bl, RGWOLHInfo *o } } -int RGWRados::apply_olh_log(RGWObjectCtx& obj_ctx, RGWObjState& state, const RGWBucketInfo& bucket_info, const rgw_obj& obj, +int RGWRados::apply_olh_log(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, RGWObjState& state, const RGWBucketInfo& bucket_info, const rgw_obj& obj, bufferlist& olh_tag, map >& log, uint64_t *plast_ver, rgw_zone_set* zones_trace) { @@ -7155,7 +7177,7 @@ int RGWRados::apply_olh_log(RGWObjectCtx& obj_ctx, RGWObjState& state, const RGW liter != remove_instances.end(); ++liter) { cls_rgw_obj_key& key = *liter; rgw_obj obj_instance(bucket, key); - int ret = delete_obj(obj_ctx, bucket_info, obj_instance, 0, RGW_BILOG_FLAG_VERSIONED_OP, ceph::real_time(), zones_trace); + int ret = delete_obj(dpp, obj_ctx, bucket_info, obj_instance, 0, RGW_BILOG_FLAG_VERSIONED_OP, ceph::real_time(), zones_trace); if (ret < 0 && ret != -ENOENT) { ldout(cct, 0) << "ERROR: delete_obj() returned " << ret << " obj_instance=" << obj_instance << dendl; return ret; @@ -7172,7 +7194,7 @@ int RGWRados::apply_olh_log(RGWObjectCtx& obj_ctx, RGWObjState& state, const RGW return r; } - r = bucket_index_trim_olh_log(bucket_info, state, obj, last_ver); + r = bucket_index_trim_olh_log(dpp, bucket_info, state, obj, last_ver); if (r < 0) { ldout(cct, 0) << "ERROR: could not trim olh log, r=" << r << dendl; return r; @@ -7193,7 +7215,7 @@ int RGWRados::apply_olh_log(RGWObjectCtx& obj_ctx, RGWObjState& state, const RGW /* * only clear if was successful, otherwise we might clobber pending operations on this object */ - r = bucket_index_clear_olh(bucket_info, state, obj); + r = bucket_index_clear_olh(dpp, bucket_info, state, obj); if (r < 0) { ldout(cct, 0) << "ERROR: could not clear bucket index olh entries r=" << r << dendl; return r; @@ -7207,18 +7229,18 @@ int RGWRados::apply_olh_log(RGWObjectCtx& obj_ctx, RGWObjState& state, const RGW /* * read olh log and apply it */ -int RGWRados::update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, const RGWBucketInfo& bucket_info, const rgw_obj& obj, rgw_zone_set *zones_trace) +int RGWRados::update_olh(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, RGWObjState *state, const RGWBucketInfo& bucket_info, const rgw_obj& obj, rgw_zone_set *zones_trace) { map > log; bool is_truncated; uint64_t ver_marker = 0; do { - int ret = bucket_index_read_olh_log(bucket_info, *state, obj, ver_marker, &log, &is_truncated); + int ret = bucket_index_read_olh_log(dpp, bucket_info, *state, obj, ver_marker, &log, &is_truncated); if (ret < 0) { return ret; } - ret = apply_olh_log(obj_ctx, *state, bucket_info, obj, state->olh_tag, log, &ver_marker, zones_trace); + ret = apply_olh_log(dpp, obj_ctx, *state, bucket_info, obj, state->olh_tag, log, &ver_marker, zones_trace); if (ret < 0) { return ret; } @@ -7227,7 +7249,7 @@ int RGWRados::update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, const RGWBuc return 0; } -int RGWRados::set_olh(RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, const rgw_obj& target_obj, bool delete_marker, rgw_bucket_dir_entry_meta *meta, +int RGWRados::set_olh(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, const rgw_obj& target_obj, bool delete_marker, rgw_bucket_dir_entry_meta *meta, uint64_t olh_epoch, real_time unmod_since, bool high_precision_time, optional_yield y, rgw_zone_set *zones_trace, bool log_data_change) { @@ -7247,7 +7269,7 @@ int RGWRados::set_olh(RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, c obj_ctx.invalidate(olh_obj); } - ret = get_obj_state(&obj_ctx, bucket_info, olh_obj, &state, false, y); /* don't follow olh */ + ret = get_obj_state(dpp, &obj_ctx, bucket_info, olh_obj, &state, false, y); /* don't follow olh */ if (ret < 0) { return ret; } @@ -7260,7 +7282,7 @@ int RGWRados::set_olh(RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, c } return ret; } - ret = bucket_index_link_olh(bucket_info, *state, target_obj, delete_marker, + ret = bucket_index_link_olh(dpp, bucket_info, *state, target_obj, delete_marker, op_tag, meta, olh_epoch, unmod_since, high_precision_time, zones_trace, log_data_change); if (ret < 0) { @@ -7284,7 +7306,7 @@ int RGWRados::set_olh(RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, c return -EIO; } - ret = update_olh(obj_ctx, state, bucket_info, olh_obj); + ret = update_olh(dpp, obj_ctx, state, bucket_info, olh_obj); if (ret == -ECANCELED) { /* already did what we needed, no need to retry, raced with another user */ ret = 0; } @@ -7296,7 +7318,7 @@ int RGWRados::set_olh(RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, c return 0; } -int RGWRados::unlink_obj_instance(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj, +int RGWRados::unlink_obj_instance(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj, uint64_t olh_epoch, optional_yield y, rgw_zone_set *zones_trace) { string op_tag; @@ -7314,7 +7336,7 @@ int RGWRados::unlink_obj_instance(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_i obj_ctx.invalidate(olh_obj); } - ret = get_obj_state(&obj_ctx, bucket_info, olh_obj, &state, false, y); /* don't follow olh */ + ret = get_obj_state(dpp, &obj_ctx, bucket_info, olh_obj, &state, false, y); /* don't follow olh */ if (ret < 0) return ret; @@ -7329,7 +7351,7 @@ int RGWRados::unlink_obj_instance(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_i string olh_tag(state->olh_tag.c_str(), state->olh_tag.length()); - ret = bucket_index_unlink_instance(bucket_info, target_obj, op_tag, olh_tag, olh_epoch, zones_trace); + ret = bucket_index_unlink_instance(dpp, bucket_info, target_obj, op_tag, olh_tag, olh_epoch, zones_trace); if (ret < 0) { ldout(cct, 20) << "bucket_index_unlink_instance() target_obj=" << target_obj << " returned " << ret << dendl; if (ret == -ECANCELED) { @@ -7345,7 +7367,7 @@ int RGWRados::unlink_obj_instance(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_i return -EIO; } - ret = update_olh(obj_ctx, state, bucket_info, olh_obj, zones_trace); + ret = update_olh(dpp, obj_ctx, state, bucket_info, olh_obj, zones_trace); if (ret == -ECANCELED) { /* already did what we needed, no need to retry, raced with another user */ return 0; } @@ -7457,7 +7479,7 @@ int RGWRados::remove_olh_pending_entries(const RGWBucketInfo& bucket_info, RGWOb return 0; } -int RGWRados::follow_olh(const RGWBucketInfo& bucket_info, RGWObjectCtx& obj_ctx, RGWObjState *state, const rgw_obj& olh_obj, rgw_obj *target) +int RGWRados::follow_olh(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, RGWObjectCtx& obj_ctx, RGWObjState *state, const rgw_obj& olh_obj, rgw_obj *target) { map pending_entries; rgw_filter_attrset(state->attrset, RGW_ATTR_OLH_PENDING_PREFIX, &pending_entries); @@ -7475,7 +7497,7 @@ int RGWRados::follow_olh(const RGWBucketInfo& bucket_info, RGWObjectCtx& obj_ctx if (!pending_entries.empty()) { ldout(cct, 20) << __func__ << "(): found pending entries, need to update_olh() on bucket=" << olh_obj.bucket << dendl; - int ret = update_olh(obj_ctx, state, bucket_info, olh_obj); + int ret = update_olh(dpp, obj_ctx, state, bucket_info, olh_obj); if (ret < 0) { return ret; } @@ -7649,20 +7671,23 @@ int RGWRados::get_bucket_instance_info(RGWSysObjectCtx& obj_ctx, RGWBucketInfo& info, real_time *pmtime, map *pattrs, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { rgw_bucket bucket; rgw_bucket_parse_bucket_key(cct, meta_key, &bucket, nullptr); - return get_bucket_instance_info(obj_ctx, bucket, info, pmtime, pattrs, y); + return get_bucket_instance_info(obj_ctx, bucket, info, pmtime, pattrs, y, dpp); } int RGWRados::get_bucket_instance_info(RGWSysObjectCtx& obj_ctx, const rgw_bucket& bucket, RGWBucketInfo& info, - real_time *pmtime, map *pattrs, optional_yield y) + real_time *pmtime, map *pattrs, optional_yield y, + const DoutPrefixProvider *dpp) { RGWSI_MetaBackend_CtxParams bectx_params = RGWSI_MetaBackend_CtxParams_SObj(&obj_ctx); return ctl.bucket->read_bucket_instance_info(bucket, &info, y, + dpp, RGWBucketCtl::BucketInstance::GetParams() .set_mtime(pmtime) .set_attrs(pattrs) @@ -7673,14 +7698,15 @@ int RGWRados::get_bucket_info(RGWServices *svc, const string& tenant, const string& bucket_name, RGWBucketInfo& info, real_time *pmtime, - optional_yield y, map *pattrs) + optional_yield y, + const DoutPrefixProvider *dpp, map *pattrs) { auto obj_ctx = svc->sysobj->init_obj_ctx(); RGWSI_MetaBackend_CtxParams bectx_params = RGWSI_MetaBackend_CtxParams_SObj(&obj_ctx); rgw_bucket bucket; bucket.tenant = tenant; bucket.name = bucket_name; - return ctl.bucket->read_bucket_info(bucket, &info, y, + return ctl.bucket->read_bucket_info(bucket, &info, y, dpp, RGWBucketCtl::BucketInstance::GetParams() .set_mtime(pmtime) .set_attrs(pattrs) @@ -7689,6 +7715,7 @@ int RGWRados::get_bucket_info(RGWServices *svc, int RGWRados::try_refresh_bucket_info(RGWBucketInfo& info, ceph::real_time *pmtime, + const DoutPrefixProvider *dpp, map *pattrs) { rgw_bucket bucket = info.bucket; @@ -7696,7 +7723,7 @@ int RGWRados::try_refresh_bucket_info(RGWBucketInfo& info, auto rv = info.objv_tracker.read_version; - return ctl.bucket->read_bucket_info(bucket, &info, null_yield, + return ctl.bucket->read_bucket_info(bucket, &info, null_yield, dpp, RGWBucketCtl::BucketInstance::GetParams() .set_mtime(pmtime) .set_attrs(pattrs) @@ -7704,9 +7731,10 @@ int RGWRados::try_refresh_bucket_info(RGWBucketInfo& info, } int RGWRados::put_bucket_instance_info(RGWBucketInfo& info, bool exclusive, - real_time mtime, map *pattrs) + real_time mtime, map *pattrs, + const DoutPrefixProvider *dpp) { - return ctl.bucket->store_bucket_instance_info(info.bucket, info, null_yield, + return ctl.bucket->store_bucket_instance_info(info.bucket, info, null_yield, dpp, RGWBucketCtl::BucketInstance::PutParams() .set_exclusive(exclusive) .set_mtime(mtime) @@ -7714,11 +7742,12 @@ int RGWRados::put_bucket_instance_info(RGWBucketInfo& info, bool exclusive, } int RGWRados::put_linked_bucket_info(RGWBucketInfo& info, bool exclusive, real_time mtime, obj_version *pep_objv, - map *pattrs, bool create_entry_point) + map *pattrs, bool create_entry_point, + const DoutPrefixProvider *dpp) { bool create_head = !info.has_instance_obj || create_entry_point; - int ret = put_bucket_instance_info(info, exclusive, mtime, pattrs); + int ret = put_bucket_instance_info(info, exclusive, mtime, pattrs, dpp); if (ret < 0) { return ret; } @@ -7740,7 +7769,7 @@ int RGWRados::put_linked_bucket_info(RGWBucketInfo& info, bool exclusive, real_t *pep_objv = ot.write_version; } } - ret = ctl.bucket->store_bucket_entrypoint_info(info.bucket, entry_point, null_yield, RGWBucketCtl::Bucket::PutParams() + ret = ctl.bucket->store_bucket_entrypoint_info(info.bucket, entry_point, null_yield, dpp, RGWBucketCtl::Bucket::PutParams() .set_exclusive(exclusive) .set_objv_tracker(&ot) .set_mtime(mtime)); @@ -7750,7 +7779,7 @@ int RGWRados::put_linked_bucket_info(RGWBucketInfo& info, bool exclusive, real_t return 0; } -int RGWRados::update_containers_stats(map& m) +int RGWRados::update_containers_stats(map& m, const DoutPrefixProvider *dpp) { auto obj_ctx = svc.sysobj->init_obj_ctx(); @@ -7765,7 +7794,7 @@ int RGWRados::update_containers_stats(map& m) vector headers; RGWBucketInfo bucket_info; - int ret = get_bucket_instance_info(obj_ctx, bucket, bucket_info, NULL, NULL, null_yield); + int ret = get_bucket_instance_info(obj_ctx, bucket, bucket_info, NULL, NULL, null_yield, dpp); if (ret < 0) { return ret; } @@ -8041,10 +8070,10 @@ int RGWRados::bi_put(BucketShard& bs, rgw_cls_bi_entry& entry) return 0; } -int RGWRados::bi_put(rgw_bucket& bucket, rgw_obj& obj, rgw_cls_bi_entry& entry) +int RGWRados::bi_put(const DoutPrefixProvider *dpp, rgw_bucket& bucket, rgw_obj& obj, rgw_cls_bi_entry& entry) { BucketShard bs(this); - int ret = bs.init(bucket, obj, nullptr /* no RGWBucketInfo */); + int ret = bs.init(bucket, obj, nullptr /* no RGWBucketInfo */, dpp); if (ret < 0) { ldout(cct, 5) << "bs.init() returned ret=" << ret << dendl; return ret; @@ -8053,11 +8082,11 @@ int RGWRados::bi_put(rgw_bucket& bucket, rgw_obj& obj, rgw_cls_bi_entry& entry) return bi_put(bs, entry); } -int RGWRados::bi_list(rgw_bucket& bucket, const string& obj_name, const string& marker, uint32_t max, list *entries, bool *is_truncated) +int RGWRados::bi_list(const DoutPrefixProvider *dpp, rgw_bucket& bucket, const string& obj_name, const string& marker, uint32_t max, list *entries, bool *is_truncated) { rgw_obj obj(bucket, obj_name); BucketShard bs(this); - int ret = bs.init(bucket, obj, nullptr /* no RGWBucketInfo */); + int ret = bs.init(bucket, obj, nullptr /* no RGWBucketInfo */, dpp); if (ret < 0) { ldout(cct, 5) << "bs.init() returned ret=" << ret << dendl; return ret; @@ -8099,10 +8128,10 @@ int RGWRados::bi_remove(BucketShard& bs) return 0; } -int RGWRados::bi_list(const RGWBucketInfo& bucket_info, int shard_id, const string& filter_obj, const string& marker, uint32_t max, list *entries, bool *is_truncated) +int RGWRados::bi_list(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, int shard_id, const string& filter_obj, const string& marker, uint32_t max, list *entries, bool *is_truncated) { BucketShard bs(this); - int ret = bs.init(bucket_info.bucket, shard_id, bucket_info.layout.current_index, nullptr /* no RGWBucketInfo */); + int ret = bs.init(bucket_info.bucket, shard_id, bucket_info.layout.current_index, nullptr /* no RGWBucketInfo */, dpp); if (ret < 0) { ldout(cct, 5) << "bs.init() returned ret=" << ret << dendl; return ret; @@ -8154,9 +8183,9 @@ int RGWRados::process_lc() return ret; } -bool RGWRados::process_expire_objects() +bool RGWRados::process_expire_objects(const DoutPrefixProvider *dpp) { - return obj_expirer->inspect_all_shards(utime_t(), ceph_clock_now()); + return obj_expirer->inspect_all_shards(dpp, utime_t(), ceph_clock_now()); } int RGWRados::cls_obj_prepare_op(BucketShard& bs, RGWModifyOp op, string& tag, @@ -8283,7 +8312,8 @@ uint32_t RGWRados::calc_ordered_bucket_list_per_shard(uint32_t num_entries, } -int RGWRados::cls_bucket_list_ordered(RGWBucketInfo& bucket_info, +int RGWRados::cls_bucket_list_ordered(const DoutPrefixProvider *dpp, + RGWBucketInfo& bucket_info, const int shard_id, const rgw_obj_index_key& start_after, const string& prefix, @@ -8468,7 +8498,7 @@ int RGWRados::cls_bucket_list_ordered(RGWBucketInfo& bucket_info, * well. */ librados::IoCtx sub_ctx; sub_ctx.dup(ioctx); - r = check_disk_state(sub_ctx, bucket_info, dirent, dirent, + r = check_disk_state(dpp, sub_ctx, bucket_info, dirent, dirent, updates[tracker.oid_name], y); if (r < 0 && r != -ENOENT) { return r; @@ -8550,7 +8580,8 @@ int RGWRados::cls_bucket_list_ordered(RGWBucketInfo& bucket_info, } -int RGWRados::cls_bucket_list_unordered(RGWBucketInfo& bucket_info, +int RGWRados::cls_bucket_list_unordered(const DoutPrefixProvider *dpp, + RGWBucketInfo& bucket_info, int shard_id, const rgw_obj_index_key& start_after, const string& prefix, @@ -8650,7 +8681,7 @@ int RGWRados::cls_bucket_list_unordered(RGWBucketInfo& bucket_info, * and if the tags are old we need to do cleanup as well. */ librados::IoCtx sub_ctx; sub_ctx.dup(ioctx); - r = check_disk_state(sub_ctx, bucket_info, dirent, dirent, updates[oid], y); + r = check_disk_state(dpp, sub_ctx, bucket_info, dirent, dirent, updates[oid], y); if (r < 0 && r != -ENOENT) { return r; } @@ -8823,7 +8854,8 @@ int RGWRados::remove_objs_from_index(RGWBucketInfo& bucket_info, liststore); - int r = get_obj_state(&rctx, bucket_info, obj, &astate, false, y); + int r = get_obj_state(dpp, &rctx, bucket_info, obj, &astate, false, y); if (r < 0) return r; @@ -8902,7 +8934,7 @@ int RGWRados::check_disk_state(librados::IoCtx io_ctx, if (loc.key.ns == RGW_OBJ_NS_MULTIPART) { dout(10) << "check_disk_state(): removing manifest part from index: " << loc << dendl; - r = delete_obj_index(loc, astate->mtime); + r = delete_obj_index(loc, astate->mtime, dpp); if (r < 0) { dout(0) << "WARNING: delete_obj_index() returned r=" << r << dendl; } @@ -8983,7 +9015,8 @@ int RGWRados::cls_bucket_head_async(const RGWBucketInfo& bucket_info, int shard_ int RGWRados::check_bucket_shards(const RGWBucketInfo& bucket_info, const rgw_bucket& bucket, - uint64_t num_objs) + uint64_t num_objs, + const DoutPrefixProvider *dpp) { if (! cct->_conf.get_val("rgw_dynamic_resharding")) { return 0; @@ -9022,12 +9055,12 @@ int RGWRados::check_bucket_shards(const RGWBucketInfo& bucket_info, "; new num shards " << final_num_shards << " (suggested " << suggested_num_shards << ")" << dendl; - return add_bucket_to_reshard(bucket_info, final_num_shards); + return add_bucket_to_reshard(bucket_info, final_num_shards, dpp); } -int RGWRados::add_bucket_to_reshard(const RGWBucketInfo& bucket_info, uint32_t new_num_shards) +int RGWRados::add_bucket_to_reshard(const RGWBucketInfo& bucket_info, uint32_t new_num_shards, const DoutPrefixProvider *dpp) { - RGWReshard reshard(this->store); + RGWReshard reshard(this->store, dpp); uint32_t num_source_shards = (bucket_info.layout.current_index.layout.normal.num_shards > 0 ? bucket_info.layout.current_index.layout.normal.num_shards : 1); @@ -9125,7 +9158,7 @@ int RGWRados::delete_raw_obj_aio(const rgw_raw_obj& obj, list& handles, bool keep_index_consistent, optional_yield y) @@ -9141,7 +9174,7 @@ int RGWRados::delete_obj_aio(const rgw_obj& obj, RGWRados::Bucket bop(this, bucket_info); RGWRados::Bucket::UpdateIndex index_op(&bop, obj); - ret = index_op.prepare(CLS_RGW_OP_DEL, &astate->write_tag, y); + ret = index_op.prepare(dpp, CLS_RGW_OP_DEL, &astate->write_tag, y); if (ret < 0) { lderr(cct) << "ERROR: failed to prepare index op with ret=" << ret << dendl; return ret; @@ -9163,7 +9196,7 @@ int RGWRados::delete_obj_aio(const rgw_obj& obj, handles.push_back(c); if (keep_index_consistent) { - ret = delete_obj_index(obj, astate->mtime); + ret = delete_obj_index(obj, astate->mtime, dpp); if (ret < 0) { lderr(cct) << "ERROR: failed to delete obj index with ret=" << ret << dendl; return ret; diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 53fdb9b55627d..debd342725a1b 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -464,11 +464,11 @@ class RGWRados int get_system_obj_ref(const rgw_raw_obj& obj, rgw_rados_ref *ref); uint64_t max_bucket_id; - int get_olh_target_state(RGWObjectCtx& rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, + int get_olh_target_state(const DoutPrefixProvider *dpp, RGWObjectCtx& rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState *olh_state, RGWObjState **target_state, optional_yield y); - int get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state, + int get_obj_state_impl(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state, bool follow_olh, optional_yield y, bool assume_noent = false); - int append_atomic_test(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, + int append_atomic_test(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::ObjectOperation& op, RGWObjState **state, optional_yield y); int append_atomic_test(const RGWObjState* astate, librados::ObjectOperation& op); @@ -603,8 +603,8 @@ public: int get_required_alignment(const rgw_pool& pool, uint64_t *alignment); void get_max_aligned_size(uint64_t size, uint64_t alignment, uint64_t *max_size); - int get_max_chunk_size(const rgw_pool& pool, uint64_t *max_chunk_size, uint64_t *palignment = nullptr); - int get_max_chunk_size(const rgw_placement_rule& placement_rule, const rgw_obj& obj, uint64_t *max_chunk_size, uint64_t *palignment = nullptr); + int get_max_chunk_size(const rgw_pool& pool, uint64_t *max_chunk_size, const DoutPrefixProvider *dpp, uint64_t *palignment = nullptr); + int get_max_chunk_size(const rgw_placement_rule& placement_rule, const rgw_obj& obj, uint64_t *max_chunk_size, const DoutPrefixProvider *dpp, uint64_t *palignment = nullptr); uint32_t get_max_bucket_shards() { return RGWSI_BucketIndex_RADOS::shards_max(); @@ -624,16 +624,16 @@ public: CephContext *ctx() { return cct; } /** do all necessary setup of the storage device */ - int initialize(CephContext *_cct) { + int initialize(CephContext *_cct, const DoutPrefixProvider *dpp) { set_context(_cct); - return initialize(); + return initialize(dpp); } /** Initialize the RADOS instance and prepare to do other ops */ - int init_svc(bool raw); - int init_ctl(); + int init_svc(bool raw, const DoutPrefixProvider *dpp); + int init_ctl(const DoutPrefixProvider *dpp); int init_rados(); - int init_complete(); - int initialize(); + int init_complete(const DoutPrefixProvider *dpp); + int initialize(const DoutPrefixProvider *dpp); void finalize(); int register_to_service_map(const string& daemon_type, const map& meta); @@ -678,6 +678,7 @@ public: rgw_bucket *master_bucket, uint32_t *master_num_shards, optional_yield y, + const DoutPrefixProvider *dpp, bool exclusive = true); RGWCoroutinesManagerRegistry *get_cr_registry() { return cr_registry; } @@ -689,8 +690,8 @@ public: RGWSI_RADOS::Obj bucket_obj; explicit BucketShard(RGWRados *_store) : store(_store), shard_id(-1) {} - int init(const rgw_bucket& _bucket, const rgw_obj& obj, RGWBucketInfo* out); - int init(const rgw_bucket& _bucket, int sid, const rgw::bucket_index_layout_generation& idx_layout, RGWBucketInfo* out); + int init(const rgw_bucket& _bucket, const rgw_obj& obj, RGWBucketInfo* out, const DoutPrefixProvider *dpp); + int init(const rgw_bucket& _bucket, int sid, const rgw::bucket_index_layout_generation& idx_layout, RGWBucketInfo* out, const DoutPrefixProvider *dpp); int init(const RGWBucketInfo& bucket_info, const rgw_obj& obj); int init(const RGWBucketInfo& bucket_info, const rgw::bucket_index_layout_generation& idx_layout, int sid); }; @@ -710,10 +711,10 @@ public: bool bs_initialized; protected: - int get_state(RGWObjState **pstate, bool follow_olh, optional_yield y, bool assume_noent = false); + int get_state(const DoutPrefixProvider *dpp, RGWObjState **pstate, bool follow_olh, optional_yield y, bool assume_noent = false); void invalidate_state(); - int prepare_atomic_modification(librados::ObjectWriteOperation& op, bool reset_obj, const string *ptag, + int prepare_atomic_modification(const DoutPrefixProvider *dpp, librados::ObjectWriteOperation& op, bool reset_obj, const string *ptag, const char *ifmatch, const char *ifnomatch, bool removal_op, bool modify_tail, optional_yield y); int complete_atomic_modification(); @@ -727,12 +728,12 @@ public: rgw_obj& get_obj() { return obj; } RGWObjectCtx& get_ctx() { return ctx; } RGWBucketInfo& get_bucket_info() { return bucket_info; } - int get_manifest(RGWObjManifest **pmanifest, optional_yield y); + int get_manifest(const DoutPrefixProvider *dpp, RGWObjManifest **pmanifest, optional_yield y); - int get_bucket_shard(BucketShard **pbs) { + int get_bucket_shard(BucketShard **pbs, const DoutPrefixProvider *dpp) { if (!bs_initialized) { int r = - bs.init(bucket_info.bucket, obj, nullptr /* no RGWBucketInfo */); + bs.init(bucket_info.bucket, obj, nullptr /* no RGWBucketInfo */, dpp); if (r < 0) { return r; } @@ -787,11 +788,11 @@ public: explicit Read(RGWRados::Object *_source) : source(_source) {} - int prepare(optional_yield y); + int prepare(optional_yield y, const DoutPrefixProvider *dpp); static int range_to_ofs(uint64_t obj_size, int64_t &ofs, int64_t &end); - int read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y); - int iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y); - int get_attr(const char *name, bufferlist& dest, optional_yield y); + int read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y, const DoutPrefixProvider *dpp); + int iterate(const DoutPrefixProvider *dpp, int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y); + int get_attr(const DoutPrefixProvider *dpp, const char *name, bufferlist& dest, optional_yield y); }; struct Write { @@ -827,11 +828,12 @@ public: explicit Write(RGWRados::Object *_target) : target(_target) {} - int _do_write_meta(uint64_t size, uint64_t accounted_size, + int _do_write_meta(const DoutPrefixProvider *dpp, + uint64_t size, uint64_t accounted_size, map& attrs, bool modify_tail, bool assume_noent, void *index_op, optional_yield y); - int write_meta(uint64_t size, uint64_t accounted_size, + int write_meta(const DoutPrefixProvider *dpp, uint64_t size, uint64_t accounted_size, map& attrs, optional_yield y); int write_data(const char *data, uint64_t ofs, uint64_t len, bool exclusive); const req_state* get_req_state() { @@ -870,7 +872,7 @@ public: explicit Delete(RGWRados::Object *_target) : target(_target) {} - int delete_obj(optional_yield y); + int delete_obj(optional_yield y, const DoutPrefixProvider *dpp); }; struct Stat { @@ -916,7 +918,7 @@ public: rgw_bucket& get_bucket() { return bucket; } RGWBucketInfo& get_bucket_info() { return bucket_info; } - int update_bucket_id(const string& new_bucket_id); + int update_bucket_id(const string& new_bucket_id, const DoutPrefixProvider *dpp); int get_shard_id() { return shard_id; } void set_shard_id(int id) { @@ -934,9 +936,9 @@ public: bool prepared{false}; rgw_zone_set *zones_trace{nullptr}; - int init_bs() { + int init_bs(const DoutPrefixProvider *dpp) { int r = - bs.init(target->get_bucket(), obj, nullptr /* no RGWBucketInfo */); + bs.init(target->get_bucket(), obj, nullptr /* no RGWBucketInfo */, dpp); if (r < 0) { return r; } @@ -948,7 +950,7 @@ public: bs_initialized = false; } - int guard_reshard(BucketShard **pbs, std::function call); + int guard_reshard(const DoutPrefixProvider *dpp, BucketShard **pbs, std::function call); public: UpdateIndex(RGWRados::Bucket *_target, const rgw_obj& _obj) : target(_target), obj(_obj), @@ -956,9 +958,9 @@ public: blind = (target->get_bucket_info().layout.current_index.layout.type == rgw::BucketIndexType::Indexless); } - int get_bucket_shard(BucketShard **pbs) { + int get_bucket_shard(BucketShard **pbs, const DoutPrefixProvider *dpp) { if (!bs_initialized) { - int r = init_bs(); + int r = init_bs(dpp); if (r < 0) { return r; } @@ -975,17 +977,18 @@ public: zones_trace = _zones_trace; } - int prepare(RGWModifyOp, const string *write_tag, optional_yield y); - int complete(int64_t poolid, uint64_t epoch, uint64_t size, + int prepare(const DoutPrefixProvider *dpp, RGWModifyOp, const string *write_tag, optional_yield y); + int complete(const DoutPrefixProvider *dpp, int64_t poolid, uint64_t epoch, uint64_t size, uint64_t accounted_size, ceph::real_time& ut, const string& etag, const string& content_type, const string& storage_class, bufferlist *acl_bl, RGWObjCategory category, list *remove_objs, const string *user_data = nullptr, bool appendable = false); - int complete_del(int64_t poolid, uint64_t epoch, + int complete_del(const DoutPrefixProvider *dpp, + int64_t poolid, uint64_t epoch, ceph::real_time& removed_mtime, /* mtime of removed object */ list *remove_objs); - int cancel(); + int cancel(const DoutPrefixProvider *dpp); const string *get_optag() { return &optag; } @@ -1001,12 +1004,14 @@ public: RGWRados::Bucket *target; rgw_obj_key next_marker; - int list_objects_ordered(int64_t max, + int list_objects_ordered(const DoutPrefixProvider *dpp, + int64_t max, vector *result, map *common_prefixes, bool *is_truncated, optional_yield y); - int list_objects_unordered(int64_t max, + int list_objects_unordered(const DoutPrefixProvider *dpp, + int64_t max, vector *result, map *common_prefixes, bool *is_truncated, @@ -1035,16 +1040,16 @@ public: explicit List(RGWRados::Bucket *_target) : target(_target) {} - int list_objects(int64_t max, + int list_objects(const DoutPrefixProvider *dpp, int64_t max, vector *result, map *common_prefixes, bool *is_truncated, optional_yield y) { if (params.allow_unordered) { - return list_objects_unordered(max, result, common_prefixes, + return list_objects_unordered(dpp, max, result, common_prefixes, is_truncated, y); } else { - return list_objects_ordered(max, result, common_prefixes, + return list_objects_ordered(dpp, max, result, common_prefixes, is_truncated, y); } } @@ -1054,7 +1059,8 @@ public: }; // class List }; // class Bucket - int on_last_entry_in_listing(RGWBucketInfo& bucket_info, + int on_last_entry_in_listing(const DoutPrefixProvider *dpp, + RGWBucketInfo& bucket_info, const std::string& obj_prefix, const std::string& obj_delim, std::function handler); @@ -1073,7 +1079,8 @@ public: rgw::sal::RGWObject* obj, /* in */ bool& restored, /* out */ const DoutPrefixProvider *dpp); /* in/out */ - int copy_obj_to_remote_dest(RGWObjState *astate, + int copy_obj_to_remote_dest(const DoutPrefixProvider *dpp, + RGWObjState *astate, map& src_attrs, RGWRados::Object::Read& read_op, const rgw_user& user_id, @@ -1204,14 +1211,14 @@ public: const DoutPrefixProvider *dpp, optional_yield y); - int check_bucket_empty(RGWBucketInfo& bucket_info, optional_yield y); + int check_bucket_empty(const DoutPrefixProvider *dpp, RGWBucketInfo& bucket_info, optional_yield y); /** * Delete a bucket. * bucket: the name of the bucket to delete * Returns 0 on success, -ERR# otherwise. */ - int delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& objv_tracker, optional_yield y, bool check_empty = true); + int delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& objv_tracker, optional_yield y, const DoutPrefixProvider *dpp, bool check_empty = true); void wakeup_meta_sync_shards(set& shard_ids); void wakeup_data_sync_shards(const rgw_zone_id& source_zone, map >& shard_ids); @@ -1219,12 +1226,13 @@ public: RGWMetaSyncStatusManager* get_meta_sync_manager(); RGWDataSyncStatusManager* get_data_sync_manager(const rgw_zone_id& source_zone); - int set_bucket_owner(rgw_bucket& bucket, ACLOwner& owner); - int set_buckets_enabled(std::vector& buckets, bool enabled); - int bucket_suspended(rgw_bucket& bucket, bool *suspended); + int set_bucket_owner(rgw_bucket& bucket, ACLOwner& owner, const DoutPrefixProvider *dpp); + int set_buckets_enabled(std::vector& buckets, bool enabled, const DoutPrefixProvider *dpp); + int bucket_suspended(const DoutPrefixProvider *dpp, rgw_bucket& bucket, bool *suspended); /** Delete an object.*/ - int delete_obj(RGWObjectCtx& obj_ctx, + int delete_obj(const DoutPrefixProvider *dpp, + RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_owner, const rgw_obj& src_obj, int versioning_status, @@ -1235,7 +1243,7 @@ public: int delete_raw_obj(const rgw_raw_obj& obj); /** Remove an object from the bucket index */ - int delete_obj_index(const rgw_obj& obj, ceph::real_time mtime); + int delete_obj_index(const rgw_obj& obj, ceph::real_time mtime, const DoutPrefixProvider *dpp); /** * Set an attr on an object. @@ -1245,23 +1253,23 @@ public: * bl: the contents of the attr * Returns: 0 on success, -ERR# otherwise. */ - int set_attr(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& obj, const char *name, bufferlist& bl); + int set_attr(const DoutPrefixProvider *dpp, void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& obj, const char *name, bufferlist& bl); - int set_attrs(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& obj, + int set_attrs(const DoutPrefixProvider *dpp, void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& obj, map& attrs, map* rmattrs, optional_yield y); - int get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state, + int get_obj_state(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state, bool follow_olh, optional_yield y, bool assume_noent = false); - int get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state, optional_yield y) { - return get_obj_state(rctx, bucket_info, obj, state, true, y); + int get_obj_state(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state, optional_yield y) { + return get_obj_state(dpp, rctx, bucket_info, obj, state, true, y); } using iterate_obj_cb = int (*)(const rgw_raw_obj&, off_t, off_t, off_t, bool, RGWObjState*, void*); - int iterate_obj(RGWObjectCtx& ctx, const RGWBucketInfo& bucket_info, + int iterate_obj(const DoutPrefixProvider *dpp, RGWObjectCtx& ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, off_t ofs, off_t end, uint64_t max_chunk_size, iterate_obj_cb cb, void *arg, optional_yield y); @@ -1283,51 +1291,54 @@ public: int obj_operate(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::ObjectWriteOperation *op); int obj_operate(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::ObjectReadOperation *op); - int guard_reshard(BucketShard *bs, + int guard_reshard(const DoutPrefixProvider *dpp, + BucketShard *bs, const rgw_obj& obj_instance, const RGWBucketInfo& bucket_info, std::function call); int block_while_resharding(RGWRados::BucketShard *bs, string *new_bucket_id, const RGWBucketInfo& bucket_info, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); void bucket_index_guard_olh_op(RGWObjState& olh_state, librados::ObjectOperation& op); int olh_init_modification(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& olh_obj, string *op_tag); int olh_init_modification_impl(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& olh_obj, string *op_tag); - int bucket_index_link_olh(const RGWBucketInfo& bucket_info, RGWObjState& olh_state, + int bucket_index_link_olh(const DoutPrefixProvider *dpp, + const RGWBucketInfo& bucket_info, RGWObjState& olh_state, const rgw_obj& obj_instance, bool delete_marker, const string& op_tag, struct rgw_bucket_dir_entry_meta *meta, uint64_t olh_epoch, ceph::real_time unmod_since, bool high_precision_time, rgw_zone_set *zones_trace = nullptr, bool log_data_change = false); - int bucket_index_unlink_instance(const RGWBucketInfo& bucket_info, const rgw_obj& obj_instance, const string& op_tag, const string& olh_tag, uint64_t olh_epoch, rgw_zone_set *zones_trace = nullptr); - int bucket_index_read_olh_log(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& obj_instance, uint64_t ver_marker, + int bucket_index_unlink_instance(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, const rgw_obj& obj_instance, const string& op_tag, const string& olh_tag, uint64_t olh_epoch, rgw_zone_set *zones_trace = nullptr); + int bucket_index_read_olh_log(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& obj_instance, uint64_t ver_marker, map > *log, bool *is_truncated); - int bucket_index_trim_olh_log(const RGWBucketInfo& bucket_info, RGWObjState& obj_state, const rgw_obj& obj_instance, uint64_t ver); - int bucket_index_clear_olh(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& obj_instance); - int apply_olh_log(RGWObjectCtx& ctx, RGWObjState& obj_state, const RGWBucketInfo& bucket_info, const rgw_obj& obj, + int bucket_index_trim_olh_log(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, RGWObjState& obj_state, const rgw_obj& obj_instance, uint64_t ver); + int bucket_index_clear_olh(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& obj_instance); + int apply_olh_log(const DoutPrefixProvider *dpp, RGWObjectCtx& ctx, RGWObjState& obj_state, const RGWBucketInfo& bucket_info, const rgw_obj& obj, bufferlist& obj_tag, map >& log, uint64_t *plast_ver, rgw_zone_set *zones_trace = nullptr); - int update_olh(RGWObjectCtx& obj_ctx, RGWObjState *state, const RGWBucketInfo& bucket_info, const rgw_obj& obj, rgw_zone_set *zones_trace = nullptr); - int set_olh(RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, const rgw_obj& target_obj, bool delete_marker, rgw_bucket_dir_entry_meta *meta, + int update_olh(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, RGWObjState *state, const RGWBucketInfo& bucket_info, const rgw_obj& obj, rgw_zone_set *zones_trace = nullptr); + int set_olh(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, const rgw_obj& target_obj, bool delete_marker, rgw_bucket_dir_entry_meta *meta, uint64_t olh_epoch, ceph::real_time unmod_since, bool high_precision_time, optional_yield y, rgw_zone_set *zones_trace = nullptr, bool log_data_change = false); int repair_olh(RGWObjState* state, const RGWBucketInfo& bucket_info, const rgw_obj& obj); - int unlink_obj_instance(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj, + int unlink_obj_instance(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj, uint64_t olh_epoch, optional_yield y, rgw_zone_set *zones_trace = nullptr); void check_pending_olh_entries(map& pending_entries, map *rm_pending_entries); int remove_olh_pending_entries(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& olh_obj, map& pending_attrs); - int follow_olh(const RGWBucketInfo& bucket_info, RGWObjectCtx& ctx, RGWObjState *state, const rgw_obj& olh_obj, rgw_obj *target); + int follow_olh(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, RGWObjectCtx& ctx, RGWObjState *state, const rgw_obj& olh_obj, rgw_obj *target); int get_olh(const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWOLHInfo *olh); void gen_rand_obj_instance_name(rgw_obj_key *target_key); void gen_rand_obj_instance_name(rgw_obj *target); - int update_containers_stats(map& m); + int update_containers_stats(map& m, const DoutPrefixProvider *dpp); int append_async(rgw_raw_obj& obj, size_t size, bufferlist& bl); public: @@ -1344,17 +1355,18 @@ public: map& stats, string *max_marker, bool* syncstopped = NULL); int get_bucket_stats_async(RGWBucketInfo& bucket_info, int shard_id, RGWGetBucketStats_CB *cb); - int put_bucket_instance_info(RGWBucketInfo& info, bool exclusive, ceph::real_time mtime, map *pattrs); + int put_bucket_instance_info(RGWBucketInfo& info, bool exclusive, ceph::real_time mtime, map *pattrs, const DoutPrefixProvider *dpp); /* xxx dang obj_ctx -> svc */ - int get_bucket_instance_info(RGWSysObjectCtx& obj_ctx, const string& meta_key, RGWBucketInfo& info, ceph::real_time *pmtime, map *pattrs, optional_yield y); - int get_bucket_instance_info(RGWSysObjectCtx& obj_ctx, const rgw_bucket& bucket, RGWBucketInfo& info, ceph::real_time *pmtime, map *pattrs, optional_yield y); + int get_bucket_instance_info(RGWSysObjectCtx& obj_ctx, const string& meta_key, RGWBucketInfo& info, ceph::real_time *pmtime, map *pattrs, optional_yield y, const DoutPrefixProvider *dpp); + int get_bucket_instance_info(RGWSysObjectCtx& obj_ctx, const rgw_bucket& bucket, RGWBucketInfo& info, ceph::real_time *pmtime, map *pattrs, optional_yield y, const DoutPrefixProvider *dpp); static void make_bucket_entry_name(const string& tenant_name, const string& bucket_name, string& bucket_entry); int get_bucket_info(RGWServices *svc, const string& tenant_name, const string& bucket_name, RGWBucketInfo& info, - ceph::real_time *pmtime, optional_yield y, map *pattrs = NULL); + ceph::real_time *pmtime, optional_yield y, + const DoutPrefixProvider *dpp, map *pattrs = NULL); // Returns 0 on successful refresh. Returns error code if there was // an error or the version stored on the OSD is the same as that @@ -1362,10 +1374,12 @@ public: // int try_refresh_bucket_info(RGWBucketInfo& info, ceph::real_time *pmtime, + const DoutPrefixProvider *dpp, map *pattrs = nullptr); int put_linked_bucket_info(RGWBucketInfo& info, bool exclusive, ceph::real_time mtime, obj_version *pep_objv, - map *pattrs, bool create_entry_point); + map *pattrs, bool create_entry_point, + const DoutPrefixProvider *dpp); int cls_obj_prepare_op(BucketShard& bs, RGWModifyOp op, string& tag, rgw_obj& obj, uint16_t bilog_flags, optional_yield y, rgw_zone_set *zones_trace = nullptr); int cls_obj_complete_op(BucketShard& bs, const rgw_obj& obj, RGWModifyOp op, string& tag, int64_t pool, uint64_t epoch, @@ -1382,7 +1396,8 @@ public: using check_filter_t = bool (*)(const std::string&); - int cls_bucket_list_ordered(RGWBucketInfo& bucket_info, + int cls_bucket_list_ordered(const DoutPrefixProvider *dpp, + RGWBucketInfo& bucket_info, const int shard_id, const rgw_obj_index_key& start_after, const string& prefix, @@ -1396,7 +1411,8 @@ public: rgw_obj_index_key *last_entry, optional_yield y, check_filter_t force_check_filter = nullptr); - int cls_bucket_list_unordered(RGWBucketInfo& bucket_info, + int cls_bucket_list_unordered(const DoutPrefixProvider *dpp, + RGWBucketInfo& bucket_info, int shard_id, const rgw_obj_index_key& start_after, const string& prefix, @@ -1415,10 +1431,10 @@ public: int bi_get(const RGWBucketInfo& bucket_info, const rgw_obj& obj, BIIndexType index_type, rgw_cls_bi_entry *entry); void bi_put(librados::ObjectWriteOperation& op, BucketShard& bs, rgw_cls_bi_entry& entry); int bi_put(BucketShard& bs, rgw_cls_bi_entry& entry); - int bi_put(rgw_bucket& bucket, rgw_obj& obj, rgw_cls_bi_entry& entry); - int bi_list(const RGWBucketInfo& bucket_info, int shard_id, const string& filter_obj, const string& marker, uint32_t max, list *entries, bool *is_truncated); + int bi_put(const DoutPrefixProvider *dpp, rgw_bucket& bucket, rgw_obj& obj, rgw_cls_bi_entry& entry); + int bi_list(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, int shard_id, const string& filter_obj, const string& marker, uint32_t max, list *entries, bool *is_truncated); int bi_list(BucketShard& bs, const string& filter_obj, const string& marker, uint32_t max, list *entries, bool *is_truncated); - int bi_list(rgw_bucket& bucket, const string& obj_name, const string& marker, uint32_t max, + int bi_list(const DoutPrefixProvider *dpp, rgw_bucket& bucket, const string& obj_name, const string& marker, uint32_t max, list *entries, bool *is_truncated); int bi_remove(BucketShard& bs); @@ -1445,8 +1461,8 @@ public: int list_gc_objs(int *index, string& marker, uint32_t max, bool expired_only, std::list& result, bool *truncated, bool& processing_queue); int process_gc(bool expired_only); - bool process_expire_objects(); - int defer_gc(void *ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, optional_yield y); + bool process_expire_objects(const DoutPrefixProvider *dpp); + int defer_gc(const DoutPrefixProvider *dpp, void *ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, optional_yield y); int process_lc(); int list_lc_progress(string& marker, uint32_t max_entries, @@ -1463,23 +1479,23 @@ public: librados::IoCtx& dst_ioctx, const string& dst_oid, const string& dst_locator); int fix_head_obj_locator(const RGWBucketInfo& bucket_info, bool copy_obj, bool remove_bad, rgw_obj_key& key); - int fix_tail_obj_locator(const RGWBucketInfo& bucket_info, rgw_obj_key& key, bool fix, bool *need_fix, optional_yield y); + int fix_tail_obj_locator(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, rgw_obj_key& key, bool fix, bool *need_fix, optional_yield y); int check_quota(const rgw_user& bucket_owner, rgw_bucket& bucket, RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size, optional_yield y, bool check_size_only = false); int check_bucket_shards(const RGWBucketInfo& bucket_info, const rgw_bucket& bucket, - uint64_t num_objs); + uint64_t num_objs, const DoutPrefixProvider *dpp); - int add_bucket_to_reshard(const RGWBucketInfo& bucket_info, uint32_t new_num_shards); + int add_bucket_to_reshard(const RGWBucketInfo& bucket_info, uint32_t new_num_shards, const DoutPrefixProvider *dpp); uint64_t instance_id(); librados::Rados* get_rados_handle(); int delete_raw_obj_aio(const rgw_raw_obj& obj, list& handles); - int delete_obj_aio(const rgw_obj& obj, RGWBucketInfo& info, RGWObjState *astate, + int delete_obj_aio(const DoutPrefixProvider *dpp, const rgw_obj& obj, RGWBucketInfo& info, RGWObjState *astate, list& handles, bool keep_index_consistent, optional_yield y); @@ -1498,7 +1514,8 @@ public: * and -errno on other failures. (-ENOENT is not a failure, and it * will encode that info as a suggested update.) */ - int check_disk_state(librados::IoCtx io_ctx, + int check_disk_state(const DoutPrefixProvider *dpp, + librados::IoCtx io_ctx, const RGWBucketInfo& bucket_info, rgw_bucket_dir_entry& list_state, rgw_bucket_dir_entry& object, diff --git a/src/rgw/rgw_realm_reloader.cc b/src/rgw/rgw_realm_reloader.cc index d815ad14f3ae6..1487eb8c9149e 100644 --- a/src/rgw/rgw_realm_reloader.cc +++ b/src/rgw/rgw_realm_reloader.cc @@ -101,10 +101,12 @@ void RGWRealmReloader::reload() reload_scheduled = nullptr; } + const DoutPrefix dp(cct, dout_subsys, "rgw realm reloader: "); + while (!store) { // recreate and initialize a new store store = - RGWStoreManager::get_storage(cct, + RGWStoreManager::get_storage(&dp, cct, cct->_conf->rgw_enable_gc_threads, cct->_conf->rgw_enable_lc_threads, cct->_conf->rgw_enable_quota_threads, diff --git a/src/rgw/rgw_reshard.cc b/src/rgw/rgw_reshard.cc index 68352f3e56ad4..c2c915ce193fe 100644 --- a/src/rgw/rgw_reshard.cc +++ b/src/rgw/rgw_reshard.cc @@ -102,7 +102,8 @@ class BucketReshardShard { } public: - BucketReshardShard(rgw::sal::RGWRadosStore *_store, const RGWBucketInfo& _bucket_info, + BucketReshardShard(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *_store, const RGWBucketInfo& _bucket_info, int _num_shard, const rgw::bucket_index_layout_generation& _idx_layout, deque& _completions) : store(_store), bucket_info(_bucket_info), idx_layout(_idx_layout), bs(store->getRados()), @@ -110,7 +111,7 @@ public: { num_shard = (idx_layout.layout.normal.num_shards > 0 ? _num_shard : -1); - bs.init(bucket_info.bucket, num_shard, idx_layout, nullptr /* no RGWBucketInfo */); + bs.init(bucket_info.bucket, num_shard, idx_layout, nullptr /* no RGWBucketInfo */, dpp); max_aio_completions = store->ctx()->_conf.get_val("rgw_reshard_max_aio"); @@ -189,7 +190,8 @@ class BucketReshardManager { vector target_shards; public: - BucketReshardManager(rgw::sal::RGWRadosStore *_store, + BucketReshardManager(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *_store, const RGWBucketInfo& _target_bucket_info, int _num_target_shards) : store(_store), target_bucket_info(_target_bucket_info), @@ -198,7 +200,7 @@ public: const auto& idx_layout = target_bucket_info.layout.current_index; target_shards.resize(num_target_shards); for (int i = 0; i < num_target_shards; ++i) { - target_shards[i] = new BucketReshardShard(store, target_bucket_info, i, idx_layout, completions); + target_shards[i] = new BucketReshardShard(dpp, store, target_bucket_info, i, idx_layout, completions); } } @@ -329,7 +331,8 @@ static int create_new_bucket_instance(rgw::sal::RGWRadosStore *store, int new_num_shards, const RGWBucketInfo& bucket_info, map& attrs, - RGWBucketInfo& new_bucket_info) + RGWBucketInfo& new_bucket_info, + const DoutPrefixProvider *dpp) { new_bucket_info = bucket_info; @@ -347,7 +350,7 @@ static int create_new_bucket_instance(rgw::sal::RGWRadosStore *store, return ret; } - ret = store->getRados()->put_bucket_instance_info(new_bucket_info, true, real_time(), &attrs); + ret = store->getRados()->put_bucket_instance_info(new_bucket_info, true, real_time(), &attrs, dpp); if (ret < 0) { cerr << "ERROR: failed to store new bucket instance info: " << cpp_strerror(-ret) << std::endl; return ret; @@ -357,10 +360,11 @@ static int create_new_bucket_instance(rgw::sal::RGWRadosStore *store, } int RGWBucketReshard::create_new_bucket_instance(int new_num_shards, - RGWBucketInfo& new_bucket_info) + RGWBucketInfo& new_bucket_info, + const DoutPrefixProvider *dpp) { return ::create_new_bucket_instance(store, new_num_shards, - bucket_info, bucket_attrs, new_bucket_info); + bucket_info, bucket_attrs, new_bucket_info, dpp); } int RGWBucketReshard::cancel() @@ -378,15 +382,16 @@ int RGWBucketReshard::cancel() class BucketInfoReshardUpdate { + const DoutPrefixProvider *dpp; rgw::sal::RGWRadosStore *store; RGWBucketInfo& bucket_info; std::map bucket_attrs; bool in_progress{false}; - int set_status(cls_rgw_reshard_status s) { + int set_status(cls_rgw_reshard_status s, const DoutPrefixProvider *dpp) { bucket_info.reshard_status = s; - int ret = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), &bucket_attrs); + int ret = store->getRados()->put_bucket_instance_info(bucket_info, false, real_time(), &bucket_attrs, dpp); if (ret < 0) { ldout(store->ctx(), 0) << "ERROR: failed to write bucket info, ret=" << ret << dendl; return ret; @@ -395,10 +400,12 @@ class BucketInfoReshardUpdate } public: - BucketInfoReshardUpdate(rgw::sal::RGWRadosStore *_store, + BucketInfoReshardUpdate(const DoutPrefixProvider *_dpp, + rgw::sal::RGWRadosStore *_store, RGWBucketInfo& _bucket_info, map& _bucket_attrs, const string& new_bucket_id) : + dpp(_dpp), store(_store), bucket_info(_bucket_info), bucket_attrs(_bucket_attrs) @@ -418,12 +425,12 @@ public: bucket_info.new_bucket_instance_id.clear(); // clears new_bucket_instance as well - set_status(cls_rgw_reshard_status::NOT_RESHARDING); + set_status(cls_rgw_reshard_status::NOT_RESHARDING, dpp); } } int start() { - int ret = set_status(cls_rgw_reshard_status::IN_PROGRESS); + int ret = set_status(cls_rgw_reshard_status::IN_PROGRESS, dpp); if (ret < 0) { return ret; } @@ -432,7 +439,7 @@ public: } int complete() { - int ret = set_status(cls_rgw_reshard_status::DONE); + int ret = set_status(cls_rgw_reshard_status::DONE, dpp); if (ret < 0) { return ret; } @@ -525,7 +532,8 @@ int RGWBucketReshard::do_reshard(int num_shards, int max_entries, bool verbose, ostream *out, - Formatter *formatter) + Formatter *formatter, + const DoutPrefixProvider *dpp) { if (out) { const rgw_bucket& bucket = bucket_info.bucket; @@ -548,7 +556,7 @@ int RGWBucketReshard::do_reshard(int num_shards, // NB: destructor cleans up sharding state if reshard does not // complete successfully - BucketInfoReshardUpdate bucket_info_updater(store, bucket_info, bucket_attrs, new_bucket_info.bucket.bucket_id); + BucketInfoReshardUpdate bucket_info_updater(dpp, store, bucket_info, bucket_attrs, new_bucket_info.bucket.bucket_id); int ret = bucket_info_updater.start(); if (ret < 0) { @@ -558,7 +566,7 @@ int RGWBucketReshard::do_reshard(int num_shards, int num_target_shards = (new_bucket_info.layout.current_index.layout.normal.num_shards > 0 ? new_bucket_info.layout.current_index.layout.normal.num_shards : 1); - BucketReshardManager target_shards_mgr(store, new_bucket_info, num_target_shards); + BucketReshardManager target_shards_mgr(dpp, store, new_bucket_info, num_target_shards); bool verbose_json_out = verbose && (formatter != nullptr) && (out != nullptr); @@ -580,7 +588,7 @@ int RGWBucketReshard::do_reshard(int num_shards, marker.clear(); while (is_truncated) { entries.clear(); - ret = store->getRados()->bi_list(bucket_info, i, string(), marker, max_entries, &entries, &is_truncated); + ret = store->getRados()->bi_list(dpp, bucket_info, i, string(), marker, max_entries, &entries, &is_truncated); if (ret < 0 && ret != -ENOENT) { derr << "ERROR: bi_list(): " << cpp_strerror(-ret) << dendl; return ret; @@ -664,7 +672,7 @@ int RGWBucketReshard::do_reshard(int num_shards, return -EIO; } - ret = store->ctl()->bucket->link_bucket(new_bucket_info.owner, new_bucket_info.bucket, bucket_info.creation_time, null_yield); + ret = store->ctl()->bucket->link_bucket(new_bucket_info.owner, new_bucket_info.bucket, bucket_info.creation_time, null_yield, dpp); if (ret < 0) { lderr(store->ctx()) << "failed to link new bucket instance (bucket_id=" << new_bucket_info.bucket.bucket_id << ": " << cpp_strerror(-ret) << ")" << dendl; return ret; @@ -687,6 +695,7 @@ int RGWBucketReshard::get_status(list *status) int RGWBucketReshard::execute(int num_shards, int max_op_entries, + const DoutPrefixProvider *dpp, bool verbose, ostream *out, Formatter *formatter, RGWReshard* reshard_log) { @@ -696,7 +705,7 @@ int RGWBucketReshard::execute(int num_shards, int max_op_entries, } RGWBucketInfo new_bucket_info; - ret = create_new_bucket_instance(num_shards, new_bucket_info); + ret = create_new_bucket_instance(num_shards, new_bucket_info, dpp); if (ret < 0) { // shard state is uncertain, but this will attempt to remove them anyway goto error_out; @@ -720,7 +729,7 @@ int RGWBucketReshard::execute(int num_shards, int max_op_entries, ret = do_reshard(num_shards, new_bucket_info, max_op_entries, - verbose, out, formatter); + verbose, out, formatter, dpp); if (ret < 0) { goto error_out; } @@ -742,7 +751,7 @@ int RGWBucketReshard::execute(int num_shards, int max_op_entries, } ret = store->ctl()->bucket->remove_bucket_instance_info(bucket_info.bucket, - bucket_info, null_yield); + bucket_info, null_yield, dpp); if (ret < 0) { lderr(store->ctx()) << "Error: " << __func__ << " failed to clean old bucket info object \"" << @@ -773,7 +782,7 @@ error_out: ret2 = store->ctl()->bucket->remove_bucket_instance_info(new_bucket_info.bucket, new_bucket_info, - null_yield); + null_yield, dpp); if (ret2 < 0) { lderr(store->ctx()) << "Error: " << __func__ << " failed to clean bucket info object \"" << @@ -976,7 +985,7 @@ void RGWReshardWait::stop() } } -int RGWReshard::process_single_logshard(int logshard_num) +int RGWReshard::process_single_logshard(int logshard_num, const DoutPrefixProvider *dpp) { string marker; bool truncated = true; @@ -1018,7 +1027,7 @@ int RGWReshard::process_single_logshard(int logshard_num) ret = store->getRados()->get_bucket_info(store->svc(), entry.tenant, entry.bucket_name, bucket_info, nullptr, - null_yield, &attrs); + null_yield, dpp, &attrs); if (ret < 0 || bucket_info.bucket.bucket_id != entry.bucket_id) { if (ret < 0) { ldout(cct, 0) << __func__ << @@ -1054,7 +1063,7 @@ int RGWReshard::process_single_logshard(int logshard_num) } RGWBucketReshard br(store, bucket_info, attrs, nullptr); - ret = br.execute(entry.new_num_shards, max_entries, false, nullptr, + ret = br.execute(entry.new_num_shards, max_entries, dpp, false, nullptr, nullptr, this); if (ret < 0) { ldout(store->ctx(), 0) << __func__ << @@ -1104,7 +1113,7 @@ void RGWReshard::get_logshard_oid(int shard_num, string *logshard) *logshard = objname + buf; } -int RGWReshard::process_all_logshards() +int RGWReshard::process_all_logshards(const DoutPrefixProvider *dpp) { if (!store->svc()->zone->can_reshard()) { ldout(store->ctx(), 20) << __func__ << " Resharding is disabled" << dendl; @@ -1118,7 +1127,7 @@ int RGWReshard::process_all_logshards() ldout(store->ctx(), 20) << "processing logshard = " << logshard << dendl; - ret = process_single_logshard(i); + ret = process_single_logshard(i, dpp); ldout(store->ctx(), 20) << "finish processing logshard = " << logshard << " , ret = " << ret << dendl; } @@ -1151,7 +1160,7 @@ void RGWReshard::stop_processor() void *RGWReshard::ReshardWorker::entry() { do { utime_t start = ceph_clock_now(); - reshard->process_all_logshards(); + reshard->process_all_logshards(this); if (reshard->going_down()) break; @@ -1177,3 +1186,18 @@ void RGWReshard::ReshardWorker::stop() std::lock_guard l{lock}; cond.notify_all(); } + +CephContext *RGWReshard::ReshardWorker::get_cct() const +{ + return cct; +} + +unsigned RGWReshard::ReshardWorker::get_subsys() const +{ + return dout_subsys; +} + +std::ostream& RGWReshard::ReshardWorker::gen_prefix(std::ostream& out) const +{ + return out << "rgw reshard worker thread: "; +} diff --git a/src/rgw/rgw_reshard.h b/src/rgw/rgw_reshard.h index a5c190f59143f..cbdff34b1c200 100644 --- a/src/rgw/rgw_reshard.h +++ b/src/rgw/rgw_reshard.h @@ -85,13 +85,15 @@ private: static const std::initializer_list reshard_primes; int create_new_bucket_instance(int new_num_shards, - RGWBucketInfo& new_bucket_info); + RGWBucketInfo& new_bucket_info, + const DoutPrefixProvider *dpp); int do_reshard(int num_shards, RGWBucketInfo& new_bucket_info, int max_entries, bool verbose, ostream *os, - Formatter *formatter); + Formatter *formatter, + const DoutPrefixProvider *dpp); public: // pass nullptr for the final parameter if no outer reshard lock to @@ -101,6 +103,7 @@ public: const std::map& _bucket_attrs, RGWBucketReshardLock* _outer_reshard_lock); int execute(int num_shards, int max_op_entries, + const DoutPrefixProvider *dpp, bool verbose = false, ostream *out = nullptr, Formatter *formatter = nullptr, RGWReshard *reshard_log = nullptr); @@ -202,7 +205,7 @@ private: void get_logshard_oid(int shard_num, string *shard); protected: - class ReshardWorker : public Thread { + class ReshardWorker : public Thread, public DoutPrefixProvider { CephContext *cct; RGWReshard *reshard; ceph::mutex lock = ceph::make_mutex("ReshardWorker"); @@ -212,11 +215,14 @@ protected: ReshardWorker(CephContext * const _cct, RGWReshard * const _reshard) : cct(_cct), - reshard(_reshard) { - } + reshard(_reshard) {} void *entry() override; void stop(); + + CephContext *get_cct() const override; + unsigned get_subsys() const; + std::ostream& gen_prefix(std::ostream& out) const; }; ReshardWorker *worker = nullptr; @@ -235,8 +241,8 @@ public: int clear_bucket_resharding(const string& bucket_instance_oid, cls_rgw_reshard_entry& entry); /* reshard thread */ - int process_single_logshard(int logshard_num); - int process_all_logshards(); + int process_single_logshard(int logshard_num, const DoutPrefixProvider *dpp); + int process_all_logshards(const DoutPrefixProvider *dpp); bool going_down(); void start_processor(); void stop_processor(); diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index cd7e730d89554..555e589d25df3 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -281,7 +281,7 @@ static void dump_status(struct req_state *s, int status, try { RESTFUL_IO(s)->send_status(status, status_name); } catch (rgw::io::Exception& e) { - ldout(s->cct, 0) << "ERROR: s->cio->send_status() returned err=" + ldpp_dout(s, 0) << "ERROR: s->cio->send_status() returned err=" << e.what() << dendl; } } @@ -337,7 +337,7 @@ void dump_header(struct req_state* const s, try { RESTFUL_IO(s)->send_header(name, val); } catch (rgw::io::Exception& e) { - ldout(s->cct, 0) << "ERROR: s->cio->send_header() returned err=" + ldpp_dout(s, 0) << "ERROR: s->cio->send_header() returned err=" << e.what() << dendl; } } @@ -376,7 +376,7 @@ void dump_content_length(struct req_state* const s, const uint64_t len) try { RESTFUL_IO(s)->send_content_length(len); } catch (rgw::io::Exception& e) { - ldout(s->cct, 0) << "ERROR: s->cio->send_content_length() returned err=" + ldpp_dout(s, 0) << "ERROR: s->cio->send_content_length() returned err=" << e.what() << dendl; } dump_header(s, "Accept-Ranges", "bytes"); @@ -387,7 +387,7 @@ static void dump_chunked_encoding(struct req_state* const s) try { RESTFUL_IO(s)->send_chunked_transfer_encoding(); } catch (rgw::io::Exception& e) { - ldout(s->cct, 0) << "ERROR: RESTFUL_IO(s)->send_chunked_transfer_encoding()" + ldpp_dout(s, 0) << "ERROR: RESTFUL_IO(s)->send_chunked_transfer_encoding()" << " returned err=" << e.what() << dendl; } } @@ -623,7 +623,7 @@ void end_header(struct req_state* s, RGWOp* op, const char *content_type, try { RESTFUL_IO(s)->complete_header(); } catch (rgw::io::Exception& e) { - ldout(s->cct, 0) << "ERROR: RESTFUL_IO(s)->complete_header() returned err=" + ldpp_dout(s, 0) << "ERROR: RESTFUL_IO(s)->complete_header() returned err=" << e.what() << dendl; } @@ -661,13 +661,13 @@ void abort_early(struct req_state *s, RGWOp* op, int err_no, if (op != NULL) { int new_err_no; new_err_no = op->error_handler(err_no, &error_content, y); - ldout(s->cct, 1) << "op->ERRORHANDLER: err_no=" << err_no + ldpp_dout(s, 1) << "op->ERRORHANDLER: err_no=" << err_no << " new_err_no=" << new_err_no << dendl; err_no = new_err_no; } else if (handler != NULL) { int new_err_no; new_err_no = handler->error_handler(err_no, &error_content, y); - ldout(s->cct, 1) << "handler->ERRORHANDLER: err_no=" << err_no + ldpp_dout(s, 1) << "handler->ERRORHANDLER: err_no=" << err_no << " new_err_no=" << new_err_no << dendl; err_no = new_err_no; } @@ -724,7 +724,7 @@ void dump_continue(struct req_state * const s) try { RESTFUL_IO(s)->send_100_continue(); } catch (rgw::io::Exception& e) { - ldout(s->cct, 0) << "ERROR: RESTFUL_IO(s)->send_100_continue() returned err=" + ldpp_dout(s, 0) << "ERROR: RESTFUL_IO(s)->send_100_continue() returned err=" << e.what() << dendl; } } @@ -1018,7 +1018,7 @@ int RGWPutObj_ObjStore::get_params(optional_yield y) { int ret = 0; ret = torrent.get_params(); - ldout(s->cct, 5) << "NOTICE: open produce torrent file " << dendl; + ldpp_dout(s, 5) << "NOTICE: open produce torrent file " << dendl; if (ret < 0) { return ret; @@ -1410,12 +1410,12 @@ int RGWPostObj_ObjStore::get_params(optional_yield y) } if (s->cct->_conf->subsys.should_gather()) { - ldout(s->cct, 20) << "request content_type_str=" + ldpp_dout(s, 20) << "request content_type_str=" << req_content_type_str << dendl; - ldout(s->cct, 20) << "request content_type params:" << dendl; + ldpp_dout(s, 20) << "request content_type params:" << dendl; for (const auto& pair : params) { - ldout(s->cct, 20) << " " << pair.first << " -> " << pair.second + ldpp_dout(s, 20) << " " << pair.first << " -> " << pair.second << dendl; } } @@ -1438,7 +1438,7 @@ int RGWPutACLs_ObjStore::get_params(optional_yield y) { const auto max_size = s->cct->_conf->rgw_max_put_param_size; std::tie(op_ret, data) = rgw_rest_read_all_input(s, max_size, false); - ldout(s->cct, 0) << "RGWPutACLs_ObjStore::get_params read data is: " << data.c_str() << dendl; + ldpp_dout(s, 0) << "RGWPutACLs_ObjStore::get_params read data is: " << data.c_str() << dendl; return op_ret; } @@ -1574,7 +1574,7 @@ int RGWListMultipart_ObjStore::get_params(optional_yield y) string err; marker = strict_strtol(marker_str.c_str(), 10, &err); if (!err.empty()) { - ldout(s->cct, 20) << "bad marker: " << marker << dendl; + ldpp_dout(s, 20) << "bad marker: " << marker << dendl; op_ret = -EINVAL; return op_ret; } @@ -1850,7 +1850,7 @@ int RGWHandler_REST::init_permissions(RGWOp* op, optional_yield y) if (! s->user->get_id().empty() && s->auth.identity->get_identity_type() != TYPE_ROLE) { try { map uattrs; - if (auto ret = store->ctl()->user->get_attrs_by_uid(s->user->get_id(), &uattrs, y); ! ret) { + if (auto ret = store->ctl()->user->get_attrs_by_uid(s, s->user->get_id(), &uattrs, y); ! ret) { auto user_policies = get_iam_user_policy_from_attr(s->cct, store, uattrs, s->user->get_tenant()); s->iam_user_policies.insert(s->iam_user_policies.end(), std::make_move_iterator(user_policies.begin()), @@ -1865,7 +1865,7 @@ int RGWHandler_REST::init_permissions(RGWOp* op, optional_yield y) return 0; } - return do_init_permissions(y); + return do_init_permissions(op, y); } int RGWHandler_REST::read_permissions(RGWOp* op_obj, optional_yield y) @@ -2037,7 +2037,7 @@ int RGWREST::preprocess(struct req_state *s, rgw::io::BasicClient* cio) if (api_s3website_priority_rawpos != apis.end()) { api_priority_s3website = apis.size() - std::distance(apis.begin(), api_s3website_priority_rawpos); } - ldout(s->cct, 10) << "rgw api priority: s3=" << api_priority_s3 << " s3website=" << api_priority_s3website << dendl; + ldpp_dout(s, 10) << "rgw api priority: s3=" << api_priority_s3 << " s3website=" << api_priority_s3website << dendl; bool s3website_enabled = api_priority_s3website >= 0; if (info.host.size()) { @@ -2053,7 +2053,7 @@ int RGWREST::preprocess(struct req_state *s, rgw::io::BasicClient* cio) info.host = info.host.substr(0, pos); } } - ldout(s->cct, 10) << "host=" << info.host << dendl; + ldpp_dout(s, 10) << "host=" << info.host << dendl; string domain; string subdomain; bool in_hosted_domain_s3website = false; @@ -2071,7 +2071,7 @@ int RGWREST::preprocess(struct req_state *s, rgw::io::BasicClient* cio) } } - ldout(s->cct, 20) + ldpp_dout(s, 20) << "subdomain=" << subdomain << " domain=" << domain << " in_hosted_domain=" << in_hosted_domain @@ -2085,13 +2085,13 @@ int RGWREST::preprocess(struct req_state *s, rgw::io::BasicClient* cio) bool found; int r = rgw_resolver->resolve_cname(info.host, cname, &found); if (r < 0) { - ldout(s->cct, 0) + ldpp_dout(s, 0) << "WARNING: rgw_resolver->resolve_cname() returned r=" << r << dendl; } if (found) { - ldout(s->cct, 5) << "resolved host cname " << info.host << " -> " + ldpp_dout(s, 5) << "resolved host cname " << info.host << " -> " << cname << dendl; in_hosted_domain = rgw_find_host_in_domains(cname, &domain, &subdomain, hostnames_set); @@ -2110,7 +2110,7 @@ int RGWREST::preprocess(struct req_state *s, rgw::io::BasicClient* cio) } } - ldout(s->cct, 20) + ldpp_dout(s, 20) << "subdomain=" << subdomain << " domain=" << domain << " in_hosted_domain=" << in_hosted_domain @@ -2159,7 +2159,7 @@ int RGWREST::preprocess(struct req_state *s, rgw::io::BasicClient* cio) s->info.domain = domain; } - ldout(s->cct, 20) + ldpp_dout(s, 20) << "final domain/bucket" << " subdomain=" << subdomain << " domain=" << domain @@ -2239,14 +2239,14 @@ int RGWREST::preprocess(struct req_state *s, rgw::io::BasicClient* cio) string err; s->content_length = strict_strtoll(s->length, 10, &err); if (!err.empty()) { - ldout(s->cct, 10) << "bad content length, aborting" << dendl; + ldpp_dout(s, 10) << "bad content length, aborting" << dendl; return -EINVAL; } } } if (s->content_length < 0) { - ldout(s->cct, 10) << "negative content length, aborting" << dendl; + ldpp_dout(s, 10) << "negative content length, aborting" << dendl; return -EINVAL; } @@ -2265,7 +2265,7 @@ int RGWREST::preprocess(struct req_state *s, rgw::io::BasicClient* cio) } s->op = op_from_method(info.method); - info.init_meta_info(&s->has_bad_meta); + info.init_meta_info(s, &s->has_bad_meta); return 0; } diff --git a/src/rgw/rgw_rest_bucket.cc b/src/rgw/rgw_rest_bucket.cc index 3a07cebf0a68f..cae41d31e0e0f 100644 --- a/src/rgw/rgw_rest_bucket.cc +++ b/src/rgw/rgw_rest_bucket.cc @@ -48,7 +48,7 @@ void RGWOp_Bucket_Info::execute(optional_yield y) op_state.set_bucket_name(bucket); op_state.set_fetch_stats(fetch_stats); - op_ret = RGWBucketAdminOp::info(store, op_state, flusher, y); + op_ret = RGWBucketAdminOp::info(store, op_state, flusher, y, this); } class RGWOp_Get_Policy : public RGWRESTOp { @@ -78,7 +78,7 @@ void RGWOp_Get_Policy::execute(optional_yield y) op_state.set_bucket_name(bucket); op_state.set_object(object); - op_ret = RGWBucketAdminOp::get_policy(store, op_state, flusher); + op_ret = RGWBucketAdminOp::get_policy(store, op_state, flusher, this); } class RGWOp_Check_Bucket_Index : public RGWRESTOp { @@ -112,7 +112,7 @@ void RGWOp_Check_Bucket_Index::execute(optional_yield y) op_state.set_fix_index(fix_index); op_state.set_check_objects(check_objects); - op_ret = RGWBucketAdminOp::check_index(store, op_state, flusher, s->yield); + op_ret = RGWBucketAdminOp::check_index(store, op_state, flusher, s->yield, s); } class RGWOp_Bucket_Link : public RGWRESTOp { @@ -155,7 +155,7 @@ void RGWOp_Bucket_Link::execute(optional_yield y) ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - op_ret = RGWBucketAdminOp::link(store, op_state); + op_ret = RGWBucketAdminOp::link(store, op_state, s); } class RGWOp_Bucket_Unlink : public RGWRESTOp { @@ -193,7 +193,7 @@ void RGWOp_Bucket_Unlink::execute(optional_yield y) ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - op_ret = RGWBucketAdminOp::unlink(store, op_state); + op_ret = RGWBucketAdminOp::unlink(store, op_state, s); } class RGWOp_Bucket_Remove : public RGWRESTOp { @@ -219,13 +219,13 @@ void RGWOp_Bucket_Remove::execute(optional_yield y) RESTArgs::get_string(s, "bucket", bucket_name, &bucket_name); RESTArgs::get_bool(s, "purge-objects", false, &delete_children); - op_ret = store->get_bucket(nullptr, string(), bucket_name, &bucket, y); + op_ret = store->get_bucket(s, nullptr, string(), bucket_name, &bucket, y); if (op_ret < 0) { ldpp_dout(this, 0) << "get_bucket returned ret=" << op_ret << dendl; return; } - op_ret = bucket->remove_bucket(delete_children, string(), string(), true, &s->info, s->yield); + op_ret = bucket->remove_bucket(s, delete_children, string(), string(), true, &s->info, s->yield); } class RGWOp_Set_Bucket_Quota : public RGWRESTOp { @@ -284,7 +284,7 @@ void RGWOp_Set_Bucket_Quota::execute(optional_yield y) if (use_http_params) { RGWBucketInfo bucket_info; map attrs; - op_ret = store->getRados()->get_bucket_info(store->svc(), uid.tenant, bucket, bucket_info, NULL, s->yield, &attrs); + op_ret = store->getRados()->get_bucket_info(store->svc(), uid.tenant, bucket, bucket_info, NULL, s->yield, s, &attrs); if (op_ret < 0) { return; } @@ -302,7 +302,7 @@ void RGWOp_Set_Bucket_Quota::execute(optional_yield y) op_state.set_bucket_name(bucket); op_state.set_quota(quota); - op_ret = RGWBucketAdminOp::set_quota(store, op_state); + op_ret = RGWBucketAdminOp::set_quota(store, op_state, s); } class RGWOp_Sync_Bucket : public RGWRESTOp { @@ -334,7 +334,7 @@ void RGWOp_Sync_Bucket::execute(optional_yield y) op_state.set_tenant(tenant); op_state.set_sync_bucket(sync_bucket); - op_ret = RGWBucketAdminOp::sync_bucket(store, op_state); + op_ret = RGWBucketAdminOp::sync_bucket(store, op_state, s); } class RGWOp_Object_Remove: public RGWRESTOp { @@ -364,7 +364,7 @@ void RGWOp_Object_Remove::execute(optional_yield y) op_state.set_bucket_name(bucket); op_state.set_object(object); - op_ret = RGWBucketAdminOp::remove_object(store, op_state); + op_ret = RGWBucketAdminOp::remove_object(store, op_state, s); } diff --git a/src/rgw/rgw_rest_iam.cc b/src/rgw/rgw_rest_iam.cc index c7250129b84b2..4624cff90fe2f 100644 --- a/src/rgw/rgw_rest_iam.cc +++ b/src/rgw/rgw_rest_iam.cc @@ -118,7 +118,7 @@ int RGWHandler_REST_IAM::init_from_header(struct req_state* s, } s->info.args.set(p); - s->info.args.parse(); + s->info.args.parse(s); /* must be called after the args parsing */ if (int ret = allocate_formatter(s, default_formatter, configurable_format); ret < 0) diff --git a/src/rgw/rgw_rest_log.cc b/src/rgw/rgw_rest_log.cc index 4003e157164f5..7c3540ce64cc4 100644 --- a/src/rgw/rgw_rest_log.cc +++ b/src/rgw/rgw_rest_log.cc @@ -119,7 +119,7 @@ void RGWOp_MDLog_List::send_response() { void RGWOp_MDLog_Info::execute(optional_yield y) { num_objects = s->cct->_conf->rgw_md_log_max_shards; - period = store->svc()->mdlog->read_oldest_log_period(y); + period = store->svc()->mdlog->read_oldest_log_period(y, s); op_ret = period.get_error(); } @@ -383,7 +383,7 @@ void RGWOp_BILog_List::execute(optional_yield y) { if (!bucket_instance.empty()) { rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance)); - op_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield); + op_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield, s); if (op_ret < 0) { ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl; return; @@ -476,7 +476,7 @@ void RGWOp_BILog_Info::execute(optional_yield y) { if (!bucket_instance.empty()) { rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance)); - op_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield); + op_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield, s); if (op_ret < 0) { ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl; return; @@ -540,7 +540,7 @@ void RGWOp_BILog_Delete::execute(optional_yield y) { if (!bucket_instance.empty()) { rgw_bucket b(rgw_bucket_key(tenant_name, bn, bucket_instance)); - op_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield); + op_ret = store->getRados()->get_bucket_instance_info(*s->sysobj_ctx, b, bucket_info, NULL, NULL, s->yield, s); if (op_ret < 0) { ldpp_dout(s, 5) << "could not get bucket instance info for bucket instance id=" << bucket_instance << dendl; return; @@ -839,7 +839,7 @@ void RGWOp_BILog_Status::execute(optional_yield y) // read the bucket instance info for num_shards auto ctx = store->svc()->sysobj->init_obj_ctx(); RGWBucketInfo info; - op_ret = store->getRados()->get_bucket_instance_info(ctx, bucket, info, nullptr, nullptr, s->yield); + op_ret = store->getRados()->get_bucket_instance_info(ctx, bucket, info, nullptr, nullptr, s->yield, s); if (op_ret < 0) { ldpp_dout(s, 4) << "failed to read bucket info: " << cpp_strerror(op_ret) << dendl; return; @@ -880,7 +880,7 @@ void RGWOp_BILog_Status::execute(optional_yield y) rgw_zone_id source_zone_id(source_zone); RGWBucketSyncPolicyHandlerRef source_handler; - op_ret = store->ctl()->bucket->get_sync_policy_handler(source_zone_id, source_bucket, &source_handler, y); + op_ret = store->ctl()->bucket->get_sync_policy_handler(source_zone_id, source_bucket, &source_handler, y, s); if (op_ret < 0) { lderr(s->cct) << "could not get bucket sync policy handler (r=" << op_ret << ")" << dendl; return; @@ -912,6 +912,7 @@ void RGWOp_BILog_Status::execute(optional_yield y) op_ret = store->ctl()->bucket->read_bucket_info(*pipe.dest.bucket, pinfo, s->yield, + s, RGWBucketCtl::BucketInstance::GetParams(), nullptr); if (op_ret < 0) { diff --git a/src/rgw/rgw_rest_metadata.cc b/src/rgw/rgw_rest_metadata.cc index 795382dbc91d8..ae0ce55530634 100644 --- a/src/rgw/rgw_rest_metadata.cc +++ b/src/rgw/rgw_rest_metadata.cc @@ -57,7 +57,7 @@ void RGWOp_Metadata_Get::execute(optional_yield y) { auto meta_mgr = store->ctl()->meta.mgr; /* Get keys */ - op_ret = meta_mgr->get(metadata_key, s->formatter, s->yield); + op_ret = meta_mgr->get(metadata_key, s->formatter, s->yield, s); if (op_ret < 0) { dout(5) << "ERROR: can't get key: " << cpp_strerror(op_ret) << dendl; return; @@ -263,7 +263,7 @@ void RGWOp_Metadata_Put::execute(optional_yield y) { } } - op_ret = store->ctl()->meta.mgr->put(metadata_key, bl, s->yield, sync_type, + op_ret = store->ctl()->meta.mgr->put(metadata_key, bl, s->yield, s, sync_type, false, &ondisk_version); if (op_ret < 0) { dout(5) << "ERROR: can't put key: " << cpp_strerror(op_ret) << dendl; @@ -294,7 +294,7 @@ void RGWOp_Metadata_Delete::execute(optional_yield y) { string metadata_key; frame_metadata_key(s, metadata_key); - op_ret = store->ctl()->meta.mgr->remove(metadata_key, s->yield); + op_ret = store->ctl()->meta.mgr->remove(metadata_key, s->yield, s); if (op_ret < 0) { dout(5) << "ERROR: can't remove key: " << cpp_strerror(op_ret) << dendl; return; diff --git a/src/rgw/rgw_rest_oidc_provider.cc b/src/rgw/rgw_rest_oidc_provider.cc index 6e619033f7607..1dae2a933d055 100644 --- a/src/rgw/rgw_rest_oidc_provider.cc +++ b/src/rgw/rgw_rest_oidc_provider.cc @@ -123,7 +123,7 @@ void RGWCreateOIDCProvider::execute(optional_yield y) RGWOIDCProvider provider(s->cct, store->getRados()->pctl, provider_url, s->user->get_tenant(), client_ids, thumbprints); - op_ret = provider.create(true, y); + op_ret = provider.create(s, true, y); if (op_ret == 0) { s->formatter->open_object_section("CreateOpenIDConnectProviderResponse"); @@ -159,7 +159,7 @@ void RGWDeleteOIDCProvider::execute(optional_yield y) void RGWGetOIDCProvider::execute(optional_yield y) { RGWOIDCProvider provider(s->cct, store->getRados()->pctl, provider_arn, s->user->get_tenant()); - op_ret = provider.get(); + op_ret = provider.get(s); if (op_ret < 0 && op_ret != -ENOENT && op_ret != -EINVAL) { op_ret = ERR_INTERNAL_ERROR; @@ -200,7 +200,7 @@ int RGWListOIDCProviders::verify_permission(optional_yield y) void RGWListOIDCProviders::execute(optional_yield y) { vector result; - op_ret = RGWOIDCProvider::get_providers(store->getRados(), s->user->get_tenant(), result); + op_ret = RGWOIDCProvider::get_providers(s, store->getRados(), s->user->get_tenant(), result); if (op_ret == 0) { s->formatter->open_array_section("ListOpenIDConnectProvidersResponse"); diff --git a/src/rgw/rgw_rest_pubsub_common.cc b/src/rgw/rgw_rest_pubsub_common.cc index 1d1311d2b9292..a0d405da10c04 100644 --- a/src/rgw/rgw_rest_pubsub_common.cc +++ b/src/rgw/rgw_rest_pubsub_common.cc @@ -169,7 +169,7 @@ void RGWPSAckSubEventOp::execute(optional_yield y) { } ps.emplace(store, s->owner.get_id().tenant); auto sub = ps->get_sub_with_events(sub_name); - op_ret = sub->remove_event(event_id); + op_ret = sub->remove_event(s, event_id); if (op_ret < 0) { ldout(s->cct, 1) << "failed to ack event on subscription '" << sub_name << "', ret=" << op_ret << dendl; return; @@ -189,7 +189,7 @@ void RGWPSPullSubEventsOp::execute(optional_yield y) { ldout(s->cct, 1) << "failed to get subscription '" << sub_name << "' for events, ret=" << op_ret << dendl; return; } - op_ret = sub->list_events(marker, max_entries); + op_ret = sub->list_events(s, marker, max_entries); if (op_ret < 0) { ldout(s->cct, 1) << "failed to get events from subscription '" << sub_name << "', ret=" << op_ret << dendl; return; diff --git a/src/rgw/rgw_rest_realm.cc b/src/rgw/rgw_rest_realm.cc index 12aee6dcc7f82..773fd5f590c54 100644 --- a/src/rgw/rgw_rest_realm.cc +++ b/src/rgw/rgw_rest_realm.cc @@ -136,7 +136,7 @@ void RGWOp_Period_Post::execute(optional_yield y) // if period id is empty, handle as 'period commit' if (period.get_id().empty()) { - op_ret = period.commit(store, realm, current_period, error_stream, y); + op_ret = period.commit(this, store, realm, current_period, error_stream, y); if (op_ret < 0) { lderr(cct) << "master zone failed to commit period" << dendl; } diff --git a/src/rgw/rgw_rest_role.cc b/src/rgw/rgw_rest_role.cc index 13e1c37e413bc..0f66d54b83511 100644 --- a/src/rgw/rgw_rest_role.cc +++ b/src/rgw/rgw_rest_role.cc @@ -27,7 +27,7 @@ int RGWRestRole::verify_permission(optional_yield y) string role_name = s->info.args.get("RoleName"); RGWRole role(s->cct, store->getRados()->pctl, role_name, s->user->get_tenant()); - if (op_ret = role.get(y); op_ret < 0) { + if (op_ret = role.get(s, y); op_ret < 0) { if (op_ret == -ENOENT) { op_ret = -ERR_NO_ROLE_FOUND; } @@ -132,7 +132,7 @@ void RGWCreateRole::execute(optional_yield y) } RGWRole role(s->cct, store->getRados()->pctl, role_name, role_path, trust_policy, s->user->get_tenant(), max_session_duration); - op_ret = role.create(true, y); + op_ret = role.create(s, true, y); if (op_ret == -EEXIST) { op_ret = -ERR_ROLE_EXISTS; @@ -171,7 +171,7 @@ void RGWDeleteRole::execute(optional_yield y) return; } - op_ret = _role.delete_obj(y); + op_ret = _role.delete_obj(s, y); if (op_ret == -ENOENT) { op_ret = -ERR_NO_ROLE_FOUND; @@ -230,7 +230,7 @@ void RGWGetRole::execute(optional_yield y) return; } RGWRole role(s->cct, store->getRados()->pctl, role_name, s->user->get_tenant()); - op_ret = role.get(y); + op_ret = role.get(s, y); if (op_ret == -ENOENT) { op_ret = -ERR_NO_ROLE_FOUND; @@ -322,7 +322,7 @@ void RGWListRoles::execute(optional_yield y) return; } vector result; - op_ret = RGWRole::get_roles_by_path_prefix(store->getRados(), s->cct, path_prefix, s->user->get_tenant(), result, y); + op_ret = RGWRole::get_roles_by_path_prefix(s, store->getRados(), s->cct, path_prefix, s->user->get_tenant(), result, y); if (op_ret == 0) { s->formatter->open_array_section("ListRolesResponse"); diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 5c1a2d9412140..468a1078f7399 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -2181,7 +2181,7 @@ static int create_s3_policy(struct req_state *s, rgw::sal::RGWRadosStore *store, if (!s->canned_acl.empty()) return -ERR_INVALID_REQUEST; - return s3policy.create_from_headers(store->ctl()->user, s->info.env, owner); + return s3policy.create_from_headers(s, store->ctl()->user, s->info.env, owner); } return s3policy.create_canned(owner, s->bucket_owner, s->canned_acl); @@ -2545,7 +2545,7 @@ static inline int get_obj_attrs(rgw::sal::RGWRadosStore *store, struct req_state read_op.params.attrs = &attrs; - return read_op.prepare(s->yield); + return read_op.prepare(s->yield, s); } static inline void set_attr(map& attrs, const char* key, const std::string& value) @@ -4582,7 +4582,7 @@ int RGWHandler_REST_S3::init_from_header(rgw::sal::RGWRadosStore *store, } s->info.args.set(p); - s->info.args.parse(); + s->info.args.parse(s); /* must be called after the args parsing */ int ret = allocate_formatter(s, default_formatter, configurable_format); @@ -4682,7 +4682,7 @@ int RGWHandler_REST_S3::postauth_init(optional_yield y) s->bucket_tenant = s->auth.identity->get_role_tenant(); } - dout(10) << "s->object=" << s->object + ldpp_dout(s, 10) << "s->object=" << s->object << " s->bucket=" << rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name) << dendl; int ret; @@ -4741,7 +4741,8 @@ int RGWHandler_REST_S3::init(rgw::sal::RGWRadosStore *store, struct req_state *s ret = RGWCopyObj::parse_copy_location(copy_source, s->init_state.src_bucket, - key); + key, + s); if (!ret) { ldpp_dout(s, 0) << "failed to parse copy location" << dendl; return -EINVAL; // XXX why not -ERR_INVALID_BUCKET_NAME or -ERR_BAD_URL? @@ -4909,7 +4910,7 @@ bool RGWHandler_REST_S3Website::web_dir() const { obj_ctx.set_prefetch_data(obj); RGWObjState* state = nullptr; - if (store->getRados()->get_obj_state(&obj_ctx, s->bucket->get_info(), obj, &state, false, s->yield) < 0) { + if (store->getRados()->get_obj_state(s, &obj_ctx, s->bucket->get_info(), obj, &state, false, s->yield) < 0) { return false; } if (! state->exists) { @@ -4940,7 +4941,7 @@ int RGWHandler_REST_S3Website::retarget(RGWOp* op, RGWOp** new_op, optional_yiel if (!(s->prot_flags & RGW_REST_WEBSITE)) return 0; - int ret = store->get_bucket(nullptr, s->bucket_tenant, s->bucket_name, &s->bucket, y); + int ret = store->get_bucket(s, nullptr, s->bucket_tenant, s->bucket_name, &s->bucket, y); if (ret < 0) { // TODO-FUTURE: if the bucket does not exist, maybe expose it here? return -ERR_NO_SUCH_BUCKET; @@ -5222,7 +5223,8 @@ AWSGeneralAbstractor::get_auth_data_v4(const req_state* const s, client_signature, date, session_token, - using_qs); + using_qs, + s); if (ret < 0) { throw ret; } @@ -5287,20 +5289,23 @@ AWSGeneralAbstractor::get_auth_data_v4(const req_state* const s, std::move(canonical_qs), std::move(*canonical_headers), signed_hdrs, - exp_payload_hash); + exp_payload_hash, + s); auto string_to_sign = \ rgw::auth::s3::get_v4_string_to_sign(s->cct, AWS4_HMAC_SHA256_STR, date, credential_scope, - std::move(canonical_req_hash)); + std::move(canonical_req_hash), + s); const auto sig_factory = std::bind(rgw::auth::s3::get_v4_signature, credential_scope, std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3); + std::placeholders::_3, + s); /* Requests authenticated with the Query Parameters are treated as unsigned. * From "Authenticating Requests: Using Query Parameters (AWS Signature @@ -5541,17 +5546,18 @@ AWSBrowserUploadAbstractor::get_auth_data_v4(const req_state* const s) const /* grab access key id */ const size_t pos = credential.find("/"); const std::string_view access_key_id = credential.substr(0, pos); - dout(10) << "access key id = " << access_key_id << dendl; + ldpp_dout(s, 10) << "access key id = " << access_key_id << dendl; /* grab credential scope */ const std::string_view credential_scope = credential.substr(pos + 1); - dout(10) << "credential scope = " << credential_scope << dendl; + ldpp_dout(s, 10) << "credential scope = " << credential_scope << dendl; const auto sig_factory = std::bind(rgw::auth::s3::get_v4_signature, credential_scope, std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3); + std::placeholders::_3, + s); return { access_key_id, @@ -5726,7 +5732,7 @@ rgw::auth::s3::LocalEngine::authenticate( RGWUserInfo user_info; /* TODO(rzarzynski): we need to have string-view taking variant. */ const std::string access_key_id(_access_key_id); - if (rgw_get_user_info_by_access_key(ctl->user, access_key_id, user_info, y) < 0) { + if (rgw_get_user_info_by_access_key(dpp, ctl->user, access_key_id, user_info, y) < 0) { ldpp_dout(dpp, 5) << "error reading user info, uid=" << access_key_id << " can't authenticate" << dendl; return result_t::deny(-ERR_INVALID_ACCESS_KEY); @@ -5900,7 +5906,7 @@ rgw::auth::s3::STSEngine::authenticate( rgw::auth::RoleApplier::Role r; if (! token.roleId.empty()) { RGWRole role(s->cct, ctl, token.roleId); - if (role.get_by_id(y) < 0) { + if (role.get_by_id(dpp, y) < 0) { return result_t::deny(-EPERM); } r.id = token.roleId; @@ -5920,7 +5926,7 @@ rgw::auth::s3::STSEngine::authenticate( if (! token.user.empty() && token.acct_type != TYPE_ROLE) { // get user info - int ret = rgw_get_user_info_by_uid(ctl->user, token.user, user_info, y, NULL); + int ret = rgw_get_user_info_by_uid(dpp, ctl->user, token.user, user_info, y, NULL); if (ret < 0) { ldpp_dout(dpp, 5) << "ERROR: failed reading user info: uid=" << token.user << dendl; return result_t::reject(-EPERM); diff --git a/src/rgw/rgw_rest_sts.cc b/src/rgw/rgw_rest_sts.cc index edc3459055a56..e642dc6bc20db 100644 --- a/src/rgw/rgw_rest_sts.cc +++ b/src/rgw/rgw_rest_sts.cc @@ -61,7 +61,7 @@ WebTokenEngine::get_role_tenant(const string& role_arn) const } boost::optional -WebTokenEngine::get_provider(const string& role_arn, const string& iss) const +WebTokenEngine::get_provider(const DoutPrefixProvider *dpp, const string& role_arn, const string& iss) const { string tenant = get_role_tenant(role_arn); @@ -83,7 +83,7 @@ WebTokenEngine::get_provider(const string& role_arn, const string& iss) const auto provider_arn = rgw::ARN(idp_url, "oidc-provider", tenant); string p_arn = provider_arn.to_string(); RGWOIDCProvider provider(cct, ctl, p_arn, tenant); - auto ret = provider.get(); + auto ret = provider.get(dpp); if (ret < 0) { return boost::none; } @@ -158,7 +158,7 @@ WebTokenEngine::get_from_jwt(const DoutPrefixProvider* dpp, const std::string& t t.client_id = decoded.get_payload_claim("clientId").as_string(); } string role_arn = s->info.args.get("RoleArn"); - auto provider = get_provider(role_arn, t.iss); + auto provider = get_provider(dpp, role_arn, t.iss); if (! provider) { ldpp_dout(dpp, 0) << "Couldn't get oidc provider info using input iss" << t.iss << dendl; throw -EACCES; @@ -363,7 +363,7 @@ int RGWREST_STS::verify_permission(optional_yield y) sts = std::move(_sts); string rArn = s->info.args.get("RoleArn"); - const auto& [ret, role] = sts.getRoleInfo(rArn, y); + const auto& [ret, role] = sts.getRoleInfo(s, rArn, y); if (ret < 0) { ldout(s->cct, 0) << "failed to get role info using role arn: " << rArn << dendl; return ret; @@ -562,7 +562,7 @@ void RGWSTSAssumeRole::execute(optional_yield y) STS::AssumeRoleRequest req(s->cct, duration, externalId, policy, roleArn, roleSessionName, serialNumber, tokenCode); - STS::AssumeRoleResponse response = sts.assumeRole(req, y); + STS::AssumeRoleResponse response = sts.assumeRole(s, req, y); op_ret = std::move(response.retCode); //Dump the output if (op_ret == 0) { @@ -666,7 +666,7 @@ int RGWHandler_REST_STS::init_from_header(struct req_state* s, } s->info.args.set(p); - s->info.args.parse(); + s->info.args.parse(s); /* must be called after the args parsing */ if (int ret = allocate_formatter(s, default_formatter, configurable_format); ret < 0) diff --git a/src/rgw/rgw_rest_sts.h b/src/rgw/rgw_rest_sts.h index 5ef1fa82adc08..810ff242d734f 100644 --- a/src/rgw/rgw_rest_sts.h +++ b/src/rgw/rgw_rest_sts.h @@ -29,7 +29,7 @@ class WebTokenEngine : public rgw::auth::Engine { bool is_cert_valid(const vector& thumbprints, const string& cert) const; - boost::optional get_provider(const string& role_arn, const string& iss) const; + boost::optional get_provider(const DoutPrefixProvider *dpp, const string& role_arn, const string& iss) const; std::string get_role_tenant(const string& role_arn) const; diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc index 0a8d6cdf99325..b3d221cbd7f99 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -545,7 +545,7 @@ static void dump_container_metadata(struct req_state *s, void RGWStatAccount_ObjStore_SWIFT::execute(optional_yield y) { RGWStatAccount_ObjStore::execute(y); - op_ret = store->ctl()->user->get_attrs_by_uid(s->user->get_id(), &attrs, s->yield); + op_ret = store->ctl()->user->get_attrs_by_uid(s, s->user->get_id(), &attrs, s->yield); } void RGWStatAccount_ObjStore_SWIFT::send_response() @@ -598,7 +598,7 @@ static int get_swift_container_settings(req_state * const s, if (read_list || write_list) { RGWAccessControlPolicy_SWIFT swift_policy(s->cct); - const auto r = swift_policy.create(store->ctl()->user, + const auto r = swift_policy.create(s, store->ctl()->user, s->user->get_id(), s->user->get_display_name(), read_list, @@ -851,7 +851,7 @@ int RGWPutObj_ObjStore_SWIFT::update_slo_segment_size(rgw_slo_entry& entry) { map bucket_attrs; r = store->getRados()->get_bucket_info(store->svc(), s->user->get_id().tenant, bucket_name, bucket_info, nullptr, - s->yield, &bucket_attrs); + s->yield, s, &bucket_attrs); if (r < 0) { ldpp_dout(this, 0) << "could not get bucket info for bucket=" << bucket_name << dendl; @@ -881,7 +881,7 @@ int RGWPutObj_ObjStore_SWIFT::update_slo_segment_size(rgw_slo_entry& entry) { read_op.params.attrs = &attrs; read_op.params.obj_size = &size_bytes; - r = read_op.prepare(s->yield); + r = read_op.prepare(s->yield, s); if (r < 0) { return r; } @@ -1060,7 +1060,7 @@ static int get_swift_account_settings(req_state * const s, const char * const acl_attr = s->info.env->get("HTTP_X_ACCOUNT_ACCESS_CONTROL"); if (acl_attr) { RGWAccessControlPolicy_SWIFTAcct swift_acct_policy(s->cct); - const bool r = swift_acct_policy.create(store->ctl()->user, + const bool r = swift_acct_policy.create(s, store->ctl()->user, s->user->get_id(), s->user->get_display_name(), string(acl_attr)); @@ -2093,14 +2093,14 @@ void RGWFormPost::get_owner_info(const req_state* const s, if (uid.tenant.empty()) { const rgw_user tenanted_uid(uid.id, uid.id); - if (user_ctl->get_info_by_uid(tenanted_uid, &uinfo, s->yield) >= 0) { + if (user_ctl->get_info_by_uid(s, tenanted_uid, &uinfo, s->yield) >= 0) { /* Succeeded. */ bucket_tenant = uinfo.user_id.tenant; found = true; } } - if (!found && user_ctl->get_info_by_uid(uid, &uinfo, s->yield) < 0) { + if (!found && user_ctl->get_info_by_uid(s, uid, &uinfo, s->yield) < 0) { throw -EPERM; } else { bucket_tenant = uinfo.user_id.tenant; @@ -2111,7 +2111,7 @@ void RGWFormPost::get_owner_info(const req_state* const s, RGWBucketInfo bucket_info; int ret = store->getRados()->get_bucket_info(store->svc(), bucket_tenant, bucket_name, - bucket_info, nullptr, s->yield); + bucket_info, nullptr, s->yield, s); if (ret < 0) { throw ret; } @@ -2119,7 +2119,7 @@ void RGWFormPost::get_owner_info(const req_state* const s, ldpp_dout(this, 20) << "temp url user (bucket owner): " << bucket_info.owner << dendl; - if (user_ctl->get_info_by_uid(bucket_info.owner, &owner_info, s->yield) < 0) { + if (user_ctl->get_info_by_uid(s, bucket_info.owner, &owner_info, s->yield) < 0) { throw -EPERM; } } @@ -2570,7 +2570,7 @@ bool RGWSwiftWebsiteHandler::is_web_dir() const obj.set_prefetch_data(&obj_ctx); RGWObjState* state = nullptr; - if (obj.get_obj_state(&obj_ctx, *s->bucket, &state, s->yield, false)) { + if (obj.get_obj_state(s, &obj_ctx, *s->bucket, &state, s->yield, false)) { return false; } @@ -2600,7 +2600,7 @@ bool RGWSwiftWebsiteHandler::is_index_present(const std::string& index) const obj.set_prefetch_data(&obj_ctx); RGWObjState* state = nullptr; - if (obj.get_obj_state(&obj_ctx, *s->bucket, &state, s->yield, false)) { + if (obj.get_obj_state(s, &obj_ctx, *s->bucket, &state, s->yield, false)) { return false; } @@ -2813,7 +2813,7 @@ int RGWHandler_REST_SWIFT::postauth_init(optional_yield y) s->object = store->get_object(rgw_obj_key()); } - dout(10) << "s->object=" << + ldpp_dout(s, 10) << "s->object=" << (!s->object->empty() ? s->object->get_key() : rgw_obj_key("")) << " s->bucket=" << rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name) @@ -2929,7 +2929,7 @@ int RGWHandler_REST_SWIFT::init_from_header(rgw::sal::RGWRadosStore* store, } s->info.args.set(p); - s->info.args.parse(); + s->info.args.parse(s); /* Skip the leading slash of URL hierarchy. */ if (req_name[0] != '/') { @@ -3043,7 +3043,7 @@ int RGWHandler_REST_SWIFT::init(rgw::sal::RGWRadosStore* store, struct req_state std::string copy_source = s->info.env->get("HTTP_X_COPY_FROM", ""); if (! copy_source.empty()) { rgw_obj_key key; - bool result = RGWCopyObj::parse_copy_location(copy_source, t->src_bucket, key); + bool result = RGWCopyObj::parse_copy_location(copy_source, t->src_bucket, key, s); if (!result) return -ERR_BAD_URL; s->src_object = store->get_object(key); @@ -3060,7 +3060,7 @@ int RGWHandler_REST_SWIFT::init(rgw::sal::RGWRadosStore* store, struct req_state rgw_obj_key dest_obj_key; bool result = RGWCopyObj::parse_copy_location(req_dest, dest_bucket_name, - dest_obj_key); + dest_obj_key, s); if (!result) return -ERR_BAD_URL; diff --git a/src/rgw/rgw_rest_user.cc b/src/rgw/rgw_rest_user.cc index 06fd022f11599..6cc3b60c83e44 100644 --- a/src/rgw/rgw_rest_user.cc +++ b/src/rgw/rgw_rest_user.cc @@ -89,7 +89,7 @@ void RGWOp_User_Info::execute(optional_yield y) op_state.set_fetch_stats(fetch_stats); op_state.set_sync_stats(sync_stats); - op_ret = RGWUserAdminOp_User::info(store, op_state, flusher, y); + op_ret = RGWUserAdminOp_User::info(s, store, op_state, flusher, y); } class RGWOp_User_Create : public RGWRESTOp { @@ -230,7 +230,7 @@ void RGWOp_User_Create::execute(optional_yield y) ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - op_ret = RGWUserAdminOp_User::create(store, op_state, flusher, y); + op_ret = RGWUserAdminOp_User::create(s, store, op_state, flusher, y); } class RGWOp_User_Modify : public RGWRESTOp { @@ -372,7 +372,7 @@ void RGWOp_User_Modify::execute(optional_yield y) ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - op_ret = RGWUserAdminOp_User::modify(store, op_state, flusher, y); + op_ret = RGWUserAdminOp_User::modify(s, store, op_state, flusher, y); } class RGWOp_User_Remove : public RGWRESTOp { @@ -413,7 +413,7 @@ void RGWOp_User_Remove::execute(optional_yield y) ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - op_ret = RGWUserAdminOp_User::remove(store, op_state, flusher, s->yield); + op_ret = RGWUserAdminOp_User::remove(s, store, op_state, flusher, s->yield); } class RGWOp_Subuser_Create : public RGWRESTOp { @@ -489,7 +489,7 @@ void RGWOp_Subuser_Create::execute(optional_yield y) ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - op_ret = RGWUserAdminOp_Subuser::create(store, op_state, flusher, y); + op_ret = RGWUserAdminOp_Subuser::create(s, store, op_state, flusher, y); } class RGWOp_Subuser_Modify : public RGWRESTOp { @@ -556,7 +556,7 @@ void RGWOp_Subuser_Modify::execute(optional_yield y) ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - op_ret = RGWUserAdminOp_Subuser::modify(store, op_state, flusher, y); + op_ret = RGWUserAdminOp_Subuser::modify(s, store, op_state, flusher, y); } class RGWOp_Subuser_Remove : public RGWRESTOp { @@ -599,7 +599,7 @@ void RGWOp_Subuser_Remove::execute(optional_yield y) ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - op_ret = RGWUserAdminOp_Subuser::remove(store, op_state, flusher, y); + op_ret = RGWUserAdminOp_Subuser::remove(s, store, op_state, flusher, y); } class RGWOp_Key_Create : public RGWRESTOp { @@ -655,7 +655,7 @@ void RGWOp_Key_Create::execute(optional_yield y) op_state.set_key_type(key_type); } - op_ret = RGWUserAdminOp_Key::create(store, op_state, flusher, y); + op_ret = RGWUserAdminOp_Key::create(s, store, op_state, flusher, y); } class RGWOp_Key_Remove : public RGWRESTOp { @@ -702,7 +702,7 @@ void RGWOp_Key_Remove::execute(optional_yield y) op_state.set_key_type(key_type); } - op_ret = RGWUserAdminOp_Key::remove(store, op_state, flusher, y); + op_ret = RGWUserAdminOp_Key::remove(s, store, op_state, flusher, y); } class RGWOp_Caps_Add : public RGWRESTOp { @@ -740,7 +740,7 @@ void RGWOp_Caps_Add::execute(optional_yield y) ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - op_ret = RGWUserAdminOp_Caps::add(store, op_state, flusher, y); + op_ret = RGWUserAdminOp_Caps::add(s, store, op_state, flusher, y); } class RGWOp_Caps_Remove : public RGWRESTOp { @@ -778,7 +778,7 @@ void RGWOp_Caps_Remove::execute(optional_yield y) ldpp_dout(this, 0) << "forward_request_to_master returned ret=" << op_ret << dendl; return; } - op_ret = RGWUserAdminOp_Caps::remove(store, op_state, flusher, y); + op_ret = RGWUserAdminOp_Caps::remove(s, store, op_state, flusher, y); } struct UserQuotas { @@ -844,7 +844,7 @@ void RGWOp_Quota_Info::execute(optional_yield y) op_state.set_user_id(uid); RGWUser user; - op_ret = user.init(store, op_state, y); + op_ret = user.init(s, store, op_state, y); if (op_ret < 0) return; @@ -979,7 +979,7 @@ void RGWOp_Quota_Set::execute(optional_yield y) op_state.set_user_id(uid); RGWUser user; - op_ret = user.init(store, op_state, y); + op_ret = user.init(s, store, op_state, y); if (op_ret < 0) { ldout(store->ctx(), 20) << "failed initializing user info: " << op_ret << dendl; return; @@ -1051,7 +1051,7 @@ void RGWOp_Quota_Set::execute(optional_yield y) } string err; - op_ret = user.modify(op_state, y, &err); + op_ret = user.modify(s, op_state, y, &err); if (op_ret < 0) { ldout(store->ctx(), 20) << "failed updating user info: " << op_ret << ": " << err << dendl; return; diff --git a/src/rgw/rgw_rest_user_policy.cc b/src/rgw/rgw_rest_user_policy.cc index 7c8429bdcb284..1139b1fdc78d3 100644 --- a/src/rgw/rgw_rest_user_policy.cc +++ b/src/rgw/rgw_rest_user_policy.cc @@ -120,14 +120,14 @@ void RGWPutUserPolicy::execute(optional_yield y) RGWUserInfo info; rgw_user user_id(user_name); - op_ret = store->ctl()->user->get_info_by_uid(user_id, &info, s->yield); + op_ret = store->ctl()->user->get_info_by_uid(s, user_id, &info, s->yield); if (op_ret < 0) { op_ret = -ERR_NO_SUCH_ENTITY; return; } map uattrs; - op_ret = store->ctl()->user->get_attrs_by_uid(user_id, &uattrs, s->yield); + op_ret = store->ctl()->user->get_attrs_by_uid(s, user_id, &uattrs, s->yield); if (op_ret == -ENOENT) { op_ret = -ERR_NO_SUCH_ENTITY; return; @@ -153,7 +153,7 @@ void RGWPutUserPolicy::execute(optional_yield y) uattrs[RGW_ATTR_USER_POLICY] = in_bl; RGWObjVersionTracker objv_tracker; - op_ret = store->ctl()->user->store_info(info, s->yield, + op_ret = store->ctl()->user->store_info(s, info, s->yield, RGWUserCtl::PutParams() .set_objv_tracker(&objv_tracker) .set_attrs(&uattrs)); @@ -202,7 +202,7 @@ void RGWGetUserPolicy::execute(optional_yield y) rgw_user user_id(user_name); map uattrs; - op_ret = store->ctl()->user->get_attrs_by_uid(user_id, &uattrs, s->yield); + op_ret = store->ctl()->user->get_attrs_by_uid(s, user_id, &uattrs, s->yield); if (op_ret == -ENOENT) { ldout(s->cct, 0) << "ERROR: attrs not found for user" << user_name << dendl; op_ret = -ERR_NO_SUCH_ENTITY; @@ -266,7 +266,7 @@ void RGWListUserPolicies::execute(optional_yield y) rgw_user user_id(user_name); map uattrs; - op_ret = store->ctl()->user->get_attrs_by_uid(user_id, &uattrs, s->yield); + op_ret = store->ctl()->user->get_attrs_by_uid(s, user_id, &uattrs, s->yield); if (op_ret == -ENOENT) { ldout(s->cct, 0) << "ERROR: attrs not found for user" << user_name << dendl; op_ret = -ERR_NO_SUCH_ENTITY; @@ -329,7 +329,7 @@ void RGWDeleteUserPolicy::execute(optional_yield y) RGWUserInfo info; map uattrs; rgw_user user_id(user_name); - op_ret = store->ctl()->user->get_info_by_uid(user_id, &info, s->yield, + op_ret = store->ctl()->user->get_info_by_uid(s, user_id, &info, s->yield, RGWUserCtl::GetParams() .set_attrs(&uattrs)); if (op_ret < 0) { @@ -361,7 +361,7 @@ void RGWDeleteUserPolicy::execute(optional_yield y) uattrs[RGW_ATTR_USER_POLICY] = in_bl; RGWObjVersionTracker objv_tracker; - op_ret = store->ctl()->user->store_info(info, s->yield, + op_ret = store->ctl()->user->store_info(s, info, s->yield, RGWUserCtl::PutParams() .set_old_info(&info) .set_objv_tracker(&objv_tracker) diff --git a/src/rgw/rgw_role.cc b/src/rgw/rgw_role.cc index 9ed173131d559..b34338de59f6b 100644 --- a/src/rgw/rgw_role.cc +++ b/src/rgw/rgw_role.cc @@ -75,7 +75,7 @@ int RGWRole::store_path(bool exclusive, optional_yield y) bl, exclusive, NULL, real_time(), y, NULL); } -int RGWRole::create(bool exclusive, optional_yield y) +int RGWRole::create(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) { int ret; @@ -84,7 +84,7 @@ int RGWRole::create(bool exclusive, optional_yield y) } /* check to see the name is not used */ - ret = read_id(name, tenant, id, y); + ret = read_id(dpp, name, tenant, id, y); if (exclusive && ret == 0) { ldout(cct, 0) << "ERROR: name " << name << " already in use for role id " << id << dendl; @@ -166,17 +166,17 @@ int RGWRole::create(bool exclusive, optional_yield y) return 0; } -int RGWRole::delete_obj(optional_yield y) +int RGWRole::delete_obj(const DoutPrefixProvider *dpp, optional_yield y) { auto svc = ctl->svc; auto& pool = svc->zone->get_zone_params().roles_pool; - int ret = read_name(y); + int ret = read_name(dpp, y); if (ret < 0) { return ret; } - ret = read_info(y); + ret = read_info(dpp, y); if (ret < 0) { return ret; } @@ -211,14 +211,14 @@ int RGWRole::delete_obj(optional_yield y) return ret; } -int RGWRole::get(optional_yield y) +int RGWRole::get(const DoutPrefixProvider *dpp, optional_yield y) { - int ret = read_name(y); + int ret = read_name(dpp, y); if (ret < 0) { return ret; } - ret = read_info(y); + ret = read_info(dpp, y); if (ret < 0) { return ret; } @@ -226,9 +226,9 @@ int RGWRole::get(optional_yield y) return 0; } -int RGWRole::get_by_id(optional_yield y) +int RGWRole::get_by_id(const DoutPrefixProvider *dpp, optional_yield y) { - int ret = read_info(y); + int ret = read_info(dpp, y); if (ret < 0) { return ret; } @@ -312,7 +312,7 @@ void RGWRole::decode_json(JSONObj *obj) JSONDecoder::decode_json("assume_role_policy_document", trust_policy, obj); } -int RGWRole::read_id(const string& role_name, const string& tenant, string& role_id, optional_yield y) +int RGWRole::read_id(const DoutPrefixProvider *dpp, const string& role_name, const string& tenant, string& role_id, optional_yield y) { auto svc = ctl->svc; auto& pool = svc->zone->get_zone_params().roles_pool; @@ -320,7 +320,7 @@ int RGWRole::read_id(const string& role_name, const string& tenant, string& role bufferlist bl; auto obj_ctx = svc->sysobj->init_obj_ctx(); - int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, NULL, NULL, y); + int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, NULL, NULL, y, dpp); if (ret < 0) { return ret; } @@ -339,7 +339,7 @@ int RGWRole::read_id(const string& role_name, const string& tenant, string& role return 0; } -int RGWRole::read_info(optional_yield y) +int RGWRole::read_info(const DoutPrefixProvider *dpp, optional_yield y) { auto svc = ctl->svc; auto& pool = svc->zone->get_zone_params().roles_pool; @@ -347,7 +347,7 @@ int RGWRole::read_info(optional_yield y) bufferlist bl; auto obj_ctx = svc->sysobj->init_obj_ctx(); - int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, NULL, NULL, y); + int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, NULL, NULL, y, dpp); if (ret < 0) { ldout(cct, 0) << "ERROR: failed reading role info from pool: " << pool.name << ": " << id << ": " << cpp_strerror(-ret) << dendl; @@ -367,7 +367,7 @@ int RGWRole::read_info(optional_yield y) return 0; } -int RGWRole::read_name(optional_yield y) +int RGWRole::read_name(const DoutPrefixProvider *dpp, optional_yield y) { auto svc = ctl->svc; auto& pool = svc->zone->get_zone_params().roles_pool; @@ -375,7 +375,7 @@ int RGWRole::read_name(optional_yield y) bufferlist bl; auto obj_ctx = svc->sysobj->init_obj_ctx(); - int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, NULL, NULL, y); + int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, NULL, NULL, y, dpp); if (ret < 0) { ldout(cct, 0) << "ERROR: failed reading role name from pool: " << pool.name << ": " << name << ": " << cpp_strerror(-ret) << dendl; @@ -442,7 +442,8 @@ void RGWRole::update_trust_policy(string& trust_policy) this->trust_policy = trust_policy; } -int RGWRole::get_roles_by_path_prefix(RGWRados *store, +int RGWRole::get_roles_by_path_prefix(const DoutPrefixProvider *dpp, + RGWRados *store, CephContext *cct, const string& path_prefix, const string& tenant, @@ -493,7 +494,7 @@ int RGWRole::get_roles_by_path_prefix(RGWRados *store, RGWRole role(cct, store->pctl); role.set_id(id); - int ret = role.read_info(y); + int ret = role.read_info(dpp, y); if (ret < 0) { return ret; } diff --git a/src/rgw/rgw_role.h b/src/rgw/rgw_role.h index d72c5ecba4707..9e7ab57c2849e 100644 --- a/src/rgw/rgw_role.h +++ b/src/rgw/rgw_role.h @@ -42,9 +42,9 @@ class RGWRole int store_info(bool exclusive, optional_yield y); int store_name(bool exclusive, optional_yield y); int store_path(bool exclusive, optional_yield y); - int read_id(const string& role_name, const string& tenant, string& role_id, optional_yield y); - int read_name(optional_yield y); - int read_info(optional_yield y); + int read_id(const DoutPrefixProvider *dpp, const string& role_name, const string& tenant, string& role_id, optional_yield y); + int read_name(const DoutPrefixProvider *dpp, optional_yield y); + int read_info(const DoutPrefixProvider *dpp, optional_yield y); bool validate_input(); void extract_name_tenant(const std::string& str); @@ -141,10 +141,10 @@ public: void set_id(const string& id) { this->id = id; } - int create(bool exclusive, optional_yield y); - int delete_obj(optional_yield y); - int get(optional_yield y); - int get_by_id(optional_yield y); + int create(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y); + int delete_obj(const DoutPrefixProvider *dpp, optional_yield y); + int get(const DoutPrefixProvider *dpp, optional_yield y); + int get_by_id(const DoutPrefixProvider *dpp, optional_yield y); int update(optional_yield y); void update_trust_policy(string& trust_policy); void set_perm_policy(const string& policy_name, const string& perm_policy); @@ -157,7 +157,8 @@ public: static const string& get_names_oid_prefix(); static const string& get_info_oid_prefix(); static const string& get_path_oid_prefix(); - static int get_roles_by_path_prefix(RGWRados *store, + static int get_roles_by_path_prefix(const DoutPrefixProvider *dpp, + RGWRados *store, CephContext *cct, const string& path_prefix, const string& tenant, diff --git a/src/rgw/rgw_sal.h b/src/rgw/rgw_sal.h index 3c1a197269d7b..bfa8dfea1fafe 100644 --- a/src/rgw/rgw_sal.h +++ b/src/rgw/rgw_sal.h @@ -66,17 +66,18 @@ enum AttrsMod { using RGWAttrs = std::map; -class RGWStore : public DoutPrefixProvider { +class RGWStore { public: RGWStore() {} virtual ~RGWStore() = default; virtual std::unique_ptr get_user(const rgw_user& u) = 0; virtual std::unique_ptr get_object(const rgw_obj_key& k) = 0; - virtual int get_bucket(RGWUser* u, const rgw_bucket& b, std::unique_ptr* bucket, optional_yield y) = 0; + virtual int get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const rgw_bucket& b, std::unique_ptr* bucket, optional_yield y) = 0; virtual int get_bucket(RGWUser* u, const RGWBucketInfo& i, std::unique_ptr* bucket) = 0; - virtual int get_bucket(RGWUser* u, const std::string& tenant, const std::string& name, std::unique_ptr* bucket, optional_yield y) = 0; - virtual int create_bucket(RGWUser& u, const rgw_bucket& b, + virtual int get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const std::string& tenant, const std::string& name, std::unique_ptr* bucket, optional_yield y) = 0; + virtual int create_bucket(const DoutPrefixProvider *dpp, + RGWUser& u, const rgw_bucket& b, const std::string& zonegroup_id, rgw_placement_rule& placement_rule, std::string& swift_ver_location, @@ -96,7 +97,7 @@ class RGWStore : public DoutPrefixProvider { virtual int forward_request_to_master(RGWUser* user, obj_version *objv, bufferlist& in_data, JSONParser *jp, req_info& info, optional_yield y) = 0; - virtual int defer_gc(RGWObjectCtx *rctx, RGWBucket* bucket, RGWObject* obj, + virtual int defer_gc(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWBucket* bucket, RGWObject* obj, optional_yield y) = 0; virtual const RGWZoneGroup& get_zonegroup() = 0; virtual int get_zonegroup(const string& id, RGWZoneGroup& zonegroup) = 0; @@ -105,7 +106,7 @@ class RGWStore : public DoutPrefixProvider { virtual RGWLC* get_rgwlc(void) = 0; virtual int delete_raw_obj(const rgw_raw_obj& obj) = 0; virtual void get_raw_obj(const rgw_placement_rule& placement_rule, const rgw_obj& obj, rgw_raw_obj* raw_obj) = 0; - virtual int get_raw_chunk_size(const rgw_raw_obj& obj, uint64_t* chunk_size) = 0; + virtual int get_raw_chunk_size(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, uint64_t* chunk_size) = 0; virtual void finalize(void)=0; @@ -127,7 +128,8 @@ class RGWUser { RGWUser(const RGWUserInfo& _i) : info(_i) {} virtual ~RGWUser() = default; - virtual int list_buckets(const std::string& marker, const std::string& end_marker, + virtual int list_buckets(const DoutPrefixProvider *dpp, + const std::string& marker, const std::string& end_marker, uint64_t max, bool need_stats, RGWBucketList& buckets, optional_yield y) = 0; virtual RGWBucket* create_bucket(rgw_bucket& bucket, ceph::real_time creation_time) = 0; @@ -142,7 +144,7 @@ class RGWUser { static bool empty(RGWUser* u) { return (!u || u->info.user_id.id.empty()); } /* Placeholders */ - virtual int load_by_id(optional_yield y) = 0; + virtual int load_by_id(const DoutPrefixProvider *dpp, optional_yield y) = 0; /* dang temporary; will be removed when User is complete */ rgw_user& get_user() { return info.user_id; } @@ -213,36 +215,36 @@ class RGWBucket { ent(), info(_i), owner(_u), attrs(), bucket_version() { ent.bucket = info.bucket; ent.placement_rule = info.placement_rule;} virtual ~RGWBucket() = default; - virtual int load_by_name(const std::string& tenant, const std::string& bucket_name, const std::string bucket_instance_id, RGWSysObjectCtx *rctx, optional_yield y) = 0; + virtual int load_by_name(const DoutPrefixProvider *dpp, const std::string& tenant, const std::string& bucket_name, const std::string bucket_instance_id, RGWSysObjectCtx *rctx, optional_yield y) = 0; virtual std::unique_ptr get_object(const rgw_obj_key& key) = 0; - virtual int list(ListParams&, int, ListResults&, optional_yield y) = 0; + virtual int list(const DoutPrefixProvider *dpp, ListParams&, int, ListResults&, optional_yield y) = 0; virtual RGWObject* create_object(const rgw_obj_key& key /* Attributes */) = 0; virtual RGWAttrs& get_attrs(void) { return attrs; } virtual int set_attrs(RGWAttrs a) { attrs = a; return 0; } - virtual int remove_bucket(bool delete_children, std::string prefix, std::string delimiter, bool forward_to_master, req_info* req_info, optional_yield y) = 0; + virtual int remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, std::string prefix, std::string delimiter, bool forward_to_master, req_info* req_info, optional_yield y) = 0; virtual RGWAccessControlPolicy& get_acl(void) = 0; - virtual int set_acl(RGWAccessControlPolicy& acl, optional_yield y) = 0; - virtual int get_bucket_info(optional_yield y) = 0; + virtual int set_acl(const DoutPrefixProvider *dpp, RGWAccessControlPolicy& acl, optional_yield y) = 0; + virtual int get_bucket_info(const DoutPrefixProvider *dpp, optional_yield y) = 0; virtual int get_bucket_stats(RGWBucketInfo& bucket_info, int shard_id, std::string *bucket_ver, std::string *master_ver, std::map& stats, std::string *max_marker = nullptr, bool *syncstopped = nullptr) = 0; - virtual int read_bucket_stats(optional_yield y) = 0; + virtual int read_bucket_stats(const DoutPrefixProvider *dpp, optional_yield y) = 0; virtual int sync_user_stats(optional_yield y) = 0; - virtual int update_container_stats(void) = 0; - virtual int check_bucket_shards(void) = 0; - virtual int link(RGWUser* new_user, optional_yield y) = 0; + virtual int update_container_stats(const DoutPrefixProvider *dpp) = 0; + virtual int check_bucket_shards(const DoutPrefixProvider *dpp) = 0; + virtual int link(const DoutPrefixProvider *dpp, RGWUser* new_user, optional_yield y) = 0; virtual int unlink(RGWUser* new_user, optional_yield y) = 0; - virtual int chown(RGWUser* new_user, RGWUser* old_user, optional_yield y) = 0; - virtual int put_instance_info(bool exclusive, ceph::real_time mtime) = 0; + virtual int chown(RGWUser* new_user, RGWUser* old_user, optional_yield y, const DoutPrefixProvider *dpp) = 0; + virtual int put_instance_info(const DoutPrefixProvider *dpp, bool exclusive, ceph::real_time mtime) = 0; virtual bool is_owner(RGWUser* user) = 0; virtual RGWUser* get_owner(void) { return owner; }; virtual ACLOwner get_acl_owner(void) { return ACLOwner(info.owner); }; - virtual int check_empty(optional_yield y) = 0; + virtual int check_empty(const DoutPrefixProvider *dpp, optional_yield y) = 0; virtual int check_quota(RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size, optional_yield y, bool check_size_only = false) = 0; - virtual int set_instance_attrs(RGWAttrs& attrs, optional_yield y) = 0; - virtual int try_refresh_info(ceph::real_time *pmtime) = 0; + virtual int set_instance_attrs(const DoutPrefixProvider *dpp, RGWAttrs& attrs, optional_yield y) = 0; + virtual int try_refresh_info(const DoutPrefixProvider *dpp, ceph::real_time *pmtime) = 0; virtual int read_usage(uint64_t start_epoch, uint64_t end_epoch, uint32_t max_entries, bool *is_truncated, RGWUsageIter& usage_iter, map& usage) = 0; @@ -365,11 +367,11 @@ class RGWObject { virtual ~ReadOp() = default; - virtual int prepare(optional_yield y) = 0; - virtual int read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y) = 0; - virtual int iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y) = 0; - virtual int get_manifest(RGWObjManifest **pmanifest, optional_yield y) = 0; - virtual int get_attr(const char *name, bufferlist& dest, optional_yield y) = 0; + virtual int prepare(optional_yield y, const DoutPrefixProvider *dpp) = 0; + virtual int read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y, const DoutPrefixProvider *dpp) = 0; + virtual int iterate(const DoutPrefixProvider *dpp, int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y) = 0; + virtual int get_manifest(const DoutPrefixProvider *dpp, RGWObjManifest **pmanifest, optional_yield y) = 0; + virtual int get_attr(const DoutPrefixProvider *dpp, const char *name, bufferlist& dest, optional_yield y) = 0; }; struct WriteOp { @@ -401,7 +403,7 @@ class RGWObject { virtual ~WriteOp() = default; virtual int prepare(optional_yield y) = 0; - virtual int write_meta(uint64_t size, uint64_t accounted_size, optional_yield y) = 0; + virtual int write_meta(const DoutPrefixProvider *dpp, uint64_t size, uint64_t accounted_size, optional_yield y) = 0; //virtual int write_data(const char *data, uint64_t ofs, uint64_t len, bool exclusive) = 0; }; @@ -432,7 +434,7 @@ class RGWObject { virtual int read(off_t offset, off_t length, std::iostream& stream) = 0; virtual int write(off_t offset, off_t length, std::iostream& stream) = 0; - virtual int delete_object(RGWObjectCtx* obj_ctx, ACLOwner obj_owner, + virtual int delete_object(const DoutPrefixProvider *dpp, RGWObjectCtx* obj_ctx, ACLOwner obj_owner, ACLOwner bucket_owner, ceph::real_time unmod_since, bool high_precision_time, uint64_t epoch, std::string& version_id, optional_yield y) = 0; @@ -459,11 +461,11 @@ class RGWObject { bool empty() const { return key.empty(); } const std::string &get_name() const { return key.name; } - virtual int get_obj_state(RGWObjectCtx *rctx, RGWBucket& bucket, RGWObjState **state, optional_yield y, bool follow_olh = false) = 0; - virtual int set_obj_attrs(RGWObjectCtx* rctx, RGWAttrs* setattrs, RGWAttrs* delattrs, optional_yield y, rgw_obj* target_obj = NULL) = 0; - virtual int get_obj_attrs(RGWObjectCtx *rctx, optional_yield y, rgw_obj* target_obj = NULL) = 0; - virtual int modify_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, bufferlist& attr_val, optional_yield y) = 0; - virtual int delete_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, optional_yield y) = 0; + virtual int get_obj_state(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWBucket& bucket, RGWObjState **state, optional_yield y, bool follow_olh = false) = 0; + virtual int set_obj_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx* rctx, RGWAttrs* setattrs, RGWAttrs* delattrs, optional_yield y, rgw_obj* target_obj = NULL) = 0; + virtual int get_obj_attrs(RGWObjectCtx *rctx, optional_yield y, const DoutPrefixProvider *dpp, rgw_obj* target_obj = NULL) = 0; + virtual int modify_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider *dpp) = 0; + virtual int delete_obj_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, const char *attr_name, optional_yield y) = 0; virtual int copy_obj_data(RGWObjectCtx& rctx, RGWBucket* dest_bucket, RGWObject* dest_obj, uint16_t olh_epoch, std::string* petag, const DoutPrefixProvider *dpp, optional_yield y) = 0; virtual bool is_expired() = 0; virtual void gen_rand_obj_instance_name() = 0; @@ -477,7 +479,8 @@ class RGWObject { uint64_t olh_epoch, const DoutPrefixProvider *dpp, optional_yield y) = 0; - virtual int get_max_chunk_size(rgw_placement_rule placement_rule, + virtual int get_max_chunk_size(const DoutPrefixProvider *dpp, + rgw_placement_rule placement_rule, uint64_t* max_chunk_size, uint64_t* alignment = nullptr) = 0; virtual void get_max_aligned_size(uint64_t size, uint64_t alignment, uint64_t *max_size) = 0; diff --git a/src/rgw/rgw_sal_rados.cc b/src/rgw/rgw_sal_rados.cc index 157dc88f65c10..2b56880bbd7b6 100644 --- a/src/rgw/rgw_sal_rados.cc +++ b/src/rgw/rgw_sal_rados.cc @@ -41,7 +41,7 @@ namespace rgw::sal { -int RGWRadosUser::list_buckets(const string& marker, const string& end_marker, +int RGWRadosUser::list_buckets(const DoutPrefixProvider *dpp, const string& marker, const string& end_marker, uint64_t max, bool need_stats, RGWBucketList &buckets, optional_yield y) { @@ -50,7 +50,7 @@ int RGWRadosUser::list_buckets(const string& marker, const string& end_marker, int ret; buckets.clear(); - ret = store->ctl()->user->list_buckets(info.user_id, marker, end_marker, max, + ret = store->ctl()->user->list_buckets(dpp, info.user_id, marker, end_marker, max, need_stats, &ulist, &is_truncated, y); if (ret < 0) return ret; @@ -69,10 +69,10 @@ RGWBucket* RGWRadosUser::create_bucket(rgw_bucket& bucket, return NULL; } -int RGWRadosUser::load_by_id(optional_yield y) +int RGWRadosUser::load_by_id(const DoutPrefixProvider *dpp, optional_yield y) { - return store->ctl()->user->get_info_by_uid(info.user_id, &info, y); + return store->ctl()->user->get_info_by_uid(dpp, info.user_id, &info, y); } std::unique_ptr RGWRadosStore::get_object(const rgw_obj_key& k) @@ -86,12 +86,12 @@ RGWObject *RGWRadosBucket::create_object(const rgw_obj_key &key) return nullptr; } -int RGWRadosBucket::remove_bucket(bool delete_children, std::string prefix, std::string delimiter, bool forward_to_master, req_info* req_info, optional_yield y) +int RGWRadosBucket::remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, std::string prefix, std::string delimiter, bool forward_to_master, req_info* req_info, optional_yield y) { int ret; // Refresh info - ret = get_bucket_info(y); + ret = get_bucket_info(dpp, y); if (ret < 0) return ret; @@ -105,7 +105,7 @@ int RGWRadosBucket::remove_bucket(bool delete_children, std::string prefix, std: do { results.objs.clear(); - ret = list(params, 1000, results, y); + ret = list(dpp, params, 1000, results, y); if (ret < 0) return ret; @@ -118,7 +118,7 @@ int RGWRadosBucket::remove_bucket(bool delete_children, std::string prefix, std: for (const auto& obj : results.objs) { rgw_obj_key key(obj.key); /* xxx dang */ - ret = rgw_remove_object(store, info, info.bucket, key); + ret = rgw_remove_object(dpp, store, info, info.bucket, key); if (ret < 0 && ret != -ENOENT) { return ret; } @@ -127,7 +127,7 @@ int RGWRadosBucket::remove_bucket(bool delete_children, std::string prefix, std: /* If there's a prefix, then we are aborting multiparts as well */ if (!prefix.empty()) { - ret = abort_bucket_multiparts(store, store->ctx(), info, prefix, delimiter); + ret = abort_bucket_multiparts(dpp, store, store->ctx(), info, prefix, delimiter); if (ret < 0) { return ret; } @@ -142,7 +142,7 @@ int RGWRadosBucket::remove_bucket(bool delete_children, std::string prefix, std: // if we deleted children above we will force delete, as any that // remain is detrius from a prior bug - ret = store->getRados()->delete_bucket(info, ot, y, !delete_children); + ret = store->getRados()->delete_bucket(info, ot, y, dpp, !delete_children); if (ret < 0) { lderr(store->ctx()) << "ERROR: could not remove bucket " << info.bucket.name << dendl; @@ -158,7 +158,7 @@ int RGWRadosBucket::remove_bucket(bool delete_children, std::string prefix, std: lderr(store->ctx()) << "ERROR: unable to remove notifications from bucket. ret=" << ps_ret << dendl; } - ret = store->ctl()->bucket->unlink_bucket(info.owner, info.bucket, y, false); + ret = store->ctl()->bucket->unlink_bucket(info.owner, info.bucket, y, dpp, false); if (ret < 0) { lderr(store->ctx()) << "ERROR: unable to remove user bucket information" << dendl; } @@ -179,12 +179,12 @@ int RGWRadosBucket::remove_bucket(bool delete_children, std::string prefix, std: return ret; } -int RGWRadosBucket::get_bucket_info(optional_yield y) +int RGWRadosBucket::get_bucket_info(const DoutPrefixProvider *dpp, optional_yield y) { auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); RGWSI_MetaBackend_CtxParams bectx_params = RGWSI_MetaBackend_CtxParams_SObj(&obj_ctx); RGWObjVersionTracker ep_ot; - int ret = store->ctl()->bucket->read_bucket_info(info.bucket, &info, y, + int ret = store->ctl()->bucket->read_bucket_info(info.bucket, &info, y, dpp, RGWBucketCtl::BucketInstance::GetParams() .set_mtime(&mtime) .set_attrs(&attrs) @@ -197,7 +197,7 @@ int RGWRadosBucket::get_bucket_info(optional_yield y) return ret; } -int RGWRadosBucket::load_by_name(const std::string& tenant, const std::string& bucket_name, const std::string bucket_instance_id, RGWSysObjectCtx *rctx, optional_yield y) +int RGWRadosBucket::load_by_name(const DoutPrefixProvider *dpp, const std::string& tenant, const std::string& bucket_name, const std::string bucket_instance_id, RGWSysObjectCtx *rctx, optional_yield y) { info.bucket.tenant = tenant; info.bucket.name = bucket_name; @@ -205,10 +205,10 @@ int RGWRadosBucket::load_by_name(const std::string& tenant, const std::string& b ent.bucket = info.bucket; if (bucket_instance_id.empty()) { - return get_bucket_info(y); + return get_bucket_info(dpp, y); } - return store->getRados()->get_bucket_instance_info(*rctx, info.bucket, info, NULL, &attrs, y); + return store->getRados()->get_bucket_instance_info(*rctx, info.bucket, info, NULL, &attrs, y, dpp); } int RGWRadosBucket::get_bucket_stats(RGWBucketInfo& bucket_info, int shard_id, @@ -219,9 +219,9 @@ int RGWRadosBucket::get_bucket_stats(RGWBucketInfo& bucket_info, int shard_id, return store->getRados()->get_bucket_stats(bucket_info, shard_id, bucket_ver, master_ver, stats, max_marker, syncstopped); } -int RGWRadosBucket::read_bucket_stats(optional_yield y) +int RGWRadosBucket::read_bucket_stats(const DoutPrefixProvider *dpp, optional_yield y) { - int ret = store->ctl()->bucket->read_bucket_stats(info.bucket, &ent, y); + int ret = store->ctl()->bucket->read_bucket_stats(info.bucket, &ent, y, dpp); info.placement_rule = ent.placement_rule; return ret; } @@ -231,13 +231,13 @@ int RGWRadosBucket::sync_user_stats(optional_yield y) return store->ctl()->bucket->sync_user_stats(owner->get_id(), info, y); } -int RGWRadosBucket::update_container_stats(void) +int RGWRadosBucket::update_container_stats(const DoutPrefixProvider *dpp) { int ret; map m; m[info.bucket.name] = ent; - ret = store->getRados()->update_containers_stats(m); + ret = store->getRados()->update_containers_stats(m, dpp); if (!ret) return -EEXIST; if (ret < 0) @@ -259,12 +259,12 @@ int RGWRadosBucket::update_container_stats(void) return 0; } -int RGWRadosBucket::check_bucket_shards(void) +int RGWRadosBucket::check_bucket_shards(const DoutPrefixProvider *dpp) { - return store->getRados()->check_bucket_shards(info, info.bucket, get_count()); + return store->getRados()->check_bucket_shards(info, info.bucket, get_count(), dpp); } -int RGWRadosBucket::link(RGWUser* new_user, optional_yield y) +int RGWRadosBucket::link(const DoutPrefixProvider *dpp, RGWUser* new_user, optional_yield y) { RGWBucketEntryPoint ep; ep.bucket = info.bucket; @@ -275,7 +275,7 @@ int RGWRadosBucket::link(RGWUser* new_user, optional_yield y) rgw_ep_info ep_data{ep, ep_attrs}; return store->ctl()->bucket->link_bucket(new_user->get_user(), info.bucket, - ceph::real_time(), y, true, &ep_data); + ceph::real_time(), y, dpp, true, &ep_data); } int RGWRadosBucket::unlink(RGWUser* new_user, optional_yield y) @@ -283,18 +283,18 @@ int RGWRadosBucket::unlink(RGWUser* new_user, optional_yield y) return -1; } -int RGWRadosBucket::chown(RGWUser* new_user, RGWUser* old_user, optional_yield y) +int RGWRadosBucket::chown(RGWUser* new_user, RGWUser* old_user, optional_yield y, const DoutPrefixProvider *dpp) { string obj_marker; return store->ctl()->bucket->chown(store, info, new_user->get_user(), - old_user->get_display_name(), obj_marker, y); + old_user->get_display_name(), obj_marker, y, dpp); } -int RGWRadosBucket::put_instance_info(bool exclusive, ceph::real_time _mtime) +int RGWRadosBucket::put_instance_info(const DoutPrefixProvider *dpp, bool exclusive, ceph::real_time _mtime) { mtime = _mtime; - return store->getRados()->put_bucket_instance_info(info, exclusive, mtime, &attrs); + return store->getRados()->put_bucket_instance_info(info, exclusive, mtime, &attrs, dpp); } /* Make sure to call get_bucket_info() if you need it first */ @@ -303,9 +303,9 @@ bool RGWRadosBucket::is_owner(RGWUser* user) return (info.owner.compare(user->get_user()) == 0); } -int RGWRadosBucket::check_empty(optional_yield y) +int RGWRadosBucket::check_empty(const DoutPrefixProvider *dpp, optional_yield y) { - return store->getRados()->check_bucket_empty(info, y); + return store->getRados()->check_bucket_empty(dpp, info, y); } int RGWRadosBucket::check_quota(RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size, @@ -315,15 +315,15 @@ int RGWRadosBucket::check_quota(RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_q user_quota, bucket_quota, obj_size, y, check_size_only); } -int RGWRadosBucket::set_instance_attrs(RGWAttrs& attrs, optional_yield y) +int RGWRadosBucket::set_instance_attrs(const DoutPrefixProvider *dpp, RGWAttrs& attrs, optional_yield y) { return store->ctl()->bucket->set_bucket_instance_attrs(get_info(), - attrs, &get_info().objv_tracker, y); + attrs, &get_info().objv_tracker, y, dpp); } -int RGWRadosBucket::try_refresh_info(ceph::real_time *pmtime) +int RGWRadosBucket::try_refresh_info(const DoutPrefixProvider *dpp, ceph::real_time *pmtime) { - return store->getRados()->try_refresh_bucket_info(info, pmtime, &attrs); + return store->getRados()->try_refresh_bucket_info(info, pmtime, dpp, &attrs); } int RGWRadosBucket::read_usage(uint64_t start_epoch, uint64_t end_epoch, @@ -336,14 +336,14 @@ int RGWRadosBucket::read_usage(uint64_t start_epoch, uint64_t end_epoch, usage_iter, usage); } -int RGWRadosBucket::set_acl(RGWAccessControlPolicy &acl, optional_yield y) +int RGWRadosBucket::set_acl(const DoutPrefixProvider *dpp, RGWAccessControlPolicy &acl, optional_yield y) { bufferlist aclbl; acls = acl; acl.encode(aclbl); - return store->ctl()->bucket->set_acl(acl.get_owner(), info.bucket, info, aclbl, y); + return store->ctl()->bucket->set_acl(acl.get_owner(), info.bucket, info, aclbl, y, dpp); } std::unique_ptr RGWRadosBucket::get_object(const rgw_obj_key& k) @@ -351,7 +351,7 @@ std::unique_ptr RGWRadosBucket::get_object(const rgw_obj_key& k) return std::unique_ptr(new RGWRadosObject(this->store, k, this)); } -int RGWRadosBucket::list(ListParams& params, int max, ListResults& results, optional_yield y) +int RGWRadosBucket::list(const DoutPrefixProvider *dpp, ListParams& params, int max, ListResults& results, optional_yield y) { RGWRados::Bucket target(store->getRados(), get_info()); if (params.shard_id >= 0) { @@ -367,7 +367,7 @@ int RGWRadosBucket::list(ListParams& params, int max, ListResults& results, opti list_op.params.list_versions = params.list_versions; list_op.params.allow_unordered = params.allow_unordered; - int ret = list_op.list_objects(max, &results.objs, &results.common_prefixes, &results.is_truncated, y); + int ret = list_op.list_objects(dpp, max, &results.objs, &results.common_prefixes, &results.is_truncated, y); if (ret >= 0) { results.next_marker = list_op.get_next_marker(); } @@ -417,24 +417,24 @@ int RGWObject::range_to_ofs(uint64_t obj_size, int64_t &ofs, int64_t &end) return 0; } -int RGWRadosObject::get_obj_state(RGWObjectCtx *rctx, RGWBucket& bucket, RGWObjState **state, optional_yield y, bool follow_olh) +int RGWRadosObject::get_obj_state(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWBucket& bucket, RGWObjState **state, optional_yield y, bool follow_olh) { rgw_obj obj(bucket.get_key(), key.name); - return store->getRados()->get_obj_state(rctx, bucket.get_info(), obj, state, follow_olh, y); + return store->getRados()->get_obj_state(dpp, rctx, bucket.get_info(), obj, state, follow_olh, y); } -int RGWRadosObject::read_attrs(RGWRados::Object::Read &read_op, optional_yield y, rgw_obj *target_obj) +int RGWRadosObject::read_attrs(RGWRados::Object::Read &read_op, optional_yield y, const DoutPrefixProvider *dpp, rgw_obj *target_obj) { read_op.params.attrs = &attrs; read_op.params.target_obj = target_obj; read_op.params.obj_size = &obj_size; read_op.params.lastmod = &mtime; - return read_op.prepare(y); + return read_op.prepare(y, dpp); } -int RGWRadosObject::set_obj_attrs(RGWObjectCtx* rctx, RGWAttrs* setattrs, RGWAttrs* delattrs, optional_yield y, rgw_obj* target_obj) +int RGWRadosObject::set_obj_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx* rctx, RGWAttrs* setattrs, RGWAttrs* delattrs, optional_yield y, rgw_obj* target_obj) { RGWAttrs empty; rgw_obj target = get_obj(); @@ -442,7 +442,7 @@ int RGWRadosObject::set_obj_attrs(RGWObjectCtx* rctx, RGWAttrs* setattrs, RGWAtt if (!target_obj) target_obj = ⌖ - return store->getRados()->set_attrs(rctx, + return store->getRados()->set_attrs(dpp, rctx, bucket->get_info(), *target_obj, setattrs ? *setattrs : empty, @@ -450,34 +450,34 @@ int RGWRadosObject::set_obj_attrs(RGWObjectCtx* rctx, RGWAttrs* setattrs, RGWAtt y); } -int RGWRadosObject::get_obj_attrs(RGWObjectCtx *rctx, optional_yield y, rgw_obj* target_obj) +int RGWRadosObject::get_obj_attrs(RGWObjectCtx *rctx, optional_yield y, const DoutPrefixProvider *dpp, rgw_obj* target_obj) { RGWRados::Object op_target(store->getRados(), bucket->get_info(), *rctx, get_obj()); RGWRados::Object::Read read_op(&op_target); - return read_attrs(read_op, y, target_obj); + return read_attrs(read_op, y, dpp, target_obj); } -int RGWRadosObject::modify_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, bufferlist& attr_val, optional_yield y) +int RGWRadosObject::modify_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider *dpp) { rgw_obj target = get_obj(); - int r = get_obj_attrs(rctx, y, &target); + int r = get_obj_attrs(rctx, y, dpp, &target); if (r < 0) { return r; } set_atomic(rctx); attrs[attr_name] = attr_val; - return set_obj_attrs(rctx, &attrs, nullptr, y, &target); + return set_obj_attrs(dpp, rctx, &attrs, nullptr, y, &target); } -int RGWRadosObject::delete_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, optional_yield y) +int RGWRadosObject::delete_obj_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, const char *attr_name, optional_yield y) { RGWAttrs rmattr; bufferlist bl; set_atomic(rctx); rmattr[attr_name] = bl; - return set_obj_attrs(rctx, nullptr, &rmattr, y); + return set_obj_attrs(dpp, rctx, nullptr, &rmattr, y); } int RGWRadosObject::copy_obj_data(RGWObjectCtx& rctx, RGWBucket* dest_bucket, @@ -491,7 +491,7 @@ int RGWRadosObject::copy_obj_data(RGWObjectCtx& rctx, RGWBucket* dest_bucket, RGWRados::Object op_target(store->getRados(), dest_bucket->get_info(), rctx, get_obj()); RGWRados::Object::Read read_op(&op_target); - int ret = read_attrs(read_op, y); + int ret = read_attrs(read_op, y, dpp); if (ret < 0) return ret; @@ -603,9 +603,9 @@ int RGWRadosObject::transition(RGWObjectCtx& rctx, return store->getRados()->transition_obj(rctx, bucket, *this, placement_rule, mtime, olh_epoch, dpp, y); } -int RGWRadosObject::get_max_chunk_size(rgw_placement_rule placement_rule, uint64_t *max_chunk_size, uint64_t *alignment) +int RGWRadosObject::get_max_chunk_size(const DoutPrefixProvider *dpp, rgw_placement_rule placement_rule, uint64_t *max_chunk_size, uint64_t *alignment) { - return store->getRados()->get_max_chunk_size(placement_rule, get_obj(), max_chunk_size, alignment); + return store->getRados()->get_max_chunk_size(placement_rule, get_obj(), max_chunk_size, dpp, alignment); } void RGWRadosObject::get_max_aligned_size(uint64_t size, uint64_t alignment, @@ -649,7 +649,7 @@ RGWRadosObject::RadosReadOp::RadosReadOp(RGWRadosObject *_source, RGWObjectCtx * parent_op(&op_target) { } -int RGWRadosObject::RadosReadOp::prepare(optional_yield y) +int RGWRadosObject::RadosReadOp::prepare(optional_yield y, const DoutPrefixProvider *dpp) { uint64_t obj_size; @@ -665,7 +665,7 @@ int RGWRadosObject::RadosReadOp::prepare(optional_yield y) parent_op.params.obj_size = &obj_size; parent_op.params.attrs = &source->get_attrs(); - int ret = parent_op.prepare(y); + int ret = parent_op.prepare(y, dpp); if (ret < 0) return ret; @@ -676,23 +676,23 @@ int RGWRadosObject::RadosReadOp::prepare(optional_yield y) return ret; } -int RGWRadosObject::RadosReadOp::read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y) +int RGWRadosObject::RadosReadOp::read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y, const DoutPrefixProvider *dpp) { - return parent_op.read(ofs, end, bl, y); + return parent_op.read(ofs, end, bl, y, dpp); } -int RGWRadosObject::RadosReadOp::get_manifest(RGWObjManifest **pmanifest, +int RGWRadosObject::RadosReadOp::get_manifest(const DoutPrefixProvider *dpp, RGWObjManifest **pmanifest, optional_yield y) { - return op_target.get_manifest(pmanifest, y); + return op_target.get_manifest(dpp, pmanifest, y); } -int RGWRadosObject::RadosReadOp::get_attr(const char *name, bufferlist& dest, optional_yield y) +int RGWRadosObject::RadosReadOp::get_attr(const DoutPrefixProvider *dpp, const char *name, bufferlist& dest, optional_yield y) { - return parent_op.get_attr(name, dest, y); + return parent_op.get_attr(dpp, name, dest, y); } -int RGWRadosObject::delete_object(RGWObjectCtx* obj_ctx, ACLOwner obj_owner, ACLOwner bucket_owner, ceph::real_time unmod_since, bool high_precision_time, uint64_t epoch, string& version_id, optional_yield y) +int RGWRadosObject::delete_object(const DoutPrefixProvider *dpp, RGWObjectCtx* obj_ctx, ACLOwner obj_owner, ACLOwner bucket_owner, ceph::real_time unmod_since, bool high_precision_time, uint64_t epoch, string& version_id, optional_yield y) { int ret = 0; RGWRados::Object del_target(store->getRados(), bucket->get_info(), *obj_ctx, get_obj()); @@ -706,7 +706,7 @@ int RGWRadosObject::delete_object(RGWObjectCtx* obj_ctx, ACLOwner obj_owner, ACL del_op.params.unmod_since = unmod_since; del_op.params.high_precision_time = high_precision_time; - ret = del_op.delete_obj(y); + ret = del_op.delete_obj(y, dpp); if (ret >= 0) { delete_marker = del_op.result.delete_marker; version_id = del_op.result.version_id; @@ -775,9 +775,9 @@ int RGWRadosObject::copy_object(RGWObjectCtx& obj_ctx, y); } -int RGWRadosObject::RadosReadOp::iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y) +int RGWRadosObject::RadosReadOp::iterate(const DoutPrefixProvider *dpp, int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y) { - return parent_op.iterate(ofs, end, cb, y); + return parent_op.iterate(dpp, ofs, end, cb, y); } std::unique_ptr RGWRadosObject::get_write_op(RGWObjectCtx* ctx) @@ -822,9 +822,9 @@ int RGWRadosObject::RadosWriteOp::prepare(optional_yield y) return 0; } -int RGWRadosObject::RadosWriteOp::write_meta(uint64_t size, uint64_t accounted_size, optional_yield y) +int RGWRadosObject::RadosWriteOp::write_meta(const DoutPrefixProvider *dpp, uint64_t size, uint64_t accounted_size, optional_yield y) { - int ret = parent_op.write_meta(size, accounted_size, *params.attrs, y); + int ret = parent_op.write_meta(dpp, size, accounted_size, *params.attrs, y); params.canceled = parent_op.meta.canceled; return ret; @@ -854,13 +854,13 @@ int RGWRadosObject::swift_versioning_copy(RGWObjectCtx* obj_ctx, y); } -int RGWRadosStore::get_bucket(RGWUser* u, const rgw_bucket& b, std::unique_ptr* bucket, optional_yield y) +int RGWRadosStore::get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const rgw_bucket& b, std::unique_ptr* bucket, optional_yield y) { int ret; RGWBucket* bp; bp = new RGWRadosBucket(this, b, u); - ret = bp->get_bucket_info(y); + ret = bp->get_bucket_info(dpp, y); if (ret < 0) { delete bp; return ret; @@ -881,14 +881,14 @@ int RGWRadosStore::get_bucket(RGWUser* u, const RGWBucketInfo& i, std::unique_pt return 0; } -int RGWRadosStore::get_bucket(RGWUser* u, const std::string& tenant, const std::string&name, std::unique_ptr* bucket, optional_yield y) +int RGWRadosStore::get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const std::string& tenant, const std::string&name, std::unique_ptr* bucket, optional_yield y) { rgw_bucket b; b.tenant = tenant; b.name = name; - return get_bucket(u, b, bucket, y); + return get_bucket(dpp, u, b, bucket, y); } static int decode_policy(CephContext *cct, @@ -911,7 +911,7 @@ static int decode_policy(CephContext *cct, return 0; } -static int rgw_op_get_bucket_policy_from_attr(RGWRadosStore *store, +static int rgw_op_get_bucket_policy_from_attr(const DoutPrefixProvider *dpp, RGWRadosStore *store, RGWUser& user, RGWAttrs& bucket_attrs, RGWAccessControlPolicy *policy, @@ -926,7 +926,7 @@ static int rgw_op_get_bucket_policy_from_attr(RGWRadosStore *store, } else { ldout(store->ctx(), 0) << "WARNING: couldn't find acl header for bucket, generating default" << dendl; /* object exists, but policy is broken */ - int r = user.load_by_id(y); + int r = user.load_by_id(dpp, y); if (r < 0) return r; @@ -973,9 +973,9 @@ int RGWRadosStore::forward_request_to_master(RGWUser* user, obj_version *objv, return 0; } -int RGWRadosStore::defer_gc(RGWObjectCtx *rctx, RGWBucket* bucket, RGWObject* obj, optional_yield y) +int RGWRadosStore::defer_gc(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWBucket* bucket, RGWObject* obj, optional_yield y) { - return rados->defer_gc(rctx, bucket->get_info(), obj->get_obj(), y); + return rados->defer_gc(dpp, rctx, bucket->get_info(), obj->get_obj(), y); } const RGWZoneGroup& RGWRadosStore::get_zonegroup() @@ -1005,7 +1005,8 @@ int RGWRadosStore::cluster_stat(RGWClusterStat& stats) return ret; } -int RGWRadosStore::create_bucket(RGWUser& u, const rgw_bucket& b, +int RGWRadosStore::create_bucket(const DoutPrefixProvider *dpp, + RGWUser& u, const rgw_bucket& b, const string& zonegroup_id, rgw_placement_rule& placement_rule, string& swift_ver_location, @@ -1031,7 +1032,7 @@ int RGWRadosStore::create_bucket(RGWUser& u, const rgw_bucket& b, obj_version objv, *pobjv = NULL; /* If it exists, look it up; otherwise create it */ - ret = get_bucket(&u, b, &bucket, y); + ret = get_bucket(dpp, &u, b, &bucket, y); if (ret < 0 && ret != -ENOENT) return ret; @@ -1044,7 +1045,7 @@ int RGWRadosStore::create_bucket(RGWUser& u, const rgw_bucket& b, placement_rule.inherit_from(bucket->get_info().placement_rule); // don't allow changes to the acl policy - int r = rgw_op_get_bucket_policy_from_attr(this, u, bucket->get_attrs(), + int r = rgw_op_get_bucket_policy_from_attr(dpp, this, u, bucket->get_attrs(), &old_policy, y); if (r >= 0 && old_policy != policy) { bucket_out->swap(bucket); @@ -1066,9 +1067,9 @@ int RGWRadosStore::create_bucket(RGWUser& u, const rgw_bucket& b, JSONDecoder::decode_json("entry_point_object_ver", ep_objv, &jp); JSONDecoder::decode_json("object_ver", objv, &jp); JSONDecoder::decode_json("bucket_info", master_info, &jp); - ldpp_dout(this, 20) << "parsed: objv.tag=" << objv.tag << " objv.ver=" << objv.ver << dendl; + ldpp_dout(dpp, 20) << "parsed: objv.tag=" << objv.tag << " objv.ver=" << objv.ver << dendl; std::time_t ctime = ceph::real_clock::to_time_t(master_info.creation_time); - ldpp_dout(this, 20) << "got creation time: << " << std::put_time(std::localtime(&ctime), "%F %T") << dendl; + ldpp_dout(dpp, 20) << "got creation time: << " << std::put_time(std::localtime(&ctime), "%F %T") << dendl; pmaster_bucket= &master_info.bucket; creation_time = master_info.creation_time; pmaster_num_shards = &master_info.layout.current_index.layout.normal.num_shards; @@ -1104,7 +1105,7 @@ int RGWRadosStore::create_bucket(RGWUser& u, const rgw_bucket& b, zid, placement_rule, swift_ver_location, pquota_info, attrs, info, pobjv, &ep_objv, creation_time, - pmaster_bucket, pmaster_num_shards, y, exclusive); + pmaster_bucket, pmaster_num_shards, y, dpp, exclusive); if (ret == -EEXIST) { *existed = true; ret = 0; @@ -1136,9 +1137,9 @@ void RGWRadosStore::get_raw_obj(const rgw_placement_rule& placement_rule, const rados->obj_to_raw(placement_rule, obj, raw_obj); } -int RGWRadosStore::get_raw_chunk_size(const rgw_raw_obj& obj, uint64_t* chunk_size) +int RGWRadosStore::get_raw_chunk_size(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, uint64_t* chunk_size) { - return rados->get_max_chunk_size(obj.pool, chunk_size); + return rados->get_max_chunk_size(obj.pool, chunk_size, dpp); } MPRadosSerializer::MPRadosSerializer(RGWRadosStore* store, RGWRadosObject* obj, const std::string& lock_name) : @@ -1274,7 +1275,7 @@ LCSerializer* RadosLifecycle::get_serializer(const std::string& lock_name, const } // namespace rgw::sal -rgw::sal::RGWRadosStore *RGWStoreManager::init_storage_provider(CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_cache) +rgw::sal::RGWRadosStore *RGWStoreManager::init_storage_provider(const DoutPrefixProvider *dpp, CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_cache) { RGWRados *rados = new RGWRados; rgw::sal::RGWRadosStore *store = new rgw::sal::RGWRadosStore(); @@ -1288,7 +1289,7 @@ rgw::sal::RGWRadosStore *RGWStoreManager::init_storage_provider(CephContext *cct .set_run_quota_threads(quota_threads) .set_run_sync_thread(run_sync_thread) .set_run_reshard_thread(run_reshard_thread) - .initialize(cct) < 0) { + .initialize(cct, dpp) < 0) { delete store; return NULL; } @@ -1296,7 +1297,7 @@ rgw::sal::RGWRadosStore *RGWStoreManager::init_storage_provider(CephContext *cct return store; } -rgw::sal::RGWRadosStore *RGWStoreManager::init_raw_storage_provider(CephContext *cct) +rgw::sal::RGWRadosStore *RGWStoreManager::init_raw_storage_provider(const DoutPrefixProvider *dpp, CephContext *cct) { RGWRados *rados = new RGWRados; rgw::sal::RGWRadosStore *store = new rgw::sal::RGWRadosStore(); @@ -1306,7 +1307,7 @@ rgw::sal::RGWRadosStore *RGWStoreManager::init_raw_storage_provider(CephContext rados->set_context(cct); - int ret = rados->init_svc(true); + int ret = rados->init_svc(true, dpp); if (ret < 0) { ldout(cct, 0) << "ERROR: failed to init services (ret=" << cpp_strerror(-ret) << ")" << dendl; delete store; diff --git a/src/rgw/rgw_sal_rados.h b/src/rgw/rgw_sal_rados.h index 3f22a52d4ce2e..43ea4197e1e38 100644 --- a/src/rgw/rgw_sal_rados.h +++ b/src/rgw/rgw_sal_rados.h @@ -33,13 +33,13 @@ class RGWRadosUser : public RGWUser { RGWRadosUser(RGWRadosStore *_st) : store(_st) { } RGWRadosUser() {} - int list_buckets(const std::string& marker, const std::string& end_marker, + int list_buckets(const DoutPrefixProvider *dpp, const std::string& marker, const std::string& end_marker, uint64_t max, bool need_stats, RGWBucketList& buckets, optional_yield y) override; RGWBucket* create_bucket(rgw_bucket& bucket, ceph::real_time creation_time); /* Placeholders */ - virtual int load_by_id(optional_yield y); + virtual int load_by_id(const DoutPrefixProvider *dpp, optional_yield y); friend class RGWRadosBucket; }; @@ -61,11 +61,11 @@ class RGWRadosObject : public RGWObject { public: RadosReadOp(RGWRadosObject *_source, RGWObjectCtx *_rctx); - virtual int prepare(optional_yield y) override; - virtual int read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y) override; - virtual int iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y) override; - virtual int get_manifest(RGWObjManifest **pmanifest, optional_yield y) override; - virtual int get_attr(const char *name, bufferlist& dest, optional_yield y) override; + virtual int prepare(optional_yield y, const DoutPrefixProvider *dpp) override; + virtual int read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y, const DoutPrefixProvider *dpp) override; + virtual int iterate(const DoutPrefixProvider *dpp, int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y) override; + virtual int get_manifest(const DoutPrefixProvider *dpp, RGWObjManifest **pmanifest, optional_yield y) override; + virtual int get_attr(const DoutPrefixProvider *dpp, const char *name, bufferlist& dest, optional_yield y) override; }; struct RadosWriteOp : public WriteOp { @@ -79,7 +79,7 @@ class RGWRadosObject : public RGWObject { RadosWriteOp(RGWRadosObject* _source, RGWObjectCtx* _rctx); virtual int prepare(optional_yield y) override; - virtual int write_meta(uint64_t size, uint64_t accounted_size, optional_yield y) override; + virtual int write_meta(const DoutPrefixProvider *dpp, uint64_t size, uint64_t accounted_size, optional_yield y) override; //virtual int write_data(const char *data, uint64_t ofs, uint64_t len, bool exclusive) override; }; @@ -99,7 +99,7 @@ class RGWRadosObject : public RGWObject { int read(off_t offset, off_t length, std::iostream& stream) { return length; } int write(off_t offset, off_t length, std::iostream& stream) { return length; } - virtual int delete_object(RGWObjectCtx* obj_ctx, ACLOwner obj_owner, + virtual int delete_object(const DoutPrefixProvider *dpp, RGWObjectCtx* obj_ctx, ACLOwner obj_owner, ACLOwner bucket_owner, ceph::real_time unmod_since, bool high_precision_time, uint64_t epoch, std::string& version_id,optional_yield y) override; @@ -123,11 +123,11 @@ class RGWRadosObject : public RGWObject { virtual void set_atomic(RGWObjectCtx *rctx) const; virtual void set_prefetch_data(RGWObjectCtx *rctx); - virtual int get_obj_state(RGWObjectCtx *rctx, RGWBucket& bucket, RGWObjState **state, optional_yield y, bool follow_olh = true) override; - virtual int set_obj_attrs(RGWObjectCtx* rctx, RGWAttrs* setattrs, RGWAttrs* delattrs, optional_yield y, rgw_obj* target_obj = NULL) override; - virtual int get_obj_attrs(RGWObjectCtx *rctx, optional_yield y, rgw_obj* target_obj = NULL) override; - virtual int modify_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, bufferlist& attr_val, optional_yield y) override; - virtual int delete_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, optional_yield y) override; + virtual int get_obj_state(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWBucket& bucket, RGWObjState **state, optional_yield y, bool follow_olh = true) override; + virtual int set_obj_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx* rctx, RGWAttrs* setattrs, RGWAttrs* delattrs, optional_yield y, rgw_obj* target_obj = NULL) override; + virtual int get_obj_attrs(RGWObjectCtx *rctx, optional_yield y, const DoutPrefixProvider *dpp, rgw_obj* target_obj = NULL) override; + virtual int modify_obj_attrs(RGWObjectCtx *rctx, const char *attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider *dpp) override; + virtual int delete_obj_attrs(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, const char *attr_name, optional_yield y) override; virtual int copy_obj_data(RGWObjectCtx& rctx, RGWBucket* dest_bucket, RGWObject* dest_obj, uint16_t olh_epoch, std::string* petag, const DoutPrefixProvider *dpp, optional_yield y) override; virtual bool is_expired() override; virtual void gen_rand_obj_instance_name() override; @@ -144,7 +144,8 @@ class RGWRadosObject : public RGWObject { uint64_t olh_epoch, const DoutPrefixProvider *dpp, optional_yield y) override; - virtual int get_max_chunk_size(rgw_placement_rule placement_rule, + virtual int get_max_chunk_size(const DoutPrefixProvider *dpp, + rgw_placement_rule placement_rule, uint64_t *max_chunk_size, uint64_t *alignment = nullptr) override; virtual void get_max_aligned_size(uint64_t size, uint64_t alignment, uint64_t *max_size) override; @@ -170,7 +171,7 @@ class RGWRadosObject : public RGWObject { bool must_exist, optional_yield y) override; private: - int read_attrs(RGWRados::Object::Read &read_op, optional_yield y, rgw_obj *target_obj = nullptr); + int read_attrs(RGWRados::Object::Read &read_op, optional_yield y, const DoutPrefixProvider *dpp, rgw_obj *target_obj = nullptr); }; class RGWRadosBucket : public RGWBucket { @@ -222,33 +223,33 @@ class RGWRadosBucket : public RGWBucket { ~RGWRadosBucket() { } - virtual int load_by_name(const std::string& tenant, const std::string& bucket_name, const std::string bucket_instance_id, RGWSysObjectCtx *rctx, optional_yield y) override; + virtual int load_by_name(const DoutPrefixProvider *dpp, const std::string& tenant, const std::string& bucket_name, const std::string bucket_instance_id, RGWSysObjectCtx *rctx, optional_yield y) override; virtual std::unique_ptr get_object(const rgw_obj_key& k) override; RGWBucketList* list(void) { return new RGWBucketList(); } - virtual int list(ListParams&, int, ListResults&, optional_yield y) override; + virtual int list(const DoutPrefixProvider *dpp, ListParams&, int, ListResults&, optional_yield y) override; RGWObject* create_object(const rgw_obj_key& key /* Attributes */) override; - virtual int remove_bucket(bool delete_children, std::string prefix, std::string delimiter, bool forward_to_master, req_info* req_info, optional_yield y) override; + virtual int remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, std::string prefix, std::string delimiter, bool forward_to_master, req_info* req_info, optional_yield y) override; RGWAccessControlPolicy& get_acl(void) { return acls; } - virtual int set_acl(RGWAccessControlPolicy& acl, optional_yield y) override; - virtual int get_bucket_info(optional_yield y) override; + virtual int set_acl(const DoutPrefixProvider *dpp, RGWAccessControlPolicy& acl, optional_yield y) override; + virtual int get_bucket_info(const DoutPrefixProvider *dpp, optional_yield y) override; virtual int get_bucket_stats(RGWBucketInfo& bucket_info, int shard_id, std::string *bucket_ver, std::string *master_ver, std::map& stats, std::string *max_marker = nullptr, bool *syncstopped = nullptr) override; - virtual int read_bucket_stats(optional_yield y) override; + virtual int read_bucket_stats(const DoutPrefixProvider *dpp, optional_yield y) override; virtual int sync_user_stats(optional_yield y) override; - virtual int update_container_stats(void) override; - virtual int check_bucket_shards(void) override; - virtual int link(RGWUser* new_user, optional_yield y) override; + virtual int update_container_stats(const DoutPrefixProvider *dpp) override; + virtual int check_bucket_shards(const DoutPrefixProvider *dpp) override; + virtual int link(const DoutPrefixProvider *dpp, RGWUser* new_user, optional_yield y) override; virtual int unlink(RGWUser* new_user, optional_yield y) override; - virtual int chown(RGWUser* new_user, RGWUser* old_user, optional_yield y) override; - virtual int put_instance_info(bool exclusive, ceph::real_time mtime) override; + virtual int chown(RGWUser* new_user, RGWUser* old_user, optional_yield y, const DoutPrefixProvider *dpp) override; + virtual int put_instance_info(const DoutPrefixProvider *dpp, bool exclusive, ceph::real_time mtime) override; virtual bool is_owner(RGWUser* user) override; - virtual int check_empty(optional_yield y) override; + virtual int check_empty(const DoutPrefixProvider *dpp, optional_yield y) override; virtual int check_quota(RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size, optional_yield y, bool check_size_only = false) override; - virtual int set_instance_attrs(RGWAttrs& attrs, optional_yield y) override; - virtual int try_refresh_info(ceph::real_time *pmtime) override; + virtual int set_instance_attrs(const DoutPrefixProvider *dpp, RGWAttrs& attrs, optional_yield y) override; + virtual int try_refresh_info(const DoutPrefixProvider *dpp, ceph::real_time *pmtime) override; virtual int read_usage(uint64_t start_epoch, uint64_t end_epoch, uint32_t max_entries, bool *is_truncated, RGWUsageIter& usage_iter, map& usage) override; @@ -275,10 +276,11 @@ class RGWRadosStore : public RGWStore { virtual std::unique_ptr get_user(const rgw_user& u); virtual std::unique_ptr get_object(const rgw_obj_key& k) override; - virtual int get_bucket(RGWUser* u, const rgw_bucket& b, std::unique_ptr* bucket, optional_yield y) override; + virtual int get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const rgw_bucket& b, std::unique_ptr* bucket, optional_yield y) override; virtual int get_bucket(RGWUser* u, const RGWBucketInfo& i, std::unique_ptr* bucket) override; - virtual int get_bucket(RGWUser* u, const std::string& tenant, const std::string&name, std::unique_ptr* bucket, optional_yield y) override; - virtual int create_bucket(RGWUser& u, const rgw_bucket& b, + virtual int get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const std::string& tenant, const std::string&name, std::unique_ptr* bucket, optional_yield y) override; + virtual int create_bucket(const DoutPrefixProvider *dpp, + RGWUser& u, const rgw_bucket& b, const std::string& zonegroup_id, rgw_placement_rule& placement_rule, std::string& swift_ver_location, @@ -298,7 +300,7 @@ class RGWRadosStore : public RGWStore { virtual int forward_request_to_master(RGWUser* user, obj_version *objv, bufferlist& in_data, JSONParser *jp, req_info& info, optional_yield y) override; - virtual int defer_gc(RGWObjectCtx *rctx, RGWBucket* bucket, RGWObject* obj, + virtual int defer_gc(const DoutPrefixProvider *dpp, RGWObjectCtx *rctx, RGWBucket* bucket, RGWObject* obj, optional_yield y) override; virtual const RGWZoneGroup& get_zonegroup() override; virtual int get_zonegroup(const string& id, RGWZoneGroup& zonegroup) override; @@ -307,7 +309,7 @@ class RGWRadosStore : public RGWStore { virtual RGWLC* get_rgwlc(void) { return rados->get_lc(); } virtual int delete_raw_obj(const rgw_raw_obj& obj) override; virtual void get_raw_obj(const rgw_placement_rule& placement_rule, const rgw_obj& obj, rgw_raw_obj* raw_obj) override; - virtual int get_raw_chunk_size(const rgw_raw_obj& obj, uint64_t* chunk_size) override; + virtual int get_raw_chunk_size(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, uint64_t* chunk_size) override; void setRados(RGWRados * st) { rados = st; } RGWRados *getRados(void) { return rados; } @@ -327,11 +329,6 @@ class RGWRadosStore : public RGWStore { int get_obj_head_ioctx(const RGWBucketInfo& bucket_info, const rgw_obj& obj, librados::IoCtx *ioctx); - // implements DoutPrefixProvider - std::ostream& gen_prefix(std::ostream& out) const { return out << "RGWRadosStore "; } - CephContext* get_cct() const override { return rados->ctx(); } - unsigned get_subsys() const override { return ceph_subsys_rgw; } - const std::string& get_luarocks_path() const override { return luarocks_path; } @@ -391,18 +388,18 @@ public: class RGWStoreManager { public: RGWStoreManager() {} - static rgw::sal::RGWRadosStore *get_storage(CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, + static rgw::sal::RGWRadosStore *get_storage(const DoutPrefixProvider *dpp, CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_cache = true) { - rgw::sal::RGWRadosStore *store = init_storage_provider(cct, use_gc_thread, use_lc_thread, + rgw::sal::RGWRadosStore *store = init_storage_provider(dpp, cct, use_gc_thread, use_lc_thread, quota_threads, run_sync_thread, run_reshard_thread, use_cache); return store; } - static rgw::sal::RGWRadosStore *get_raw_storage(CephContext *cct) { - rgw::sal::RGWRadosStore *rados = init_raw_storage_provider(cct); + static rgw::sal::RGWRadosStore *get_raw_storage(const DoutPrefixProvider *dpp, CephContext *cct) { + rgw::sal::RGWRadosStore *rados = init_raw_storage_provider(dpp, cct); return rados; } - static rgw::sal::RGWRadosStore *init_storage_provider(CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_metadata_cache); - static rgw::sal::RGWRadosStore *init_raw_storage_provider(CephContext *cct); + static rgw::sal::RGWRadosStore *init_storage_provider(const DoutPrefixProvider *dpp, CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread, bool use_metadata_cache); + static rgw::sal::RGWRadosStore *init_raw_storage_provider(const DoutPrefixProvider *dpp, CephContext *cct); static void close_storage(rgw::sal::RGWRadosStore *store); }; diff --git a/src/rgw/rgw_service.cc b/src/rgw/rgw_service.cc index 3fb4f2b0b6413..e9c40c6dee54c 100644 --- a/src/rgw/rgw_service.cc +++ b/src/rgw/rgw_service.cc @@ -47,7 +47,8 @@ int RGWServices_Def::init(CephContext *cct, bool have_cache, bool raw, bool run_sync, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { finisher = std::make_unique(cct); bucket_sobj = std::make_unique(cct); @@ -113,28 +114,28 @@ int RGWServices_Def::init(CephContext *cct, can_shutdown = true; - int r = finisher->start(y); + int r = finisher->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start finisher service (" << cpp_strerror(-r) << dendl; return r; } if (!raw) { - r = notify->start(y); + r = notify->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start notify service (" << cpp_strerror(-r) << dendl; return r; } } - r = rados->start(y); + r = rados->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start rados service (" << cpp_strerror(-r) << dendl; return r; } if (!raw) { - r = zone->start(y); + r = zone->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start zone service (" << cpp_strerror(-r) << dendl; return r; @@ -148,95 +149,95 @@ int RGWServices_Def::init(CephContext *cct, return r; } - r = mdlog->start(y); + r = mdlog->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start mdlog service (" << cpp_strerror(-r) << dendl; return r; } - r = sync_modules->start(y); + r = sync_modules->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start sync modules service (" << cpp_strerror(-r) << dendl; return r; } } - r = cls->start(y); + r = cls->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start cls service (" << cpp_strerror(-r) << dendl; return r; } - r = config_key_rados->start(y); + r = config_key_rados->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start config_key service (" << cpp_strerror(-r) << dendl; return r; } - r = zone_utils->start(y); + r = zone_utils->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start zone_utils service (" << cpp_strerror(-r) << dendl; return r; } - r = quota->start(y); + r = quota->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start quota service (" << cpp_strerror(-r) << dendl; return r; } - r = sysobj_core->start(y); + r = sysobj_core->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start sysobj_core service (" << cpp_strerror(-r) << dendl; return r; } if (have_cache) { - r = sysobj_cache->start(y); + r = sysobj_cache->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start sysobj_cache service (" << cpp_strerror(-r) << dendl; return r; } } - r = sysobj->start(y); + r = sysobj->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start sysobj service (" << cpp_strerror(-r) << dendl; return r; } if (!raw) { - r = meta_be_sobj->start(y); + r = meta_be_sobj->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start meta_be_sobj service (" << cpp_strerror(-r) << dendl; return r; } - r = meta->start(y); + r = meta->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start meta service (" << cpp_strerror(-r) << dendl; return r; } - r = bucket_sobj->start(y); + r = bucket_sobj->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start bucket service (" << cpp_strerror(-r) << dendl; return r; } - r = bucket_sync_sobj->start(y); + r = bucket_sync_sobj->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start bucket_sync service (" << cpp_strerror(-r) << dendl; return r; } - r = user_rados->start(y); + r = user_rados->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start user_rados service (" << cpp_strerror(-r) << dendl; return r; } - r = otp->start(y); + r = otp->start(y, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start otp service (" << cpp_strerror(-r) << dendl; return r; @@ -274,11 +275,11 @@ void RGWServices_Def::shutdown() } -int RGWServices::do_init(CephContext *_cct, bool have_cache, bool raw, bool run_sync, optional_yield y) +int RGWServices::do_init(CephContext *_cct, bool have_cache, bool raw, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp) { cct = _cct; - int r = _svc.init(cct, have_cache, raw, run_sync, y); + int r = _svc.init(cct, have_cache, raw, run_sync, y, dpp); if (r < 0) { return r; } @@ -314,7 +315,7 @@ int RGWServices::do_init(CephContext *_cct, bool have_cache, bool raw, bool run_ return 0; } -int RGWServiceInstance::start(optional_yield y) +int RGWServiceInstance::start(optional_yield y, const DoutPrefixProvider *dpp) { if (start_state != StateInit) { return 0; @@ -323,7 +324,7 @@ int RGWServiceInstance::start(optional_yield y) start_state = StateStarting;; /* setting started prior to do_start() on purpose so that circular references can call start() on each other */ - int r = do_start(y); + int r = do_start(y, dpp); if (r < 0) { return r; } @@ -339,7 +340,7 @@ RGWCtlDef::_meta::_meta() {} RGWCtlDef::_meta::~_meta() {} -int RGWCtlDef::init(RGWServices& svc) +int RGWCtlDef::init(RGWServices& svc, const DoutPrefixProvider *dpp) { meta.mgr.reset(new RGWMetadataManager(svc.meta)); @@ -376,19 +377,20 @@ int RGWCtlDef::init(RGWServices& svc) bucket->init(user.get(), (RGWBucketMetadataHandler *)bucket_meta_handler, (RGWBucketInstanceMetadataHandler *)bi_meta_handler, - svc.datalog_rados); + svc.datalog_rados, + dpp); otp->init((RGWOTPMetadataHandler *)meta.otp.get()); return 0; } -int RGWCtl::init(RGWServices *_svc) +int RGWCtl::init(RGWServices *_svc, const DoutPrefixProvider *dpp) { svc = _svc; cct = svc->cct; - int r = _ctl.init(*svc); + int r = _ctl.init(*svc, dpp); if (r < 0) { ldout(cct, 0) << "ERROR: failed to start init ctls (" << cpp_strerror(-r) << dendl; return r; diff --git a/src/rgw/rgw_service.h b/src/rgw/rgw_service.h index 36a3fed618dfc..883eeae10255c 100644 --- a/src/rgw/rgw_service.h +++ b/src/rgw/rgw_service.h @@ -29,14 +29,14 @@ protected: } start_state{StateInit}; virtual void shutdown() {} - virtual int do_start(optional_yield) { + virtual int do_start(optional_yield, const DoutPrefixProvider *dpp) { return 0; } public: RGWServiceInstance(CephContext *_cct) : cct(_cct) {} virtual ~RGWServiceInstance() {} - int start(optional_yield y); + int start(optional_yield y, const DoutPrefixProvider *dpp); bool is_started() { return (start_state == StateStarted); } @@ -108,7 +108,7 @@ struct RGWServices_Def RGWServices_Def(); ~RGWServices_Def(); - int init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync, optional_yield y); + int init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp); void shutdown(); }; @@ -147,14 +147,14 @@ struct RGWServices RGWSI_SysObj_Core *core{nullptr}; RGWSI_User *user{nullptr}; - int do_init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync, optional_yield y); + int do_init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp); - int init(CephContext *cct, bool have_cache, bool run_sync, optional_yield y) { - return do_init(cct, have_cache, false, run_sync, y); + int init(CephContext *cct, bool have_cache, bool run_sync, optional_yield y, const DoutPrefixProvider *dpp) { + return do_init(cct, have_cache, false, run_sync, y, dpp); } - int init_raw(CephContext *cct, bool have_cache, optional_yield y) { - return do_init(cct, have_cache, true, false, y); + int init_raw(CephContext *cct, bool have_cache, optional_yield y, const DoutPrefixProvider *dpp) { + return do_init(cct, have_cache, true, false, y, dpp); } void shutdown() { _svc.shutdown(); @@ -186,7 +186,7 @@ struct RGWCtlDef { RGWCtlDef(); ~RGWCtlDef(); - int init(RGWServices& svc); + int init(RGWServices& svc, const DoutPrefixProvider *dpp); }; struct RGWCtl { @@ -208,7 +208,7 @@ struct RGWCtl { RGWBucketCtl *bucket{nullptr}; RGWOTPCtl *otp{nullptr}; - int init(RGWServices *_svc); + int init(RGWServices *_svc, const DoutPrefixProvider *dpp); }; #endif diff --git a/src/rgw/rgw_sts.cc b/src/rgw/rgw_sts.cc index 8149ba1cabd60..4e29364bc5fd5 100644 --- a/src/rgw/rgw_sts.cc +++ b/src/rgw/rgw_sts.cc @@ -276,14 +276,15 @@ int AssumeRoleRequest::validate_input() const return AssumeRoleRequestBase::validate_input(); } -std::tuple STSService::getRoleInfo(const string& arn, +std::tuple STSService::getRoleInfo(const DoutPrefixProvider *dpp, + const string& arn, optional_yield y) { if (auto r_arn = rgw::ARN::parse(arn); r_arn) { auto pos = r_arn->resource.find_last_of('/'); string roleName = r_arn->resource.substr(pos + 1); RGWRole role(cct, store->getRados()->pctl, roleName, r_arn->account); - if (int ret = role.get(y); ret < 0) { + if (int ret = role.get(dpp, y); ret < 0) { if (ret == -ENOENT) { ldout(cct, 0) << "Role doesn't exist: " << roleName << dendl; ret = -ERR_NO_ROLE_FOUND; @@ -311,18 +312,18 @@ std::tuple STSService::getRoleInfo(const string& arn, } } -int STSService::storeARN(string& arn, optional_yield y) +int STSService::storeARN(const DoutPrefixProvider *dpp, string& arn, optional_yield y) { int ret = 0; RGWUserInfo info; - if (ret = rgw_get_user_info_by_uid(store->ctl()->user, user_id, info, y); ret < 0) { + if (ret = rgw_get_user_info_by_uid(dpp, store->ctl()->user, user_id, info, y); ret < 0) { return -ERR_NO_SUCH_ENTITY; } info.assumed_role_arn = arn; RGWObjVersionTracker objv_tracker; - if (ret = rgw_store_user_info(store->ctl()->user, info, &info, &objv_tracker, real_time(), + if (ret = rgw_store_user_info(dpp, store->ctl()->user, info, &info, &objv_tracker, real_time(), false, y); ret < 0) { return -ERR_INTERNAL_ERROR; } @@ -392,7 +393,8 @@ AssumeRoleWithWebIdentityResponse STSService::assumeRoleWithWebIdentity(AssumeRo return response; } -AssumeRoleResponse STSService::assumeRole(AssumeRoleRequest& req, +AssumeRoleResponse STSService::assumeRole(const DoutPrefixProvider *dpp, + AssumeRoleRequest& req, optional_yield y) { AssumeRoleResponse response; @@ -439,7 +441,7 @@ AssumeRoleResponse STSService::assumeRole(AssumeRoleRequest& req, //Save ARN with the user string arn = response.user.getARN(); - response.retCode = storeARN(arn, y); + response.retCode = storeARN(dpp, arn, y); if (response.retCode < 0) { return response; } diff --git a/src/rgw/rgw_sts.h b/src/rgw/rgw_sts.h index a54ef3e1028f4..14c783c1cde01 100644 --- a/src/rgw/rgw_sts.h +++ b/src/rgw/rgw_sts.h @@ -229,14 +229,14 @@ class STSService { rgw_user user_id; RGWRole role; rgw::auth::Identity* identity; - int storeARN(string& arn, optional_yield y); + int storeARN(const DoutPrefixProvider *dpp, string& arn, optional_yield y); public: STSService() = default; STSService(CephContext* cct, rgw::sal::RGWRadosStore *store, rgw_user user_id, rgw::auth::Identity* identity) : cct(cct), store(store), user_id(user_id), identity(identity) {} - std::tuple getRoleInfo(const string& arn, optional_yield y); - AssumeRoleResponse assumeRole(AssumeRoleRequest& req, optional_yield y); + std::tuple getRoleInfo(const DoutPrefixProvider *dpp, const string& arn, optional_yield y); + AssumeRoleResponse assumeRole(const DoutPrefixProvider *dpp, AssumeRoleRequest& req, optional_yield y); GetSessionTokenResponse getSessionToken(GetSessionTokenRequest& req); AssumeRoleWithWebIdentityResponse assumeRoleWithWebIdentity(AssumeRoleWithWebIdentityRequest& req); }; diff --git a/src/rgw/rgw_swift_auth.cc b/src/rgw/rgw_swift_auth.cc index 136f9df0556c9..da0a370b71ab7 100644 --- a/src/rgw/rgw_swift_auth.cc +++ b/src/rgw/rgw_swift_auth.cc @@ -92,14 +92,14 @@ void TempURLEngine::get_owner_info(const DoutPrefixProvider* dpp, const req_stat if (uid.tenant.empty()) { const rgw_user tenanted_uid(uid.id, uid.id); - if (ctl->user->get_info_by_uid(tenanted_uid, &uinfo, s->yield) >= 0) { + if (ctl->user->get_info_by_uid(dpp, tenanted_uid, &uinfo, s->yield) >= 0) { /* Succeeded. */ bucket_tenant = uinfo.user_id.tenant; found = true; } } - if (!found && ctl->user->get_info_by_uid(uid, &uinfo, s->yield) < 0) { + if (!found && ctl->user->get_info_by_uid(dpp, uid, &uinfo, s->yield) < 0) { throw -EPERM; } else { bucket_tenant = uinfo.user_id.tenant; @@ -113,7 +113,7 @@ void TempURLEngine::get_owner_info(const DoutPrefixProvider* dpp, const req_stat /* Need to get user info of bucket owner. */ RGWBucketInfo bucket_info; RGWSI_MetaBackend_CtxParams bectx_params = RGWSI_MetaBackend_CtxParams_SObj(s->sysobj_ctx); - int ret = ctl->bucket->read_bucket_info(b, &bucket_info, y, RGWBucketCtl::BucketInstance::GetParams().set_bectx_params(bectx_params)); + int ret = ctl->bucket->read_bucket_info(b, &bucket_info, y, dpp, RGWBucketCtl::BucketInstance::GetParams().set_bectx_params(bectx_params)); if (ret < 0) { throw ret; } @@ -121,7 +121,7 @@ void TempURLEngine::get_owner_info(const DoutPrefixProvider* dpp, const req_stat ldpp_dout(dpp, 20) << "temp url user (bucket owner): " << bucket_info.owner << dendl; - if (ctl->user->get_info_by_uid(bucket_info.owner, &owner_info, s->yield) < 0) { + if (ctl->user->get_info_by_uid(dpp, bucket_info.owner, &owner_info, s->yield) < 0) { throw -EPERM; } } @@ -449,7 +449,7 @@ ExternalTokenEngine::authenticate(const DoutPrefixProvider* dpp, ldpp_dout(dpp, 10) << "swift user=" << swift_user << dendl; RGWUserInfo tmp_uinfo; - ret = ctl->user->get_info_by_swift(swift_user, &tmp_uinfo, s->yield); + ret = ctl->user->get_info_by_swift(dpp, swift_user, &tmp_uinfo, s->yield); if (ret < 0) { ldpp_dout(dpp, 0) << "NOTICE: couldn't map swift user" << dendl; throw ret; @@ -570,7 +570,7 @@ SignedTokenEngine::authenticate(const DoutPrefixProvider* dpp, } RGWUserInfo user_info; - ret = ctl->user->get_info_by_swift(swift_user, &user_info, s->yield); + ret = ctl->user->get_info_by_swift(dpp, swift_user, &user_info, s->yield); if (ret < 0) { throw ret; } @@ -687,7 +687,7 @@ void RGW_SWIFT_Auth_Get::execute(optional_yield y) user_str = user; - if ((ret = store->ctl()->user->get_info_by_swift(user_str, &info, s->yield)) < 0) + if ((ret = store->ctl()->user->get_info_by_swift(s, user_str, &info, s->yield)) < 0) { ret = -EACCES; goto done; diff --git a/src/rgw/rgw_sync.cc b/src/rgw/rgw_sync.cc index a934a2e28a50d..b852c56c6f8e5 100644 --- a/src/rgw/rgw_sync.cc +++ b/src/rgw/rgw_sync.cc @@ -1084,9 +1084,10 @@ class RGWAsyncMetaStoreEntry : public RGWAsyncRadosRequest { rgw::sal::RGWRadosStore *store; string raw_key; bufferlist bl; + const DoutPrefixProvider *dpp; protected: int _send_request() override { - int ret = store->ctl()->meta.mgr->put(raw_key, bl, null_yield, RGWMDLogSyncType::APPLY_ALWAYS, true); + int ret = store->ctl()->meta.mgr->put(raw_key, bl, null_yield, dpp, RGWMDLogSyncType::APPLY_ALWAYS, true); if (ret < 0) { ldout(store->ctx(), 0) << "ERROR: can't store key: " << raw_key << " ret=" << ret << dendl; return ret; @@ -1096,8 +1097,9 @@ protected: public: RGWAsyncMetaStoreEntry(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, rgw::sal::RGWRadosStore *_store, const string& _raw_key, - bufferlist& _bl) : RGWAsyncRadosRequest(caller, cn), store(_store), - raw_key(_raw_key), bl(_bl) {} + bufferlist& _bl, + const DoutPrefixProvider *dpp) : RGWAsyncRadosRequest(caller, cn), store(_store), + raw_key(_raw_key), bl(_bl), dpp(dpp) {} }; @@ -1123,7 +1125,7 @@ public: int send_request() override { req = new RGWAsyncMetaStoreEntry(this, stack->create_completion_notifier(), - sync_env->store, raw_key, bl); + sync_env->store, raw_key, bl, sync_env->dpp); sync_env->async_rados->queue(req); return 0; } @@ -1136,9 +1138,10 @@ public: class RGWAsyncMetaRemoveEntry : public RGWAsyncRadosRequest { rgw::sal::RGWRadosStore *store; string raw_key; + const DoutPrefixProvider *dpp; protected: int _send_request() override { - int ret = store->ctl()->meta.mgr->remove(raw_key, null_yield); + int ret = store->ctl()->meta.mgr->remove(raw_key, null_yield, dpp); if (ret < 0) { ldout(store->ctx(), 0) << "ERROR: can't remove key: " << raw_key << " ret=" << ret << dendl; return ret; @@ -1147,8 +1150,8 @@ protected: } public: RGWAsyncMetaRemoveEntry(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, rgw::sal::RGWRadosStore *_store, - const string& _raw_key) : RGWAsyncRadosRequest(caller, cn), store(_store), - raw_key(_raw_key) {} + const string& _raw_key, const DoutPrefixProvider *dpp) : RGWAsyncRadosRequest(caller, cn), store(_store), + raw_key(_raw_key), dpp(dpp) {} }; @@ -1172,7 +1175,7 @@ public: int send_request() override { req = new RGWAsyncMetaRemoveEntry(this, stack->create_completion_notifier(), - sync_env->store, raw_key); + sync_env->store, raw_key, sync_env->dpp); sync_env->async_rados->queue(req); return 0; } diff --git a/src/rgw/rgw_sync_checkpoint.cc b/src/rgw/rgw_sync_checkpoint.cc index d9ee136784aca..2e57aa9c21a1f 100644 --- a/src/rgw/rgw_sync_checkpoint.cc +++ b/src/rgw/rgw_sync_checkpoint.cc @@ -192,7 +192,7 @@ int rgw_bucket_sync_checkpoint(const DoutPrefixProvider* dpp, auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); int r = store->getRados()->get_bucket_instance_info( obj_ctx, *entry.pipe.source.bucket, entry.source_bucket_info, - nullptr, nullptr, y); + nullptr, nullptr, y, dpp); if (r < 0) { ldpp_dout(dpp, 0) << "failed to read source bucket info: " << cpp_strerror(r) << dendl; diff --git a/src/rgw/rgw_sync_module_pubsub.cc b/src/rgw/rgw_sync_module_pubsub.cc index 11388eadf1a76..6a3c3b142bc5b 100644 --- a/src/rgw/rgw_sync_module_pubsub.cc +++ b/src/rgw/rgw_sync_module_pubsub.cc @@ -43,10 +43,10 @@ config: // utility function to convert the args list from string format // (ampresend separated with equal sign) to prased structure -RGWHTTPArgs string_to_args(const std::string& str_args) { +RGWHTTPArgs string_to_args(const std::string& str_args, const DoutPrefixProvider *dpp) { RGWHTTPArgs args; args.set(str_args); - args.parse(); + args.parse(dpp); return args; } @@ -61,7 +61,7 @@ struct PSSubConfig { std::string arn_topic; RGWPubSubEndpoint::Ptr push_endpoint; - void from_user_conf(CephContext *cct, const rgw_pubsub_sub_config& uc) { + void from_user_conf(CephContext *cct, const rgw_pubsub_sub_config& uc, const DoutPrefixProvider *dpp) { name = uc.name; topic = uc.topic; push_endpoint_name = uc.dest.push_endpoint; @@ -72,10 +72,10 @@ struct PSSubConfig { if (!push_endpoint_name.empty()) { push_endpoint_args = uc.dest.push_endpoint_args; try { - push_endpoint = RGWPubSubEndpoint::create(push_endpoint_name, arn_topic, string_to_args(push_endpoint_args), cct); - ldout(cct, 20) << "push endpoint created: " << push_endpoint->to_str() << dendl; + push_endpoint = RGWPubSubEndpoint::create(push_endpoint_name, arn_topic, string_to_args(push_endpoint_args, dpp), cct); + ldpp_dout(dpp, 20) << "push endpoint created: " << push_endpoint->to_str() << dendl; } catch (const RGWPubSubEndpoint::configuration_error& e) { - ldout(cct, 1) << "ERROR: failed to create push endpoint: " + ldpp_dout(dpp, 1) << "ERROR: failed to create push endpoint: " << push_endpoint_name << " due to: " << e.what() << dendl; } } @@ -540,7 +540,8 @@ class PSSubscription { yield call(new RGWGetBucketInfoCR(sync_env->async_rados, sync_env->store, get_bucket_info, - sub->get_bucket_info_result)); + sub->get_bucket_info_result, + sync_env->dpp)); if (retcode < 0 && retcode != -ENOENT) { ldpp_dout(sync_env->dpp, 1) << "ERROR: failed to geting bucket info: " << "tenant=" << get_bucket_info.tenant << " name=" << get_bucket_info.bucket_name << ": ret=" << retcode << dendl; @@ -694,7 +695,7 @@ public: env(_env), sub_conf(std::make_shared()), data_access(std::make_shared(sync_env->store)) { - sub_conf->from_user_conf(sync_env->cct, user_sub_conf); + sub_conf->from_user_conf(sync_env->cct, user_sub_conf, sync_env->dpp); } virtual ~PSSubscription() { if (init_cr) { @@ -902,7 +903,7 @@ public: } get_user_info.user = conf->user; - yield call(new RGWGetUserInfoCR(sync_env->async_rados, sync_env->store, get_user_info, env->data_user_info)); + yield call(new RGWGetUserInfoCR(sync_env->async_rados, sync_env->store, get_user_info, env->data_user_info, sync_env->dpp)); if (retcode < 0) { ldpp_dout(sync_env->dpp, 1) << "ERROR: failed to create rgw user: ret=" << retcode << dendl; return set_cr_error(retcode); diff --git a/src/rgw/rgw_tools.cc b/src/rgw/rgw_tools.cc index 89a322b0675ad..dce5d03188a85 100644 --- a/src/rgw/rgw_tools.cc +++ b/src/rgw/rgw_tools.cc @@ -175,7 +175,7 @@ int rgw_put_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const str } int rgw_get_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const string& key, bufferlist& bl, - RGWObjVersionTracker *objv_tracker, real_time *pmtime, optional_yield y, map *pattrs, + RGWObjVersionTracker *objv_tracker, real_time *pmtime, optional_yield y, const DoutPrefixProvider *dpp, map *pattrs, rgw_cache_entry_info *cache_info, boost::optional refresh_version) { @@ -195,7 +195,7 @@ int rgw_get_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const str int ret = rop.set_attrs(pattrs) .set_last_mod(pmtime) .set_objv_tracker(objv_tracker) - .stat(y); + .stat(y, dpp); if (ret < 0) return ret; @@ -430,13 +430,14 @@ int RGWDataAccess::Bucket::finish_init() return 0; } -int RGWDataAccess::Bucket::init(optional_yield y) +int RGWDataAccess::Bucket::init(const DoutPrefixProvider *dpp, optional_yield y) { int ret = sd->store->getRados()->get_bucket_info(sd->store->svc(), tenant, name, bucket_info, &mtime, y, + dpp, &attrs); if (ret < 0) { return ret; diff --git a/src/rgw/rgw_tools.h b/src/rgw/rgw_tools.h index 28d251c28d6c6..537bcd068681c 100644 --- a/src/rgw/rgw_tools.h +++ b/src/rgw/rgw_tools.h @@ -74,7 +74,7 @@ int rgw_parse_list_of_flags(struct rgw_name_to_flag *mapping, int rgw_put_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const string& oid, bufferlist& data, bool exclusive, RGWObjVersionTracker *objv_tracker, real_time set_mtime, optional_yield y, map *pattrs = NULL); int rgw_get_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const string& key, bufferlist& bl, - RGWObjVersionTracker *objv_tracker, real_time *pmtime, optional_yield y, map *pattrs = NULL, + RGWObjVersionTracker *objv_tracker, real_time *pmtime, optional_yield y, const DoutPrefixProvider *dpp, map *pattrs = NULL, rgw_cache_entry_info *cache_info = NULL, boost::optional refresh_version = boost::none); int rgw_delete_system_obj(RGWSI_SysObj *sysobj_svc, const rgw_pool& pool, const string& oid, @@ -177,7 +177,7 @@ public: name(_name), bucket_id(_bucket_id) {} Bucket(RGWDataAccess *_sd) : sd(_sd) {} - int init(optional_yield y); + int init(const DoutPrefixProvider *dpp, optional_yield y); int init(const RGWBucketInfo& _bucket_info, const map& _attrs); public: int get_object(const rgw_obj_key& key, @@ -232,13 +232,14 @@ public: friend class Bucket; }; - int get_bucket(const string& tenant, + int get_bucket(const DoutPrefixProvider *dpp, + const string& tenant, const string name, const string bucket_id, BucketRef *bucket, optional_yield y) { bucket->reset(new Bucket(this, tenant, name, bucket_id)); - return (*bucket)->init(y); + return (*bucket)->init(dpp, y); } int get_bucket(const RGWBucketInfo& bucket_info, diff --git a/src/rgw/rgw_trim_bilog.cc b/src/rgw/rgw_trim_bilog.cc index 658b501f55598..01bc7a1a7fb8e 100644 --- a/src/rgw/rgw_trim_bilog.cc +++ b/src/rgw/rgw_trim_bilog.cc @@ -426,6 +426,7 @@ class BucketTrimInstanceCR : public RGWCoroutine { RGWBucketInfo _bucket_info; const RGWBucketInfo *pbucket_info; //< pointer to bucket instance info to locate bucket indices int child_ret = 0; + const DoutPrefixProvider *dpp; using StatusShards = std::vector; std::vector peer_status; //< sync status for each peer @@ -434,11 +435,13 @@ class BucketTrimInstanceCR : public RGWCoroutine { public: BucketTrimInstanceCR(rgw::sal::RGWRadosStore *store, RGWHTTPManager *http, BucketTrimObserver *observer, - const std::string& bucket_instance) + const std::string& bucket_instance, + const DoutPrefixProvider *dpp) : RGWCoroutine(store->ctx()), store(store), http(http), observer(observer), bucket_instance(bucket_instance), - zone_id(store->svc()->zone->get_zone().id) { + zone_id(store->svc()->zone->get_zone().id), + dpp(dpp) { rgw_bucket_parse_bucket_key(cct, bucket_instance, &bucket, nullptr); source_policy = make_shared(); } @@ -456,7 +459,8 @@ int BucketTrimInstanceCR::operate() yield call(new RGWBucketGetSyncPolicyHandlerCR(store->svc()->rados->get_async_processor(), store, get_policy_params, - source_policy)); + source_policy, + dpp)); if (retcode < 0) { if (retcode != -ENOENT) { ldout(cct, 0) << "ERROR: failed to fetch policy handler for bucket=" << bucket << dendl; @@ -568,14 +572,17 @@ class BucketTrimInstanceCollectCR : public RGWShardCollectCR { BucketTrimObserver *const observer; std::vector::const_iterator bucket; std::vector::const_iterator end; + const DoutPrefixProvider *dpp; public: BucketTrimInstanceCollectCR(rgw::sal::RGWRadosStore *store, RGWHTTPManager *http, BucketTrimObserver *observer, const std::vector& buckets, - int max_concurrent) + int max_concurrent, + const DoutPrefixProvider *dpp) : RGWShardCollectCR(store->ctx(), max_concurrent), store(store), http(http), observer(observer), - bucket(buckets.begin()), end(buckets.end()) + bucket(buckets.begin()), end(buckets.end()), + dpp(dpp) {} bool spawn_next() override; }; @@ -585,7 +592,7 @@ bool BucketTrimInstanceCollectCR::spawn_next() if (bucket == end) { return false; } - spawn(new BucketTrimInstanceCR(store, http, observer, *bucket), false); + spawn(new BucketTrimInstanceCR(store, http, observer, *bucket, dpp), false); ++bucket; return true; } @@ -776,14 +783,15 @@ class BucketTrimCR : public RGWCoroutine { BucketTrimStatus status; RGWObjVersionTracker objv; //< version tracker for trim status object std::string last_cold_marker; //< position for next trim marker + const DoutPrefixProvider *dpp; static const std::string section; //< metadata section for bucket instances public: BucketTrimCR(rgw::sal::RGWRadosStore *store, RGWHTTPManager *http, const BucketTrimConfig& config, BucketTrimObserver *observer, - const rgw_raw_obj& obj) + const rgw_raw_obj& obj, const DoutPrefixProvider *dpp) : RGWCoroutine(store->ctx()), store(store), http(http), config(config), - observer(observer), obj(obj), counter(config.counter_size) + observer(observer), obj(obj), counter(config.counter_size), dpp(dpp) {} int operate() override; @@ -885,7 +893,7 @@ int BucketTrimCR::operate() set_status("trimming buckets"); ldout(cct, 4) << "collected " << buckets.size() << " buckets for trim" << dendl; yield call(new BucketTrimInstanceCollectCR(store, http, observer, buckets, - config.concurrent_buckets)); + config.concurrent_buckets, dpp)); // ignore errors from individual buckets // write updated trim status @@ -934,15 +942,17 @@ class BucketTrimPollCR : public RGWCoroutine { const rgw_raw_obj& obj; const std::string name{"trim"}; //< lock name const std::string cookie; + const DoutPrefixProvider *dpp; public: BucketTrimPollCR(rgw::sal::RGWRadosStore *store, RGWHTTPManager *http, const BucketTrimConfig& config, - BucketTrimObserver *observer, const rgw_raw_obj& obj) + BucketTrimObserver *observer, const rgw_raw_obj& obj, + const DoutPrefixProvider *dpp) : RGWCoroutine(store->ctx()), store(store), http(http), config(config), observer(observer), obj(obj), - cookie(RGWSimpleRadosLockCR::gen_random_cookie(cct)) - {} + cookie(RGWSimpleRadosLockCR::gen_random_cookie(cct)), + dpp(dpp) {} int operate() override; }; @@ -965,7 +975,7 @@ int BucketTrimPollCR::operate() } set_status("trimming"); - yield call(new BucketTrimCR(store, http, config, observer, obj)); + yield call(new BucketTrimCR(store, http, config, observer, obj, dpp)); if (retcode < 0) { // on errors, unlock so other gateways can try set_status("unlocking"); @@ -1132,14 +1142,29 @@ void BucketTrimManager::on_bucket_changed(const std::string_view& bucket) RGWCoroutine* BucketTrimManager::create_bucket_trim_cr(RGWHTTPManager *http) { return new BucketTrimPollCR(impl->store, http, impl->config, - impl.get(), impl->status_obj); + impl.get(), impl->status_obj, this); } RGWCoroutine* BucketTrimManager::create_admin_bucket_trim_cr(RGWHTTPManager *http) { // return the trim coroutine without any polling return new BucketTrimCR(impl->store, http, impl->config, - impl.get(), impl->status_obj); + impl.get(), impl->status_obj, this); +} + +CephContext* BucketTrimManager::get_cct() const +{ + return impl->store->ctx(); +} + +unsigned BucketTrimManager::get_subsys() const +{ + return dout_subsys; +} + +std::ostream& BucketTrimManager::gen_prefix(std::ostream& out) const +{ + return out << "rgw bucket trim manager: "; } } // namespace rgw diff --git a/src/rgw/rgw_trim_bilog.h b/src/rgw/rgw_trim_bilog.h index 5bc5c3cfd9b89..a2d5f4c980c5a 100644 --- a/src/rgw/rgw_trim_bilog.h +++ b/src/rgw/rgw_trim_bilog.h @@ -23,6 +23,7 @@ #include "include/common_fwd.h" #include "include/encoding.h" #include "common/ceph_time.h" +#include "common/dout.h" class RGWCoroutine; class RGWHTTPManager; @@ -69,7 +70,7 @@ void configure_bucket_trim(CephContext *cct, BucketTrimConfig& config); /// input: the frequency of entries read from the data changes log, and a global /// listing of the bucket.instance metadata. This allows us to trim active /// buckets quickly, while also ensuring that all buckets will eventually trim -class BucketTrimManager : public BucketChangeObserver { +class BucketTrimManager : public BucketChangeObserver, public DoutPrefixProvider { class Impl; std::unique_ptr impl; public: @@ -86,6 +87,10 @@ class BucketTrimManager : public BucketChangeObserver { /// create a coroutine to trim buckets directly via radosgw-admin RGWCoroutine* create_admin_bucket_trim_cr(RGWHTTPManager *http); + + CephContext *get_cct() const override; + unsigned get_subsys() const; + std::ostream& gen_prefix(std::ostream& out) const; }; /// provides persistent storage for the trim manager's current position in the diff --git a/src/rgw/rgw_user.cc b/src/rgw/rgw_user.cc index 7e22b4dde5426..7cc2efe099043 100644 --- a/src/rgw/rgw_user.cc +++ b/src/rgw/rgw_user.cc @@ -48,7 +48,7 @@ void rgw_get_anon_user(RGWUserInfo& info) info.access_keys.clear(); } -int rgw_user_sync_all_stats(rgw::sal::RGWRadosStore *store, +int rgw_user_sync_all_stats(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, const rgw_user& user_id, optional_yield y) { rgw::sal::RGWBucketList user_buckets; @@ -60,7 +60,7 @@ int rgw_user_sync_all_stats(rgw::sal::RGWRadosStore *store, int ret; do { - ret = user.list_buckets(marker, string(), max_entries, false, user_buckets, y); + ret = user.list_buckets(dpp, marker, string(), max_entries, false, user_buckets, y); if (ret < 0) { ldout(cct, 0) << "failed to read user buckets: ret=" << ret << dendl; return ret; @@ -71,7 +71,7 @@ int rgw_user_sync_all_stats(rgw::sal::RGWRadosStore *store, auto& bucket = i->second; - ret = bucket->get_bucket_info(y); + ret = bucket->get_bucket_info(dpp, y); if (ret < 0) { ldout(cct, 0) << "ERROR: could not read bucket info: bucket=" << bucket << " ret=" << ret << dendl; continue; @@ -81,7 +81,7 @@ int rgw_user_sync_all_stats(rgw::sal::RGWRadosStore *store, ldout(cct, 0) << "ERROR: could not sync bucket stats: ret=" << ret << dendl; return ret; } - ret = bucket->check_bucket_shards(); + ret = bucket->check_bucket_shards(dpp); if (ret < 0) { ldout(cct, 0) << "ERROR in check_bucket_shards: " << cpp_strerror(-ret)<< dendl; } @@ -97,7 +97,8 @@ int rgw_user_sync_all_stats(rgw::sal::RGWRadosStore *store, return 0; } -int rgw_user_get_all_buckets_stats(rgw::sal::RGWRadosStore *store, +int rgw_user_get_all_buckets_stats(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, const rgw_user& user_id, map& buckets_usage_map, optional_yield y) @@ -110,7 +111,7 @@ int rgw_user_get_all_buckets_stats(rgw::sal::RGWRadosStore *store, do { rgw::sal::RGWBucketList buckets; - ret = rgw_read_user_buckets(store, user_id, buckets, marker, + ret = rgw_read_user_buckets(dpp, store, user_id, buckets, marker, string(), max_entries, false, y); if (ret < 0) { ldout(cct, 0) << "failed to read user buckets: ret=" << ret << dendl; @@ -121,7 +122,7 @@ int rgw_user_get_all_buckets_stats(rgw::sal::RGWRadosStore *store, marker = i.first; auto& bucket_ent = i.second; - ret = bucket_ent->read_bucket_stats(y); + ret = bucket_ent->read_bucket_stats(dpp, y); if (ret < 0) { ldout(cct, 0) << "ERROR: could not get bucket stats: ret=" << ret << dendl; return ret; @@ -140,7 +141,8 @@ int rgw_user_get_all_buckets_stats(rgw::sal::RGWRadosStore *store, * Save the given user information to storage. * Returns: 0 on success, -ERR# on failure. */ -int rgw_store_user_info(RGWUserCtl *user_ctl, +int rgw_store_user_info(const DoutPrefixProvider *dpp, + RGWUserCtl *user_ctl, RGWUserInfo& info, RGWUserInfo *old_info, RGWObjVersionTracker *objv_tracker, @@ -149,7 +151,7 @@ int rgw_store_user_info(RGWUserCtl *user_ctl, optional_yield y, map *pattrs) { - return user_ctl->store_info(info, y, + return user_ctl->store_info(dpp, info, y, RGWUserCtl::PutParams() .set_old_info(old_info) .set_objv_tracker(objv_tracker) @@ -162,7 +164,8 @@ int rgw_store_user_info(RGWUserCtl *user_ctl, * Given a uid, finds the user info associated with it. * returns: 0 on success, -ERR# on failure (including nonexistence) */ -int rgw_get_user_info_by_uid(RGWUserCtl *user_ctl, +int rgw_get_user_info_by_uid(const DoutPrefixProvider *dpp, + RGWUserCtl *user_ctl, const rgw_user& uid, RGWUserInfo& info, optional_yield y, @@ -171,7 +174,7 @@ int rgw_get_user_info_by_uid(RGWUserCtl *user_ctl, rgw_cache_entry_info * const cache_info, map * const pattrs) { - return user_ctl->get_info_by_uid(uid, &info, y, + return user_ctl->get_info_by_uid(dpp, uid, &info, y, RGWUserCtl::GetParams() .set_objv_tracker(objv_tracker) .set_mtime(pmtime) @@ -183,12 +186,13 @@ int rgw_get_user_info_by_uid(RGWUserCtl *user_ctl, * Given an email, finds the user info associated with it. * returns: 0 on success, -ERR# on failure (including nonexistence) */ -int rgw_get_user_info_by_email(RGWUserCtl *user_ctl, string& email, +int rgw_get_user_info_by_email(const DoutPrefixProvider *dpp, + RGWUserCtl *user_ctl, string& email, RGWUserInfo& info, optional_yield y, RGWObjVersionTracker *objv_tracker, real_time *pmtime) { - return user_ctl->get_info_by_email(email, &info, y, + return user_ctl->get_info_by_email(dpp, email, &info, y, RGWUserCtl::GetParams() .set_objv_tracker(objv_tracker) .set_mtime(pmtime)); @@ -198,14 +202,15 @@ int rgw_get_user_info_by_email(RGWUserCtl *user_ctl, string& email, * Given an swift username, finds the user_info associated with it. * returns: 0 on success, -ERR# on failure (including nonexistence) */ -int rgw_get_user_info_by_swift(RGWUserCtl *user_ctl, +int rgw_get_user_info_by_swift(const DoutPrefixProvider *dpp, + RGWUserCtl *user_ctl, const string& swift_name, RGWUserInfo& info, /* out */ optional_yield y, RGWObjVersionTracker * const objv_tracker, real_time * const pmtime) { - return user_ctl->get_info_by_swift(swift_name, &info, y, + return user_ctl->get_info_by_swift(dpp, swift_name, &info, y, RGWUserCtl::GetParams() .set_objv_tracker(objv_tracker) .set_mtime(pmtime)); @@ -215,14 +220,15 @@ int rgw_get_user_info_by_swift(RGWUserCtl *user_ctl, * Given an access key, finds the user info associated with it. * returns: 0 on success, -ERR# on failure (including nonexistence) */ -extern int rgw_get_user_info_by_access_key(RGWUserCtl *user_ctl, +extern int rgw_get_user_info_by_access_key(const DoutPrefixProvider *dpp, + RGWUserCtl *user_ctl, const std::string& access_key, RGWUserInfo& info, optional_yield y, RGWObjVersionTracker* objv_tracker, real_time *pmtime) { - return user_ctl->get_info_by_access_key(access_key, &info, y, + return user_ctl->get_info_by_access_key(dpp, access_key, &info, y, RGWUserCtl::GetParams() .set_objv_tracker(objv_tracker) .set_mtime(pmtime)); @@ -595,7 +601,7 @@ int RGWAccessKeyPool::check_op(RGWUserAdminOpState& op_state, } // Generate a new random key -int RGWAccessKeyPool::generate_key(RGWUserAdminOpState& op_state, +int RGWAccessKeyPool::generate_key(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) { std::string id; @@ -626,13 +632,13 @@ int RGWAccessKeyPool::generate_key(RGWUserAdminOpState& op_state, if (!id.empty()) { switch (key_type) { case KEY_TYPE_SWIFT: - if (rgw_get_user_info_by_swift(user_ctl, id, duplicate_check, y) >= 0) { + if (rgw_get_user_info_by_swift(dpp, user_ctl, id, duplicate_check, y) >= 0) { set_err_msg(err_msg, "existing swift key in RGW system:" + id); return -ERR_KEY_EXIST; } break; case KEY_TYPE_S3: - if (rgw_get_user_info_by_access_key(user_ctl, id, duplicate_check, y) >= 0) { + if (rgw_get_user_info_by_access_key(dpp, user_ctl, id, duplicate_check, y) >= 0) { set_err_msg(err_msg, "existing S3 key in RGW system:" + id); return -ERR_KEY_EXIST; } @@ -672,7 +678,7 @@ int RGWAccessKeyPool::generate_key(RGWUserAdminOpState& op_state, if (!validate_access_key(id)) continue; - } while (!rgw_get_user_info_by_access_key(user_ctl, id, duplicate_check, y)); + } while (!rgw_get_user_info_by_access_key(dpp, user_ctl, id, duplicate_check, y)); } if (key_type == KEY_TYPE_SWIFT) { @@ -683,7 +689,7 @@ int RGWAccessKeyPool::generate_key(RGWUserAdminOpState& op_state, } // check that the access key doesn't exist - if (rgw_get_user_info_by_swift(user_ctl, id, duplicate_check, y) >= 0) { + if (rgw_get_user_info_by_swift(dpp, user_ctl, id, duplicate_check, y) >= 0) { set_err_msg(err_msg, "cannot create existing swift key"); return -ERR_KEY_EXIST; } @@ -781,7 +787,8 @@ int RGWAccessKeyPool::modify_key(RGWUserAdminOpState& op_state, std::string *err return 0; } -int RGWAccessKeyPool::execute_add(RGWUserAdminOpState& op_state, +int RGWAccessKeyPool::execute_add(const DoutPrefixProvider *dpp, + RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update, optional_yield y) { @@ -796,7 +803,7 @@ int RGWAccessKeyPool::execute_add(RGWUserAdminOpState& op_state, switch (key_op) { case GENERATE_KEY: - ret = generate_key(op_state, y, &subprocess_msg); + ret = generate_key(dpp, op_state, y, &subprocess_msg); break; case MODIFY_KEY: ret = modify_key(op_state, &subprocess_msg); @@ -810,7 +817,7 @@ int RGWAccessKeyPool::execute_add(RGWUserAdminOpState& op_state, // store the updated info if (!defer_user_update) - ret = user->update(op_state, err_msg, y); + ret = user->update(dpp, op_state, err_msg, y); if (ret < 0) return ret; @@ -818,13 +825,15 @@ int RGWAccessKeyPool::execute_add(RGWUserAdminOpState& op_state, return 0; } -int RGWAccessKeyPool::add(RGWUserAdminOpState& op_state, optional_yield y, +int RGWAccessKeyPool::add(const DoutPrefixProvider *dpp, + RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) { - return add(op_state, err_msg, false, y); + return add(dpp, op_state, err_msg, false, y); } -int RGWAccessKeyPool::add(RGWUserAdminOpState& op_state, std::string *err_msg, +int RGWAccessKeyPool::add(const DoutPrefixProvider *dpp, + RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update, optional_yield y) { int ret; @@ -836,7 +845,7 @@ int RGWAccessKeyPool::add(RGWUserAdminOpState& op_state, std::string *err_msg, return ret; } - ret = execute_add(op_state, &subprocess_msg, defer_user_update, y); + ret = execute_add(dpp, op_state, &subprocess_msg, defer_user_update, y); if (ret < 0) { set_err_msg(err_msg, "unable to add access key, " + subprocess_msg); return ret; @@ -845,7 +854,8 @@ int RGWAccessKeyPool::add(RGWUserAdminOpState& op_state, std::string *err_msg, return 0; } -int RGWAccessKeyPool::execute_remove(RGWUserAdminOpState& op_state, +int RGWAccessKeyPool::execute_remove(const DoutPrefixProvider *dpp, + RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update, optional_yield y) @@ -881,7 +891,7 @@ int RGWAccessKeyPool::execute_remove(RGWUserAdminOpState& op_state, keys_map->erase(kiter); if (!defer_user_update) - ret = user->update(op_state, err_msg, y); + ret = user->update(dpp, op_state, err_msg, y); if (ret < 0) return ret; @@ -889,13 +899,14 @@ int RGWAccessKeyPool::execute_remove(RGWUserAdminOpState& op_state, return 0; } -int RGWAccessKeyPool::remove(RGWUserAdminOpState& op_state, optional_yield y, +int RGWAccessKeyPool::remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) { - return remove(op_state, err_msg, false, y); + return remove(dpp, op_state, err_msg, false, y); } -int RGWAccessKeyPool::remove(RGWUserAdminOpState& op_state, +int RGWAccessKeyPool::remove(const DoutPrefixProvider *dpp, + RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update, optional_yield y) { @@ -909,7 +920,7 @@ int RGWAccessKeyPool::remove(RGWUserAdminOpState& op_state, return ret; } - ret = execute_remove(op_state, &subprocess_msg, defer_user_update, y); + ret = execute_remove(dpp, op_state, &subprocess_msg, defer_user_update, y); if (ret < 0) { set_err_msg(err_msg, "unable to remove access key, " + subprocess_msg); return ret; @@ -919,7 +930,8 @@ int RGWAccessKeyPool::remove(RGWUserAdminOpState& op_state, } // remove all keys associated with a subuser -int RGWAccessKeyPool::remove_subuser_keys(RGWUserAdminOpState& op_state, +int RGWAccessKeyPool::remove_subuser_keys(const DoutPrefixProvider *dpp, + RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update, optional_yield y) @@ -967,7 +979,7 @@ int RGWAccessKeyPool::remove_subuser_keys(RGWUserAdminOpState& op_state, } if (!defer_user_update) - ret = user->update(op_state, err_msg, y); + ret = user->update(dpp, op_state, err_msg, y); if (ret < 0) return ret; @@ -1067,7 +1079,8 @@ int RGWSubUserPool::check_op(RGWUserAdminOpState& op_state, return 0; } -int RGWSubUserPool::execute_add(RGWUserAdminOpState& op_state, +int RGWSubUserPool::execute_add(const DoutPrefixProvider *dpp, + RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update, optional_yield y) { @@ -1082,7 +1095,7 @@ int RGWSubUserPool::execute_add(RGWUserAdminOpState& op_state, // assumes key should be created if (op_state.has_key_op()) { - ret = user->keys.add(op_state, &subprocess_msg, true, y); + ret = user->keys.add(dpp, op_state, &subprocess_msg, true, y); if (ret < 0) { set_err_msg(err_msg, "unable to create subuser key, " + subprocess_msg); return ret; @@ -1101,7 +1114,7 @@ int RGWSubUserPool::execute_add(RGWUserAdminOpState& op_state, // attempt to save the subuser if (!defer_user_update) - ret = user->update(op_state, err_msg, y); + ret = user->update(dpp, op_state, err_msg, y); if (ret < 0) return ret; @@ -1109,13 +1122,13 @@ int RGWSubUserPool::execute_add(RGWUserAdminOpState& op_state, return 0; } -int RGWSubUserPool::add(RGWUserAdminOpState& op_state, optional_yield y, +int RGWSubUserPool::add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) { - return add(op_state, err_msg, false, y); + return add(dpp, op_state, err_msg, false, y); } -int RGWSubUserPool::add(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update, optional_yield y) +int RGWSubUserPool::add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update, optional_yield y) { std::string subprocess_msg; int ret; @@ -1135,7 +1148,7 @@ int RGWSubUserPool::add(RGWUserAdminOpState& op_state, std::string *err_msg, boo op_state.set_gen_secret(); } - ret = execute_add(op_state, &subprocess_msg, defer_user_update, y); + ret = execute_add(dpp, op_state, &subprocess_msg, defer_user_update, y); if (ret < 0) { set_err_msg(err_msg, "unable to create subuser, " + subprocess_msg); return ret; @@ -1144,7 +1157,8 @@ int RGWSubUserPool::add(RGWUserAdminOpState& op_state, std::string *err_msg, boo return 0; } -int RGWSubUserPool::execute_remove(RGWUserAdminOpState& op_state, +int RGWSubUserPool::execute_remove(const DoutPrefixProvider *dpp, + RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update, optional_yield y) { @@ -1165,14 +1179,14 @@ int RGWSubUserPool::execute_remove(RGWUserAdminOpState& op_state, } // always purge all associate keys - user->keys.remove_subuser_keys(op_state, &subprocess_msg, true, y); + user->keys.remove_subuser_keys(dpp, op_state, &subprocess_msg, true, y); // remove the subuser from the user info subuser_map->erase(siter); // attempt to save the subuser if (!defer_user_update) - ret = user->update(op_state, err_msg, y); + ret = user->update(dpp, op_state, err_msg, y); if (ret < 0) return ret; @@ -1180,13 +1194,13 @@ int RGWSubUserPool::execute_remove(RGWUserAdminOpState& op_state, return 0; } -int RGWSubUserPool::remove(RGWUserAdminOpState& op_state, optional_yield y, +int RGWSubUserPool::remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) { - return remove(op_state, err_msg, false, y); + return remove(dpp, op_state, err_msg, false, y); } -int RGWSubUserPool::remove(RGWUserAdminOpState& op_state, std::string *err_msg, +int RGWSubUserPool::remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update, optional_yield y) { std::string subprocess_msg; @@ -1198,7 +1212,7 @@ int RGWSubUserPool::remove(RGWUserAdminOpState& op_state, std::string *err_msg, return ret; } - ret = execute_remove(op_state, &subprocess_msg, defer_user_update, y); + ret = execute_remove(dpp, op_state, &subprocess_msg, defer_user_update, y); if (ret < 0) { set_err_msg(err_msg, "unable to remove subuser, " + subprocess_msg); return ret; @@ -1207,7 +1221,7 @@ int RGWSubUserPool::remove(RGWUserAdminOpState& op_state, std::string *err_msg, return 0; } -int RGWSubUserPool::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update, optional_yield y) +int RGWSubUserPool::execute_modify(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update, optional_yield y) { int ret = 0; std::string subprocess_msg; @@ -1228,7 +1242,7 @@ int RGWSubUserPool::execute_modify(RGWUserAdminOpState& op_state, std::string *e subuser = siter->second; if (op_state.has_key_op()) { - ret = user->keys.add(op_state, &subprocess_msg, true, y); + ret = user->keys.add(dpp, op_state, &subprocess_msg, true, y); if (ret < 0) { set_err_msg(err_msg, "unable to create subuser keys, " + subprocess_msg); return ret; @@ -1245,7 +1259,7 @@ int RGWSubUserPool::execute_modify(RGWUserAdminOpState& op_state, std::string *e // attempt to save the subuser if (!defer_user_update) - ret = user->update(op_state, err_msg, y); + ret = user->update(dpp, op_state, err_msg, y); if (ret < 0) return ret; @@ -1253,12 +1267,12 @@ int RGWSubUserPool::execute_modify(RGWUserAdminOpState& op_state, std::string *e return 0; } -int RGWSubUserPool::modify(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) +int RGWSubUserPool::modify(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) { - return RGWSubUserPool::modify(op_state, y, err_msg, false); + return RGWSubUserPool::modify(dpp, op_state, y, err_msg, false); } -int RGWSubUserPool::modify(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg, bool defer_user_update) +int RGWSubUserPool::modify(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg, bool defer_user_update) { std::string subprocess_msg; int ret; @@ -1271,7 +1285,7 @@ int RGWSubUserPool::modify(RGWUserAdminOpState& op_state, optional_yield y, std: return ret; } - ret = execute_modify(op_state, &subprocess_msg, defer_user_update, y); + ret = execute_modify(dpp, op_state, &subprocess_msg, defer_user_update, y); if (ret < 0) { set_err_msg(err_msg, "unable to modify subuser, " + subprocess_msg); return ret; @@ -1313,13 +1327,13 @@ int RGWUserCapPool::init(RGWUserAdminOpState& op_state) return 0; } -int RGWUserCapPool::add(RGWUserAdminOpState& op_state, optional_yield y, +int RGWUserCapPool::add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) { - return add(op_state, err_msg, false, y); + return add(dpp, op_state, err_msg, false, y); } -int RGWUserCapPool::add(RGWUserAdminOpState& op_state, std::string *err_msg, +int RGWUserCapPool::add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y) { int ret = 0; @@ -1347,7 +1361,7 @@ int RGWUserCapPool::add(RGWUserAdminOpState& op_state, std::string *err_msg, } if (!defer_save) - ret = user->update(op_state, err_msg, y); + ret = user->update(dpp, op_state, err_msg, y); if (ret < 0) return ret; @@ -1355,13 +1369,13 @@ int RGWUserCapPool::add(RGWUserAdminOpState& op_state, std::string *err_msg, return 0; } -int RGWUserCapPool::remove(RGWUserAdminOpState& op_state, optional_yield y, +int RGWUserCapPool::remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) { - return remove(op_state, err_msg, false, y); + return remove(dpp, op_state, err_msg, false, y); } -int RGWUserCapPool::remove(RGWUserAdminOpState& op_state, std::string *err_msg, +int RGWUserCapPool::remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y) { int ret = 0; @@ -1390,7 +1404,7 @@ int RGWUserCapPool::remove(RGWUserAdminOpState& op_state, std::string *err_msg, } if (!defer_save) - ret = user->update(op_state, err_msg, y); + ret = user->update(dpp, op_state, err_msg, y); if (ret < 0) return ret; @@ -1403,7 +1417,7 @@ RGWUser::RGWUser() : caps(this), keys(this), subusers(this) init_default(); } -int RGWUser::init(rgw::sal::RGWRadosStore *storage, +int RGWUser::init(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *storage, RGWUserAdminOpState& op_state, optional_yield y) { init_default(); @@ -1411,7 +1425,7 @@ int RGWUser::init(rgw::sal::RGWRadosStore *storage, if (ret < 0) return ret; - ret = init(op_state, y); + ret = init(dpp, op_state, y); if (ret < 0) return ret; @@ -1446,7 +1460,7 @@ int RGWUser::init_storage(rgw::sal::RGWRadosStore *storage) return 0; } -int RGWUser::init(RGWUserAdminOpState& op_state, optional_yield y) +int RGWUser::init(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y) { bool found = false; std::string swift_user; @@ -1474,21 +1488,21 @@ int RGWUser::init(RGWUserAdminOpState& op_state, optional_yield y) } if (!user_id.empty() && (user_id.compare(RGW_USER_ANON_ID) != 0)) { - found = (rgw_get_user_info_by_uid(user_ctl, user_id, user_info, y, &op_state.objv) >= 0); + found = (rgw_get_user_info_by_uid(dpp, user_ctl, user_id, user_info, y, &op_state.objv) >= 0); op_state.found_by_uid = found; } if (store->ctx()->_conf.get_val("rgw_user_unique_email")) { if (!user_email.empty() && !found) { - found = (rgw_get_user_info_by_email(user_ctl, user_email, user_info, y, &op_state.objv) >= 0); + found = (rgw_get_user_info_by_email(dpp, user_ctl, user_email, user_info, y, &op_state.objv) >= 0); op_state.found_by_email = found; } } if (!swift_user.empty() && !found) { - found = (rgw_get_user_info_by_swift(user_ctl, swift_user, user_info, y, &op_state.objv) >= 0); + found = (rgw_get_user_info_by_swift(dpp, user_ctl, swift_user, user_info, y, &op_state.objv) >= 0); op_state.found_by_key = found; } if (!access_key.empty() && !found) { - found = (rgw_get_user_info_by_access_key(user_ctl, access_key, user_info, y, &op_state.objv) >= 0); + found = (rgw_get_user_info_by_access_key(dpp, user_ctl, access_key, user_info, y, &op_state.objv) >= 0); op_state.found_by_key = found; } @@ -1533,7 +1547,7 @@ int RGWUser::init_members(RGWUserAdminOpState& op_state) return 0; } -int RGWUser::update(RGWUserAdminOpState& op_state, std::string *err_msg, +int RGWUser::update(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y) { int ret; @@ -1547,7 +1561,7 @@ int RGWUser::update(RGWUserAdminOpState& op_state, std::string *err_msg, RGWUserInfo *pold_info = (is_populated() ? &old_info : nullptr); - ret = rgw_store_user_info(user_ctl, user_info, pold_info, &op_state.objv, + ret = rgw_store_user_info(dpp, user_ctl, user_info, pold_info, &op_state.objv, real_time(), false, y); if (ret < 0) { set_err_msg(err_msg, "unable to store user info"); @@ -1614,7 +1628,7 @@ static void rename_swift_keys(const rgw_user& user, } } -int RGWUser::execute_rename(RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y) +int RGWUser::execute_rename(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y) { int ret; bool populated = op_state.is_populated(); @@ -1625,7 +1639,7 @@ int RGWUser::execute_rename(RGWUserAdminOpState& op_state, std::string *err_msg, } if (!populated) { - ret = init(op_state, y); + ret = init(dpp, op_state, y); if (ret < 0) { set_err_msg(err_msg, "unable to retrieve user info"); return ret; @@ -1647,7 +1661,7 @@ int RGWUser::execute_rename(RGWUserAdminOpState& op_state, std::string *err_msg, RGWObjVersionTracker objv; const bool exclusive = !op_state.get_overwrite_new_user(); // overwrite if requested - ret = user_ctl->store_info(stub_user_info, y, + ret = user_ctl->store_info(dpp, stub_user_info, y, RGWUserCtl::PutParams() .set_objv_tracker(&objv) .set_exclusive(exclusive)); @@ -1670,7 +1684,7 @@ int RGWUser::execute_rename(RGWUserAdminOpState& op_state, std::string *err_msg, rgw::sal::RGWBucketList buckets; do { - ret = old_user.list_buckets(marker, "", max_buckets, false, buckets, y); + ret = old_user.list_buckets(dpp, marker, "", max_buckets, false, buckets, y); if (ret < 0) { set_err_msg(err_msg, "unable to list user buckets"); return ret; @@ -1682,25 +1696,25 @@ int RGWUser::execute_rename(RGWUserAdminOpState& op_state, std::string *err_msg, auto& bucket = it->second; marker = it->first; - ret = bucket->get_bucket_info(y); + ret = bucket->get_bucket_info(dpp, y); if (ret < 0) { set_err_msg(err_msg, "failed to fetch bucket info for bucket=" + bucket->get_name()); return ret; } - ret = bucket->set_acl(policy_instance, y); + ret = bucket->set_acl(dpp, policy_instance, y); if (ret < 0) { set_err_msg(err_msg, "failed to set acl on bucket " + bucket->get_name()); return ret; } - ret = bucket->link(&new_user, y); + ret = bucket->link(dpp, &new_user, y); if (ret < 0) { set_err_msg(err_msg, "failed to link bucket " + bucket->get_name()); return ret; } - ret = bucket->chown(&new_user, &old_user, y); + ret = bucket->chown(&new_user, &old_user, y, dpp); if (ret < 0) { set_err_msg(err_msg, "failed to run bucket chown" + cpp_strerror(-ret)); return ret; @@ -1717,10 +1731,10 @@ int RGWUser::execute_rename(RGWUserAdminOpState& op_state, std::string *err_msg, rename_swift_keys(new_user.get_user(), user_info.swift_keys); - return update(op_state, err_msg, y); + return update(dpp, op_state, err_msg, y); } -int RGWUser::execute_add(RGWUserAdminOpState& op_state, std::string *err_msg, +int RGWUser::execute_add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y) { std::string subprocess_msg; @@ -1827,7 +1841,7 @@ int RGWUser::execute_add(RGWUserAdminOpState& op_state, std::string *err_msg, // see if we need to add an access key if (op_state.has_key_op()) { - ret = keys.add(op_state, &subprocess_msg, defer_user_update, y); + ret = keys.add(dpp, op_state, &subprocess_msg, defer_user_update, y); if (ret < 0) { set_err_msg(err_msg, "unable to create access key, " + subprocess_msg); return ret; @@ -1836,14 +1850,14 @@ int RGWUser::execute_add(RGWUserAdminOpState& op_state, std::string *err_msg, // see if we need to add some caps if (op_state.has_caps_op()) { - ret = caps.add(op_state, &subprocess_msg, defer_user_update, y); + ret = caps.add(dpp, op_state, &subprocess_msg, defer_user_update, y); if (ret < 0) { set_err_msg(err_msg, "unable to add user capabilities, " + subprocess_msg); return ret; } } - ret = update(op_state, err_msg, y); + ret = update(dpp, op_state, err_msg, y); if (ret < 0) return ret; @@ -1851,7 +1865,7 @@ int RGWUser::execute_add(RGWUserAdminOpState& op_state, std::string *err_msg, } -int RGWUser::add(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) +int RGWUser::add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) { std::string subprocess_msg; int ret; @@ -1862,7 +1876,7 @@ int RGWUser::add(RGWUserAdminOpState& op_state, optional_yield y, std::string *e return ret; } - ret = execute_add(op_state, &subprocess_msg, y); + ret = execute_add(dpp, op_state, &subprocess_msg, y); if (ret < 0) { set_err_msg(err_msg, "unable to create user, " + subprocess_msg); return ret; @@ -1871,7 +1885,7 @@ int RGWUser::add(RGWUserAdminOpState& op_state, optional_yield y, std::string *e return 0; } -int RGWUser::rename(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) +int RGWUser::rename(RGWUserAdminOpState& op_state, optional_yield y, const DoutPrefixProvider *dpp, std::string *err_msg) { std::string subprocess_msg; int ret; @@ -1882,7 +1896,7 @@ int RGWUser::rename(RGWUserAdminOpState& op_state, optional_yield y, std::string return ret; } - ret = execute_rename(op_state, &subprocess_msg, y); + ret = execute_rename(dpp, op_state, &subprocess_msg, y); if (ret < 0) { set_err_msg(err_msg, "unable to rename user, " + subprocess_msg); return ret; @@ -1891,7 +1905,7 @@ int RGWUser::rename(RGWUserAdminOpState& op_state, optional_yield y, std::string return 0; } -int RGWUser::execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y) +int RGWUser::execute_remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y) { int ret; @@ -1909,7 +1923,7 @@ int RGWUser::execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg, CephContext *cct = store->ctx(); size_t max_buckets = cct->_conf->rgw_list_buckets_max_chunk; do { - ret = rgw_read_user_buckets(store, uid, buckets, marker, string(), + ret = rgw_read_user_buckets(dpp, store, uid, buckets, marker, string(), max_buckets, false, y); if (ret < 0) { set_err_msg(err_msg, "unable to read user bucket info"); @@ -1924,7 +1938,7 @@ int RGWUser::execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg, std::string prefix, delimiter; for (auto it = m.begin(); it != m.end(); ++it) { - ret = it->second->remove_bucket(true, prefix, delimiter, false, nullptr, y); + ret = it->second->remove_bucket(dpp, true, prefix, delimiter, false, nullptr, y); if (ret < 0) { set_err_msg(err_msg, "unable to delete user data"); return ret; @@ -1935,7 +1949,7 @@ int RGWUser::execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg, } while (buckets.is_truncated()); - ret = user_ctl->remove_info(user_info, y, RGWUserCtl::RemoveParams() + ret = user_ctl->remove_info(dpp, user_info, y, RGWUserCtl::RemoveParams() .set_objv_tracker(&op_state.objv)); if (ret < 0) { set_err_msg(err_msg, "unable to remove user from RADOS"); @@ -1948,7 +1962,7 @@ int RGWUser::execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg, return 0; } -int RGWUser::remove(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) +int RGWUser::remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) { std::string subprocess_msg; int ret; @@ -1959,7 +1973,7 @@ int RGWUser::remove(RGWUserAdminOpState& op_state, optional_yield y, std::string return ret; } - ret = execute_remove(op_state, &subprocess_msg, y); + ret = execute_remove(dpp, op_state, &subprocess_msg, y); if (ret < 0) { set_err_msg(err_msg, "unable to remove user, " + subprocess_msg); return ret; @@ -1968,7 +1982,7 @@ int RGWUser::remove(RGWUserAdminOpState& op_state, optional_yield y, std::string return 0; } -int RGWUser::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y) +int RGWUser::execute_modify(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y) { bool populated = op_state.is_populated(); int ret = 0; @@ -1987,7 +2001,7 @@ int RGWUser::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg, // if the user hasn't already been populated...attempt to if (!populated) { - ret = init(op_state, y); + ret = init(dpp, op_state, y); if (ret < 0) { set_err_msg(err_msg, "unable to retrieve user info"); return ret; @@ -2006,7 +2020,7 @@ int RGWUser::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg, if (!op_email.empty()) { // make sure we are not adding a duplicate email if (old_email != op_email) { - ret = rgw_get_user_info_by_email(user_ctl, op_email, duplicate_check,y ); + ret = rgw_get_user_info_by_email(dpp, user_ctl, op_email, duplicate_check,y ); if (ret >= 0 && duplicate_check.user_id.compare(user_id) != 0) { set_err_msg(err_msg, "cannot add duplicate email"); return -ERR_EMAIL_EXIST; @@ -2064,7 +2078,7 @@ int RGWUser::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg, CephContext *cct = store->ctx(); size_t max_buckets = cct->_conf->rgw_list_buckets_max_chunk; do { - ret = rgw_read_user_buckets(store, user_id, buckets, marker, string(), + ret = rgw_read_user_buckets(dpp, store, user_id, buckets, marker, string(), max_buckets, false, y); if (ret < 0) { set_err_msg(err_msg, "could not get buckets for uid: " + user_id.to_str()); @@ -2081,7 +2095,7 @@ int RGWUser::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg, marker = iter->first; } - ret = store->getRados()->set_buckets_enabled(bucket_names, !suspended); + ret = store->getRados()->set_buckets_enabled(bucket_names, !suspended, dpp); if (ret < 0) { set_err_msg(err_msg, "failed to modify bucket"); return ret; @@ -2106,21 +2120,21 @@ int RGWUser::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg, // if we're supposed to modify keys, do so if (op_state.has_key_op()) { - ret = keys.add(op_state, &subprocess_msg, true, y); + ret = keys.add(dpp, op_state, &subprocess_msg, true, y); if (ret < 0) { set_err_msg(err_msg, "unable to create or modify keys, " + subprocess_msg); return ret; } } - ret = update(op_state, err_msg, y); + ret = update(dpp, op_state, err_msg, y); if (ret < 0) return ret; return 0; } -int RGWUser::modify(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) +int RGWUser::modify(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg) { std::string subprocess_msg; int ret; @@ -2131,7 +2145,7 @@ int RGWUser::modify(RGWUserAdminOpState& op_state, optional_yield y, std::string return ret; } - ret = execute_modify(op_state, &subprocess_msg, y); + ret = execute_modify(dpp, op_state, &subprocess_msg, y); if (ret < 0) { set_err_msg(err_msg, "unable to modify user, " + subprocess_msg); return ret; @@ -2140,10 +2154,10 @@ int RGWUser::modify(RGWUserAdminOpState& op_state, optional_yield y, std::string return 0; } -int RGWUser::info(RGWUserAdminOpState& op_state, RGWUserInfo& fetched_info, +int RGWUser::info(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, RGWUserInfo& fetched_info, optional_yield y, std::string *err_msg) { - int ret = init(op_state, y); + int ret = init(dpp, op_state, y); if (ret < 0) { set_err_msg(err_msg, "unable to fetch user info"); return ret; @@ -2239,14 +2253,15 @@ int RGWUserAdminOp_User::list(rgw::sal::RGWRadosStore *store, RGWUserAdminOpStat return 0; } -int RGWUserAdminOp_User::info(rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, +int RGWUserAdminOp_User::info(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y) { RGWUserInfo info; RGWUser user; - int ret = user.init(store, op_state, y); + int ret = user.init(dpp, store, op_state, y); if (ret < 0) return ret; @@ -2260,7 +2275,7 @@ int RGWUserAdminOp_User::info(rgw::sal::RGWRadosStore *store, RGWUserAdminOpStat return ret; if (op_state.sync_stats) { - ret = rgw_user_sync_all_stats(store, info.user_id, y); + ret = rgw_user_sync_all_stats(dpp, store, info.user_id, y); if (ret < 0) { return ret; } @@ -2287,19 +2302,20 @@ int RGWUserAdminOp_User::info(rgw::sal::RGWRadosStore *store, RGWUserAdminOpStat return 0; } -int RGWUserAdminOp_User::create(rgw::sal::RGWRadosStore *store, +int RGWUserAdminOp_User::create(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y) { RGWUserInfo info; RGWUser user; - int ret = user.init(store, op_state, y); + int ret = user.init(dpp, store, op_state, y); if (ret < 0) return ret; Formatter *formatter = flusher.get_formatter(); - ret = user.add(op_state, y, NULL); + ret = user.add(dpp, op_state, y, NULL); if (ret < 0) { if (ret == -EEXIST) ret = -ERR_USER_EXIST; @@ -2320,18 +2336,19 @@ int RGWUserAdminOp_User::create(rgw::sal::RGWRadosStore *store, return 0; } -int RGWUserAdminOp_User::modify(rgw::sal::RGWRadosStore *store, +int RGWUserAdminOp_User::modify(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y) { RGWUserInfo info; RGWUser user; - int ret = user.init(store, op_state, y); + int ret = user.init(dpp, store, op_state, y); if (ret < 0) return ret; Formatter *formatter = flusher.get_formatter(); - ret = user.modify(op_state, y, NULL); + ret = user.modify(dpp, op_state, y, NULL); if (ret < 0) { if (ret == -ENOENT) ret = -ERR_NO_SUCH_USER; @@ -2352,31 +2369,32 @@ int RGWUserAdminOp_User::modify(rgw::sal::RGWRadosStore *store, return 0; } -int RGWUserAdminOp_User::remove(rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, +int RGWUserAdminOp_User::remove(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y) { RGWUserInfo info; RGWUser user; - int ret = user.init(store, op_state, y); + int ret = user.init(dpp, store, op_state, y); if (ret < 0) return ret; - ret = user.remove(op_state, y, NULL); + ret = user.remove(dpp, op_state, y, NULL); if (ret == -ENOENT) ret = -ERR_NO_SUCH_USER; return ret; } -int RGWUserAdminOp_Subuser::create(rgw::sal::RGWRadosStore *store, +int RGWUserAdminOp_Subuser::create(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y) { RGWUserInfo info; RGWUser user; - int ret = user.init(store, op_state, y); + int ret = user.init(dpp, store, op_state, y); if (ret < 0) return ret; @@ -2385,7 +2403,7 @@ int RGWUserAdminOp_Subuser::create(rgw::sal::RGWRadosStore *store, Formatter *formatter = flusher.get_formatter(); - ret = user.subusers.add(op_state, y, NULL); + ret = user.subusers.add(dpp, op_state, y, NULL); if (ret < 0) return ret; @@ -2403,12 +2421,13 @@ int RGWUserAdminOp_Subuser::create(rgw::sal::RGWRadosStore *store, return 0; } -int RGWUserAdminOp_Subuser::modify(rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, +int RGWUserAdminOp_Subuser::modify(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y) { RGWUserInfo info; RGWUser user; - int ret = user.init(store, op_state, y); + int ret = user.init(dpp, store, op_state, y); if (ret < 0) return ret; @@ -2417,7 +2436,7 @@ int RGWUserAdminOp_Subuser::modify(rgw::sal::RGWRadosStore *store, RGWUserAdminO Formatter *formatter = flusher.get_formatter(); - ret = user.subusers.modify(op_state, y, NULL); + ret = user.subusers.modify(dpp, op_state, y, NULL); if (ret < 0) return ret; @@ -2435,14 +2454,15 @@ int RGWUserAdminOp_Subuser::modify(rgw::sal::RGWRadosStore *store, RGWUserAdminO return 0; } -int RGWUserAdminOp_Subuser::remove(rgw::sal::RGWRadosStore *store, +int RGWUserAdminOp_Subuser::remove(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y) { RGWUserInfo info; RGWUser user; - int ret = user.init(store, op_state, y); + int ret = user.init(dpp, store, op_state, y); if (ret < 0) return ret; @@ -2450,20 +2470,21 @@ int RGWUserAdminOp_Subuser::remove(rgw::sal::RGWRadosStore *store, if (!op_state.has_existing_user()) return -ERR_NO_SUCH_USER; - ret = user.subusers.remove(op_state, y, NULL); + ret = user.subusers.remove(dpp, op_state, y, NULL); if (ret < 0) return ret; return 0; } -int RGWUserAdminOp_Key::create(rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, +int RGWUserAdminOp_Key::create(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y) { RGWUserInfo info; RGWUser user; - int ret = user.init(store, op_state, y); + int ret = user.init(dpp, store, op_state, y); if (ret < 0) return ret; @@ -2472,7 +2493,7 @@ int RGWUserAdminOp_Key::create(rgw::sal::RGWRadosStore *store, RGWUserAdminOpSta Formatter *formatter = flusher.get_formatter(); - ret = user.keys.add(op_state, y, NULL); + ret = user.keys.add(dpp, op_state, y, NULL); if (ret < 0) return ret; @@ -2497,14 +2518,15 @@ int RGWUserAdminOp_Key::create(rgw::sal::RGWRadosStore *store, RGWUserAdminOpSta return 0; } -int RGWUserAdminOp_Key::remove(rgw::sal::RGWRadosStore *store, +int RGWUserAdminOp_Key::remove(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y) { RGWUserInfo info; RGWUser user; - int ret = user.init(store, op_state, y); + int ret = user.init(dpp, store, op_state, y); if (ret < 0) return ret; @@ -2512,20 +2534,21 @@ int RGWUserAdminOp_Key::remove(rgw::sal::RGWRadosStore *store, return -ERR_NO_SUCH_USER; - ret = user.keys.remove(op_state, y, NULL); + ret = user.keys.remove(dpp, op_state, y, NULL); if (ret < 0) return ret; return 0; } -int RGWUserAdminOp_Caps::add(rgw::sal::RGWRadosStore *store, +int RGWUserAdminOp_Caps::add(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y) { RGWUserInfo info; RGWUser user; - int ret = user.init(store, op_state, y); + int ret = user.init(dpp, store, op_state, y); if (ret < 0) return ret; @@ -2534,7 +2557,7 @@ int RGWUserAdminOp_Caps::add(rgw::sal::RGWRadosStore *store, Formatter *formatter = flusher.get_formatter(); - ret = user.caps.add(op_state, y, NULL); + ret = user.caps.add(dpp, op_state, y, NULL); if (ret < 0) return ret; @@ -2553,13 +2576,14 @@ int RGWUserAdminOp_Caps::add(rgw::sal::RGWRadosStore *store, } -int RGWUserAdminOp_Caps::remove(rgw::sal::RGWRadosStore *store, +int RGWUserAdminOp_Caps::remove(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y) { RGWUserInfo info; RGWUser user; - int ret = user.init(store, op_state, y); + int ret = user.init(dpp, store, op_state, y); if (ret < 0) return ret; @@ -2568,7 +2592,7 @@ int RGWUserAdminOp_Caps::remove(rgw::sal::RGWRadosStore *store, Formatter *formatter = flusher.get_formatter(); - ret = user.caps.remove(op_state, y, NULL); + ret = user.caps.remove(dpp, op_state, y, NULL); if (ret < 0) return ret; @@ -2599,7 +2623,7 @@ public: string get_type() override { return "user"; } - int do_get(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject **obj, optional_yield y) override { + int do_get(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject **obj, optional_yield y, const DoutPrefixProvider *dpp) override { RGWUserCompleteInfo uci; RGWObjVersionTracker objv_tracker; real_time mtime; @@ -2608,7 +2632,7 @@ public: int ret = svc.user->read_user_info(op->ctx(), user, &uci.info, &objv_tracker, &mtime, nullptr, &uci.attrs, - y); + y, dpp); if (ret < 0) { return ret; } @@ -2634,24 +2658,24 @@ public: int do_put(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject *obj, RGWObjVersionTracker& objv_tracker, - optional_yield y, + optional_yield y, const DoutPrefixProvider *dpp, RGWMDLogSyncType type, bool from_remote_zone) override; int do_remove(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWObjVersionTracker& objv_tracker, - optional_yield y) override { + optional_yield y, const DoutPrefixProvider *dpp) override { RGWUserInfo info; rgw_user user = RGWSI_User::user_from_meta_key(entry); int ret = svc.user->read_user_info(op->ctx(), user, &info, nullptr, nullptr, nullptr, nullptr, - y); + y, dpp); if (ret < 0) { return ret; } return svc.user->remove_user_info(op->ctx(), info, &objv_tracker, - y); + y, dpp); } }; @@ -2669,20 +2693,20 @@ public: uobj = static_cast(obj); } - int put_checked() override; + int put_checked(const DoutPrefixProvider *dpp) override; }; int RGWUserMetadataHandler::do_put(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWMetadataObject *obj, RGWObjVersionTracker& objv_tracker, - optional_yield y, + optional_yield y, const DoutPrefixProvider *dpp, RGWMDLogSyncType type, bool from_remote_zone) { RGWMetadataHandlerPut_User put_op(this, op, entry, obj, objv_tracker, y, type, from_remote_zone); - return do_put_operate(&put_op); + return do_put_operate(&put_op, dpp); } -int RGWMetadataHandlerPut_User::put_checked() +int RGWMetadataHandlerPut_User::put_checked(const DoutPrefixProvider *dpp) { RGWUserMetadataObject *orig_obj = static_cast(old_obj); RGWUserCompleteInfo& uci = uobj->get_uci(); @@ -2698,7 +2722,7 @@ int RGWMetadataHandlerPut_User::put_checked() int ret = uhandler->svc.user->store_user_info(op->ctx(), uci.info, pold_info, &objv_tracker, mtime, - false, pattrs, y); + false, pattrs, y, dpp); if (ret < 0) { return ret; } @@ -2740,7 +2764,8 @@ public: } }; -int RGWUserCtl::get_info_by_uid(const rgw_user& uid, +int RGWUserCtl::get_info_by_uid(const DoutPrefixProvider *dpp, + const rgw_user& uid, RGWUserInfo *info, optional_yield y, const GetParams& params) @@ -2754,11 +2779,13 @@ int RGWUserCtl::get_info_by_uid(const rgw_user& uid, params.mtime, params.cache_info, params.attrs, - y); + y, + dpp); }); } -int RGWUserCtl::get_info_by_email(const string& email, +int RGWUserCtl::get_info_by_email(const DoutPrefixProvider *dpp, + const string& email, RGWUserInfo *info, optional_yield y, const GetParams& params) @@ -2768,11 +2795,13 @@ int RGWUserCtl::get_info_by_email(const string& email, info, params.objv_tracker, params.mtime, - y); + y, + dpp); }); } -int RGWUserCtl::get_info_by_swift(const string& swift_name, +int RGWUserCtl::get_info_by_swift(const DoutPrefixProvider *dpp, + const string& swift_name, RGWUserInfo *info, optional_yield y, const GetParams& params) @@ -2782,11 +2811,13 @@ int RGWUserCtl::get_info_by_swift(const string& swift_name, info, params.objv_tracker, params.mtime, - y); + y, + dpp); }); } -int RGWUserCtl::get_info_by_access_key(const string& access_key, +int RGWUserCtl::get_info_by_access_key(const DoutPrefixProvider *dpp, + const string& access_key, RGWUserInfo *info, optional_yield y, const GetParams& params) @@ -2796,23 +2827,26 @@ int RGWUserCtl::get_info_by_access_key(const string& access_key, info, params.objv_tracker, params.mtime, - y); + y, + dpp); }); } -int RGWUserCtl::get_attrs_by_uid(const rgw_user& user_id, +int RGWUserCtl::get_attrs_by_uid(const DoutPrefixProvider *dpp, + const rgw_user& user_id, map *pattrs, optional_yield y, RGWObjVersionTracker *objv_tracker) { RGWUserInfo user_info; - return get_info_by_uid(user_id, &user_info, y, RGWUserCtl::GetParams() + return get_info_by_uid(dpp, user_id, &user_info, y, RGWUserCtl::GetParams() .set_attrs(pattrs) .set_objv_tracker(objv_tracker)); } -int RGWUserCtl::store_info(const RGWUserInfo& info, optional_yield y, +int RGWUserCtl::store_info(const DoutPrefixProvider *dpp, + const RGWUserInfo& info, optional_yield y, const PutParams& params) { string key = RGWSI_User::get_meta_key(info.user_id); @@ -2824,11 +2858,13 @@ int RGWUserCtl::store_info(const RGWUserInfo& info, optional_yield y, params.mtime, params.exclusive, params.attrs, - y); + y, + dpp); }); } -int RGWUserCtl::remove_info(const RGWUserInfo& info, optional_yield y, +int RGWUserCtl::remove_info(const DoutPrefixProvider *dpp, + const RGWUserInfo& info, optional_yield y, const RemoveParams& params) { @@ -2837,7 +2873,7 @@ int RGWUserCtl::remove_info(const RGWUserInfo& info, optional_yield y, return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) { return svc.user->remove_user_info(op->ctx(), info, params.objv_tracker, - y); + y, dpp); }); } @@ -2862,7 +2898,8 @@ int RGWUserCtl::remove_bucket(const rgw_user& user, }); } -int RGWUserCtl::list_buckets(const rgw_user& user, +int RGWUserCtl::list_buckets(const DoutPrefixProvider *dpp, + const rgw_user& user, const string& marker, const string& end_marker, uint64_t max, @@ -2884,7 +2921,7 @@ int RGWUserCtl::list_buckets(const rgw_user& user, } if (need_stats) { map& m = buckets->get_buckets(); - ret = ctl.bucket->read_buckets_stats(m, y); + ret = ctl.bucket->read_buckets_stats(m, y, dpp); if (ret < 0 && ret != -ENOENT) { ldout(svc.user->ctx(), 0) << "ERROR: could not get stats for buckets" << dendl; return ret; diff --git a/src/rgw/rgw_user.h b/src/rgw/rgw_user.h index 5063ea3fccbb2..890666bd9fded 100644 --- a/src/rgw/rgw_user.h +++ b/src/rgw/rgw_user.h @@ -57,8 +57,8 @@ struct RGWUID }; WRITE_CLASS_ENCODER(RGWUID) -extern int rgw_user_sync_all_stats(rgw::sal::RGWRadosStore *store, const rgw_user& user_id, optional_yield y); -extern int rgw_user_get_all_buckets_stats( +extern int rgw_user_sync_all_stats(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, const rgw_user& user_id, optional_yield y); +extern int rgw_user_get_all_buckets_stats(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store,const rgw_user& user_id, map& buckets_usage_map, optional_yield y); @@ -71,7 +71,8 @@ extern void rgw_get_anon_user(RGWUserInfo& info); * Save the given user information to storage. * Returns: 0 on success, -ERR# on failure. */ -extern int rgw_store_user_info(RGWUserCtl *user_ctl, +extern int rgw_store_user_info(const DoutPrefixProvider *dpp, + RGWUserCtl *user_ctl, RGWUserInfo& info, RGWUserInfo *old_info, RGWObjVersionTracker *objv_tracker, @@ -84,7 +85,8 @@ extern int rgw_store_user_info(RGWUserCtl *user_ctl, * Given an user_id, finds the user info associated with it. * returns: 0 on success, -ERR# on failure (including nonexistence) */ -extern int rgw_get_user_info_by_uid(RGWUserCtl *user_ctl, +extern int rgw_get_user_info_by_uid(const DoutPrefixProvider *dpp, + RGWUserCtl *user_ctl, const rgw_user& user_id, RGWUserInfo& info, optional_yield y, @@ -96,7 +98,8 @@ extern int rgw_get_user_info_by_uid(RGWUserCtl *user_ctl, * Given an email, finds the user info associated with it. * returns: 0 on success, -ERR# on failure (including nonexistence) */ -extern int rgw_get_user_info_by_email(RGWUserCtl *user_ctl, +extern int rgw_get_user_info_by_email(const DoutPrefixProvider *dpp, + RGWUserCtl *user_ctl, string& email, RGWUserInfo& info, optional_yield y, RGWObjVersionTracker *objv_tracker = NULL, @@ -105,7 +108,8 @@ extern int rgw_get_user_info_by_email(RGWUserCtl *user_ctl, * Given an swift username, finds the user info associated with it. * returns: 0 on success, -ERR# on failure (including nonexistence) */ -extern int rgw_get_user_info_by_swift(RGWUserCtl *user_ctl, +extern int rgw_get_user_info_by_swift(const DoutPrefixProvider *dpp, + RGWUserCtl *user_ctl, const string& swift_name, RGWUserInfo& info, /* out */ optional_yield y, @@ -115,7 +119,8 @@ extern int rgw_get_user_info_by_swift(RGWUserCtl *user_ctl, * Given an access key, finds the user info associated with it. * returns: 0 on success, -ERR# on failure (including nonexistence) */ -extern int rgw_get_user_info_by_access_key(RGWUserCtl *user_ctl, +extern int rgw_get_user_info_by_access_key(const DoutPrefixProvider *dpp, + RGWUserCtl *user_ctl, const std::string& access_key, RGWUserInfo& info, optional_yield y, @@ -589,7 +594,8 @@ class RGWAccessKeyPool private: int create_key(RGWUserAdminOpState& op_state, std::string *err_msg = NULL); - int generate_key(RGWUserAdminOpState& op_state, optional_yield y, + int generate_key(const DoutPrefixProvider *dpp, + RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); int modify_key(RGWUserAdminOpState& op_state, std::string *err_msg = NULL); @@ -598,16 +604,18 @@ private: int check_op(RGWUserAdminOpState& op_state, std::string *err_msg = NULL); /* API Contract Fulfilment */ - int execute_add(RGWUserAdminOpState& op_state, std::string *err_msg, + int execute_add(const DoutPrefixProvider *dpp, + RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); - int execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg, + int execute_remove(const DoutPrefixProvider *dpp, + RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); - int remove_subuser_keys(RGWUserAdminOpState& op_state, std::string *err_msg, + int remove_subuser_keys(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); - int add(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, + int add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); - int remove(RGWUserAdminOpState& op_state, std::string *err_msg, + int remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); public: explicit RGWAccessKeyPool(RGWUser* usr); @@ -615,9 +623,9 @@ public: int init(RGWUserAdminOpState& op_state); /* API Contracted Methods */ - int add(RGWUserAdminOpState& op_state, optional_yield y, + int add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); - int remove(RGWUserAdminOpState& op_state, optional_yield y, + int remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); friend class RGWUser; @@ -639,14 +647,14 @@ private: int check_op(RGWUserAdminOpState& op_state, std::string *err_msg = NULL); /* API Contract Fulfillment */ - int execute_add(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); - int execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); - int execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); + int execute_add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); + int execute_remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); + int execute_modify(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); - int add(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, + int add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); - int remove(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); - int modify(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg, bool defer_save); + int remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); + int modify(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg, bool defer_save); public: explicit RGWSubUserPool(RGWUser *user); @@ -654,10 +662,10 @@ public: int init(RGWUserAdminOpState& op_state); /* API contracted methods */ - int add(RGWUserAdminOpState& op_state, optional_yield y, + int add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); - int remove(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); - int modify(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); + int remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); + int modify(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); friend class RGWUser; }; @@ -669,9 +677,9 @@ class RGWUserCapPool RGWUser *user{nullptr}; private: - int add(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, + int add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); - int remove(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, + int remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save, optional_yield y); public: @@ -680,9 +688,9 @@ public: int init(RGWUserAdminOpState& op_state); /* API contracted methods */ - int add(RGWUserAdminOpState& op_state, optional_yield y, + int add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); - int remove(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); + int remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); friend class RGWUser; }; @@ -703,27 +711,27 @@ private: bool is_populated() { return info_stored; } int check_op(RGWUserAdminOpState& req, std::string *err_msg); - int update(RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y); + int update(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y); void clear_members(); void init_default(); /* API Contract Fulfillment */ - int execute_add(RGWUserAdminOpState& op_state, std::string *err_msg, + int execute_add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y); - int execute_remove(RGWUserAdminOpState& op_state, + int execute_remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y); - int execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y); - int execute_rename(RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y); + int execute_modify(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y); + int execute_rename(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y); public: RGWUser(); - int init(rgw::sal::RGWRadosStore *storage, RGWUserAdminOpState& op_state, + int init(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *storage, RGWUserAdminOpState& op_state, optional_yield y); int init_storage(rgw::sal::RGWRadosStore *storage); - int init(RGWUserAdminOpState& op_state, optional_yield y); + int init(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y); int init_members(RGWUserAdminOpState& op_state); rgw::sal::RGWRadosStore *get_store() { return store; } @@ -735,19 +743,19 @@ public: RGWSubUserPool subusers; /* API Contracted Methods */ - int add(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); + int add(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); - int remove(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); + int remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); - int rename(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); + int rename(RGWUserAdminOpState& op_state, optional_yield y, const DoutPrefixProvider *dpp, std::string *err_msg = NULL); /* remove an already populated RGWUser */ int remove(std::string *err_msg = NULL); - int modify(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); + int modify(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL); /* retrieve info from an existing user in the RGW system */ - int info(RGWUserAdminOpState& op_state, RGWUserInfo& fetched_info, optional_yield y, + int info(const DoutPrefixProvider *dpp, RGWUserAdminOpState& op_state, RGWUserInfo& fetched_info, optional_yield y, std::string *err_msg = NULL); /* info from an already populated RGWUser */ @@ -769,33 +777,38 @@ public: static int list(rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher); - static int info(rgw::sal::RGWRadosStore *store, + static int info(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y); - static int create(rgw::sal::RGWRadosStore *store, + static int create(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y); - static int modify(rgw::sal::RGWRadosStore *store, + static int modify(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y); - static int remove(rgw::sal::RGWRadosStore *store, + static int remove(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y); }; class RGWUserAdminOp_Subuser { public: - static int create(rgw::sal::RGWRadosStore *store, + static int create(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y); - static int modify(rgw::sal::RGWRadosStore *store, + static int modify(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y); - static int remove(rgw::sal::RGWRadosStore *store, + static int remove(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y); }; @@ -803,11 +816,12 @@ public: class RGWUserAdminOp_Key { public: - static int create(rgw::sal::RGWRadosStore *store, + static int create(const DoutPrefixProvider *dpp, rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y); - static int remove(rgw::sal::RGWRadosStore *store, + static int remove(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y); }; @@ -815,11 +829,13 @@ public: class RGWUserAdminOp_Caps { public: - static int add(rgw::sal::RGWRadosStore *store, + static int add(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y); - static int remove(rgw::sal::RGWRadosStore *store, + static int remove(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y); }; @@ -963,23 +979,30 @@ public: } }; - int get_info_by_uid(const rgw_user& uid, RGWUserInfo *info, + int get_info_by_uid(const DoutPrefixProvider *dpp, + const rgw_user& uid, RGWUserInfo *info, optional_yield y, const GetParams& params = {}); - int get_info_by_email(const string& email, RGWUserInfo *info, + int get_info_by_email(const DoutPrefixProvider *dpp, + const string& email, RGWUserInfo *info, optional_yield y, const GetParams& params = {}); - int get_info_by_swift(const string& swift_name, RGWUserInfo *info, + int get_info_by_swift(const DoutPrefixProvider *dpp, + const string& swift_name, RGWUserInfo *info, optional_yield y, const GetParams& params = {}); - int get_info_by_access_key(const string& access_key, RGWUserInfo *info, + int get_info_by_access_key(const DoutPrefixProvider *dpp, + const string& access_key, RGWUserInfo *info, optional_yield y, const GetParams& params = {}); - int get_attrs_by_uid(const rgw_user& user_id, + int get_attrs_by_uid(const DoutPrefixProvider *dpp, + const rgw_user& user_id, map *attrs, optional_yield y, RGWObjVersionTracker *objv_tracker = nullptr); - int store_info(const RGWUserInfo& info, optional_yield y, + int store_info(const DoutPrefixProvider *dpp, + const RGWUserInfo& info, optional_yield y, const PutParams& params = {}); - int remove_info(const RGWUserInfo& info, optional_yield y, + int remove_info(const DoutPrefixProvider *dpp, + const RGWUserInfo& info, optional_yield y, const RemoveParams& params = {}); int add_bucket(const rgw_user& user, @@ -988,7 +1011,8 @@ public: optional_yield y); int remove_bucket(const rgw_user& user, const rgw_bucket& bucket, optional_yield y); - int list_buckets(const rgw_user& user, + int list_buckets(const DoutPrefixProvider *dpp, + const rgw_user& user, const string& marker, const string& end_marker, uint64_t max, diff --git a/src/rgw/rgw_zone.cc b/src/rgw/rgw_zone.cc index 51e2fd3e0e0b8..f33ca351dbdd7 100644 --- a/src/rgw/rgw_zone.cc +++ b/src/rgw/rgw_zone.cc @@ -67,7 +67,7 @@ rgw_pool RGWZoneGroup::get_pool(CephContext *cct_) const return rgw_pool(cct_->_conf->rgw_zonegroup_root_pool); } -int RGWZoneGroup::create_default(optional_yield y, bool old_format) +int RGWZoneGroup::create_default(const DoutPrefixProvider *dpp, optional_yield y, bool old_format) { name = default_zonegroup_name; api_name = default_zonegroup_name; @@ -82,23 +82,23 @@ int RGWZoneGroup::create_default(optional_yield y, bool old_format) int r = zone_params.init(cct, sysobj_svc, y, false); if (r < 0) { - ldout(cct, 0) << "create_default: error initializing zone params: " << cpp_strerror(-r) << dendl; + ldpp_dout(dpp, 0) << "create_default: error initializing zone params: " << cpp_strerror(-r) << dendl; return r; } - r = zone_params.create_default(y); + r = zone_params.create_default(dpp, y); if (r < 0 && r != -EEXIST) { - ldout(cct, 0) << "create_default: error in create_default zone params: " << cpp_strerror(-r) << dendl; + ldpp_dout(dpp, 0) << "create_default: error in create_default zone params: " << cpp_strerror(-r) << dendl; return r; } else if (r == -EEXIST) { - ldout(cct, 10) << "zone_params::create_default() returned -EEXIST, we raced with another default zone_params creation" << dendl; + ldpp_dout(dpp, 10) << "zone_params::create_default() returned -EEXIST, we raced with another default zone_params creation" << dendl; zone_params.clear_id(); r = zone_params.init(cct, sysobj_svc, y); if (r < 0) { - ldout(cct, 0) << "create_default: error in init existing zone params: " << cpp_strerror(-r) << dendl; + ldpp_dout(dpp, 0) << "create_default: error in init existing zone params: " << cpp_strerror(-r) << dendl; return r; } - ldout(cct, 20) << "zone_params::create_default() " << zone_params.get_name() << " id " << zone_params.get_id() + ldpp_dout(dpp, 20) << "zone_params::create_default() " << zone_params.get_name() << " id " << zone_params.get_id() << dendl; } @@ -107,14 +107,14 @@ int RGWZoneGroup::create_default(optional_yield y, bool old_format) default_zone.id = zone_params.get_id(); master_zone = default_zone.id; - r = create(y); + r = create(dpp, y); if (r < 0 && r != -EEXIST) { - ldout(cct, 0) << "error storing zone group info: " << cpp_strerror(-r) << dendl; + ldpp_dout(dpp, 0) << "error storing zone group info: " << cpp_strerror(-r) << dendl; return r; } if (r == -EEXIST) { - ldout(cct, 10) << "create_default() returned -EEXIST, we raced with another zonegroup creation" << dendl; + ldpp_dout(dpp, 10) << "create_default() returned -EEXIST, we raced with another zonegroup creation" << dendl; id.clear(); r = init(cct, sysobj_svc, y); if (r < 0) { @@ -633,7 +633,7 @@ int RGWSystemMetaObj::read(optional_yield y) return read_info(id, y); } -int RGWSystemMetaObj::create(optional_yield y, bool exclusive) +int RGWSystemMetaObj::create(const DoutPrefixProvider *dpp, optional_yield y, bool exclusive) { int ret; @@ -701,9 +701,9 @@ const string& RGWRealm::get_predefined_name(CephContext *cct) const { return cct->_conf->rgw_realm; } -int RGWRealm::create(optional_yield y, bool exclusive) +int RGWRealm::create(const DoutPrefixProvider *dpp, optional_yield y, bool exclusive) { - int ret = RGWSystemMetaObj::create(y, exclusive); + int ret = RGWSystemMetaObj::create(dpp, y, exclusive); if (ret < 0) { ldout(cct, 0) << "ERROR creating new realm object " << name << ": " << cpp_strerror(-ret) << dendl; return ret; @@ -721,7 +721,7 @@ int RGWRealm::create(optional_yield y, bool exclusive) if (ret < 0 ) { return ret; } - ret = period.create(y, true); + ret = period.create(dpp, y, true); if (ret < 0) { ldout(cct, 0) << "ERROR: creating new period for realm " << name << ": " << cpp_strerror(-ret) << dendl; return ret; @@ -1195,7 +1195,7 @@ int RGWPeriod::read_info(optional_yield y) return 0; } -int RGWPeriod::create(optional_yield y, bool exclusive) +int RGWPeriod::create(const DoutPrefixProvider *dpp, optional_yield y, bool exclusive) { int ret; @@ -1422,7 +1422,8 @@ int RGWPeriod::update_sync_status(rgw::sal::RGWRadosStore *store, /* for now */ return 0; } -int RGWPeriod::commit(rgw::sal::RGWRadosStore *store, +int RGWPeriod::commit(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWRealm& realm, const RGWPeriod& current_period, std::ostream& error_stream, optional_yield y, bool force_if_stale) @@ -1463,7 +1464,7 @@ int RGWPeriod::commit(rgw::sal::RGWRadosStore *store, return r; } // create an object with a new period id - r = create(y, true); + r = create(dpp, y, true); if (r < 0) { ldout(cct, 0) << "failed to create new period: " << cpp_strerror(-r) << dendl; return r; @@ -1520,11 +1521,11 @@ int RGWPeriod::commit(rgw::sal::RGWRadosStore *store, return 0; } -int RGWZoneParams::create_default(optional_yield y, bool old_format) +int RGWZoneParams::create_default(const DoutPrefixProvider *dpp, optional_yield y, bool old_format) { name = default_zone_name; - int r = create(y); + int r = create(dpp, y); if (r < 0) { return r; } @@ -1662,13 +1663,13 @@ int RGWZoneParams::fix_pool_names(optional_yield y) return 0; } -int RGWZoneParams::create(optional_yield y, bool exclusive) +int RGWZoneParams::create(const DoutPrefixProvider *dpp, optional_yield y, bool exclusive) { /* check for old pools config */ rgw_raw_obj obj(domain_root, avail_pools); auto obj_ctx = sysobj_svc->init_obj_ctx(); auto sysobj = sysobj_svc->get_obj(obj_ctx, obj); - int r = sysobj.rop().stat(y); + int r = sysobj.rop().stat(y, dpp); if (r < 0) { ldout(cct, 10) << "couldn't find old data placement pools config, setting up new ones for the zone" << dendl; /* a new system, let's set new placement info */ @@ -1686,7 +1687,7 @@ int RGWZoneParams::create(optional_yield y, bool exclusive) return r; } - r = RGWSystemMetaObj::create(y, exclusive); + r = RGWSystemMetaObj::create(dpp, y, exclusive); if (r < 0) { return r; } diff --git a/src/rgw/rgw_zone.h b/src/rgw/rgw_zone.h index 32a588aea2adb..088e9740bd6b3 100644 --- a/src/rgw/rgw_zone.h +++ b/src/rgw/rgw_zone.h @@ -138,7 +138,7 @@ public: bool old_format = false); virtual int set_as_default(optional_yield y, bool exclusive = false); int delete_default(); - virtual int create(optional_yield y, bool exclusive = true); + virtual int create(const DoutPrefixProvider *dpp, optional_yield y, bool exclusive = true); int delete_obj(optional_yield y, bool old_format = false); int rename(const std::string& new_name, optional_yield y); int update(optional_yield y) { return store_info(false, y);} @@ -405,8 +405,8 @@ struct RGWZoneParams : RGWSystemMetaObj { using RGWSystemMetaObj::init; int read_default_id(std::string& default_id, optional_yield y, bool old_format = false) override; int set_as_default(optional_yield y, bool exclusive = false) override; - int create_default(optional_yield y, bool old_format = false); - int create(optional_yield y, bool exclusive = true) override; + int create_default(const DoutPrefixProvider *dpp, optional_yield y, bool old_format = false); + int create(const DoutPrefixProvider *dpp, optional_yield y, bool exclusive = true) override; int fix_pool_names(optional_yield y); const string& get_compression_type(const rgw_placement_rule& placement_rule) const; @@ -814,7 +814,7 @@ struct RGWZoneGroup : public RGWSystemMetaObj { int read_default_id(std::string& default_id, optional_yield y, bool old_format = false) override; int set_as_default(optional_yield y, bool exclusive = false) override; - int create_default(optional_yield y, bool old_format = false); + int create_default(const DoutPrefixProvider *dpp, optional_yield y, bool old_format = false); int equals(const std::string& other_zonegroup) const; int add_zone(const RGWZoneParams& zone_params, bool *is_master, bool *read_only, const list& endpoints, const std::string *ptier_type, @@ -967,7 +967,7 @@ public: DECODE_FINISH(bl); } - int create(optional_yield y, bool exclusive = true) override; + int create(const DoutPrefixProvider *dpp, optional_yield y, bool exclusive = true) override; int delete_obj(optional_yield y); rgw_pool get_pool(CephContext *cct) const override; const std::string get_default_oid(bool old_format = false) const override; @@ -1156,7 +1156,7 @@ public: const std::string &period_realm_name = "", bool setup_obj = true); int init(CephContext *_cct, RGWSI_SysObj *_sysobj_svc, optional_yield y, bool setup_obj = true); - int create(optional_yield y, bool exclusive = true); + int create(const DoutPrefixProvider *dpp, optional_yield y, bool exclusive = true); int delete_obj(optional_yield y); int store_info(bool exclusive, optional_yield y); int add_zonegroup(const RGWZoneGroup& zonegroup, optional_yield y); @@ -1165,7 +1165,8 @@ public: int update(optional_yield y); // commit a staging period; only for use on master zone - int commit(rgw::sal::RGWRadosStore *store, + int commit(const DoutPrefixProvider *dpp, + rgw::sal::RGWRadosStore *store, RGWRealm& realm, const RGWPeriod ¤t_period, std::ostream& error_stream, optional_yield y, bool force_if_stale = false); diff --git a/src/rgw/services/svc_bi.h b/src/rgw/services/svc_bi.h index de348b40de450..cf6e605c87c3a 100644 --- a/src/rgw/services/svc_bi.h +++ b/src/rgw/services/svc_bi.h @@ -36,7 +36,8 @@ public: RGWBucketEnt *stats, optional_yield y) = 0; - virtual int handle_overwrite(const RGWBucketInfo& info, + virtual int handle_overwrite(const DoutPrefixProvider *dpp, + const RGWBucketInfo& info, const RGWBucketInfo& orig_info) = 0; }; diff --git a/src/rgw/services/svc_bi_rados.cc b/src/rgw/services/svc_bi_rados.cc index 4e58438d50293..d2abf76c6b2e2 100644 --- a/src/rgw/services/svc_bi_rados.cc +++ b/src/rgw/services/svc_bi_rados.cc @@ -418,7 +418,8 @@ int RGWSI_BucketIndex_RADOS::get_reshard_status(const RGWBucketInfo& bucket_info return 0; } -int RGWSI_BucketIndex_RADOS::handle_overwrite(const RGWBucketInfo& info, +int RGWSI_BucketIndex_RADOS::handle_overwrite(const DoutPrefixProvider *dpp, + const RGWBucketInfo& info, const RGWBucketInfo& orig_info) { bool new_sync_enabled = info.datasync_flag_enabled(); @@ -440,7 +441,7 @@ int RGWSI_BucketIndex_RADOS::handle_overwrite(const RGWBucketInfo& info, } for (int i = 0; i < shards_num; ++i, ++shard_id) { - ret = svc.datalog_rados->add_entry(info, shard_id); + ret = svc.datalog_rados->add_entry(dpp, info, shard_id); if (ret < 0) { lderr(cct) << "ERROR: failed writing data log (info.bucket=" << info.bucket << ", shard_id=" << shard_id << ")" << dendl; return ret; diff --git a/src/rgw/services/svc_bi_rados.h b/src/rgw/services/svc_bi_rados.h index b25f744927512..a6956381fa332 100644 --- a/src/rgw/services/svc_bi_rados.h +++ b/src/rgw/services/svc_bi_rados.h @@ -105,7 +105,7 @@ public: int get_reshard_status(const RGWBucketInfo& bucket_info, std::list *status); - int handle_overwrite(const RGWBucketInfo& info, + int handle_overwrite(const DoutPrefixProvider *dpp, const RGWBucketInfo& info, const RGWBucketInfo& orig_info) override; int open_bucket_index_shard(const RGWBucketInfo& bucket_info, diff --git a/src/rgw/services/svc_bucket.h b/src/rgw/services/svc_bucket.h index 7e39302f43cce..fcdabca8b6f21 100644 --- a/src/rgw/services/svc_bucket.h +++ b/src/rgw/services/svc_bucket.h @@ -40,6 +40,7 @@ public: real_time *pmtime, map *pattrs, optional_yield y, + const DoutPrefixProvider *dpp, rgw_cache_entry_info *cache_info = nullptr, boost::optional refresh_version = boost::none) = 0; @@ -50,12 +51,14 @@ public: real_time mtime, map *pattrs, RGWObjVersionTracker *objv_tracker, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; virtual int remove_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx, const string& key, RGWObjVersionTracker *objv_tracker, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; virtual int read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, const string& key, @@ -63,6 +66,7 @@ public: real_time *pmtime, map *pattrs, optional_yield y, + const DoutPrefixProvider *dpp, rgw_cache_entry_info *cache_info = nullptr, boost::optional refresh_version = boost::none) = 0; @@ -72,7 +76,8 @@ public: real_time *pmtime, map *pattrs, boost::optional refresh_version, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; virtual int store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, const string& key, @@ -82,21 +87,25 @@ public: bool exclusive, real_time mtime, map *pattrs, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; virtual int remove_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, const string& key, const RGWBucketInfo& bucket_info, RGWObjVersionTracker *objv_tracker, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; virtual int read_bucket_stats(RGWSI_Bucket_X_Ctx& ctx, const rgw_bucket& bucket, RGWBucketEnt *ent, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; virtual int read_buckets_stats(RGWSI_Bucket_X_Ctx& ctx, map& m, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; }; diff --git a/src/rgw/services/svc_bucket_sobj.cc b/src/rgw/services/svc_bucket_sobj.cc index 8dea5461d113c..a69b0aaaf860c 100644 --- a/src/rgw/services/svc_bucket_sobj.cc +++ b/src/rgw/services/svc_bucket_sobj.cc @@ -159,7 +159,7 @@ void RGWSI_Bucket_SObj::init(RGWSI_Zone *_zone_svc, RGWSI_SysObj *_sysobj_svc, svc.bucket_sync = _bucket_sync_svc; } -int RGWSI_Bucket_SObj::do_start(optional_yield) +int RGWSI_Bucket_SObj::do_start(optional_yield, const DoutPrefixProvider *dpp) { binfo_cache.reset(new RGWChainedCacheImpl); binfo_cache->init(svc.cache); @@ -170,7 +170,7 @@ int RGWSI_Bucket_SObj::do_start(optional_yield) int r = svc.meta->create_be_handler(RGWSI_MetaBackend::Type::MDBE_SOBJ, &ep_handler); if (r < 0) { - ldout(ctx(), 0) << "ERROR: failed to create be handler: r=" << r << dendl; + ldpp_dout(dpp, 0) << "ERROR: failed to create be handler: r=" << r << dendl; return r; } @@ -188,7 +188,7 @@ int RGWSI_Bucket_SObj::do_start(optional_yield) r = svc.meta->create_be_handler(RGWSI_MetaBackend::Type::MDBE_SOBJ, &bi_handler); if (r < 0) { - ldout(ctx(), 0) << "ERROR: failed to create be handler: r=" << r << dendl; + ldpp_dout(dpp, 0) << "ERROR: failed to create be handler: r=" << r << dendl; return r; } @@ -210,6 +210,7 @@ int RGWSI_Bucket_SObj::read_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx, real_time *pmtime, map *pattrs, optional_yield y, + const DoutPrefixProvider *dpp, rgw_cache_entry_info *cache_info, boost::optional refresh_version) { @@ -218,7 +219,7 @@ int RGWSI_Bucket_SObj::read_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx, auto params = RGWSI_MBSObj_GetParams(&bl, pattrs, pmtime).set_cache_info(cache_info) .set_refresh_version(refresh_version); - int ret = svc.meta_be->get_entry(ctx.get(), key, params, objv_tracker, y); + int ret = svc.meta_be->get_entry(ctx.get(), key, params, objv_tracker, y, dpp); if (ret < 0) { return ret; } @@ -240,14 +241,15 @@ int RGWSI_Bucket_SObj::store_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx, real_time mtime, map *pattrs, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { bufferlist bl; encode(info, bl); RGWSI_MBSObj_PutParams params(bl, pattrs, mtime, exclusive); - int ret = svc.meta_be->put(ctx.get(), key, params, objv_tracker, y); + int ret = svc.meta_be->put(ctx.get(), key, params, objv_tracker, y, dpp); if (ret < 0) { return ret; } @@ -258,10 +260,11 @@ int RGWSI_Bucket_SObj::store_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx, int RGWSI_Bucket_SObj::remove_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx, const string& key, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { RGWSI_MBSObj_RemoveParams params; - return svc.meta_be->remove(ctx.get(), key, params, objv_tracker, y); + return svc.meta_be->remove(ctx.get(), key, params, objv_tracker, y, dpp); } int RGWSI_Bucket_SObj::read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, @@ -269,6 +272,7 @@ int RGWSI_Bucket_SObj::read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, RGWBucketInfo *info, real_time *pmtime, map *pattrs, optional_yield y, + const DoutPrefixProvider *dpp, rgw_cache_entry_info *cache_info, boost::optional refresh_version) { @@ -297,14 +301,14 @@ int RGWSI_Bucket_SObj::read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, int ret = do_read_bucket_instance_info(ctx, key, &e.info, &e.mtime, &e.attrs, - &ci, refresh_version, y); + &ci, refresh_version, y, dpp); *info = e.info; if (ret < 0) { if (ret != -ENOENT) { lderr(cct) << "ERROR: do_read_bucket_instance_info failed: " << ret << dendl; } else { - ldout(cct, 20) << "do_read_bucket_instance_info, bucket instance not found (key=" << key << ")" << dendl; + ldpp_dout(dpp, 20) << "do_read_bucket_instance_info, bucket instance not found (key=" << key << ")" << dendl; } return ret; } @@ -321,7 +325,7 @@ int RGWSI_Bucket_SObj::read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, /* chain to only bucket instance and *not* bucket entrypoint */ if (!binfo_cache->put(svc.cache, cache_key, &e, {&ci})) { - ldout(cct, 20) << "couldn't put binfo cache entry, might have raced with data changes" << dendl; + ldpp_dout(dpp, 20) << "couldn't put binfo cache entry, might have raced with data changes" << dendl; } if (refresh_version && @@ -340,7 +344,8 @@ int RGWSI_Bucket_SObj::do_read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, real_time *pmtime, map *pattrs, rgw_cache_entry_info *cache_info, boost::optional refresh_version, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { bufferlist bl; RGWObjVersionTracker ot; @@ -348,7 +353,7 @@ int RGWSI_Bucket_SObj::do_read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, auto params = RGWSI_MBSObj_GetParams(&bl, pattrs, pmtime).set_cache_info(cache_info) .set_refresh_version(refresh_version); - int ret = svc.meta_be->get_entry(ctx.get(), key, params, &ot, y); + int ret = svc.meta_be->get_entry(ctx.get(), key, params, &ot, y, dpp); if (ret < 0) { return ret; } @@ -357,7 +362,7 @@ int RGWSI_Bucket_SObj::do_read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, try { decode(*info, iter); } catch (buffer::error& err) { - ldout(cct, 0) << "ERROR: could not decode buffer info, caught buffer::error" << dendl; + ldpp_dout(dpp, 0) << "ERROR: could not decode buffer info, caught buffer::error" << dendl; return -EIO; } info->objv_tracker = ot; @@ -370,7 +375,8 @@ int RGWSI_Bucket_SObj::read_bucket_info(RGWSI_Bucket_X_Ctx& ctx, real_time *pmtime, map *pattrs, boost::optional refresh_version, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { rgw_cache_entry_info cache_info; @@ -379,6 +385,7 @@ int RGWSI_Bucket_SObj::read_bucket_info(RGWSI_Bucket_X_Ctx& ctx, info, pmtime, pattrs, y, + dpp, &cache_info, refresh_version); } @@ -414,6 +421,7 @@ int RGWSI_Bucket_SObj::read_bucket_info(RGWSI_Bucket_X_Ctx& ctx, int ret = read_bucket_entrypoint_info(ctx.ep, bucket_entry, &entry_point, &ot, &ep_mtime, pattrs, y, + dpp, &entry_cache_info, refresh_version); if (ret < 0) { /* only init these fields */ @@ -424,7 +432,7 @@ int RGWSI_Bucket_SObj::read_bucket_info(RGWSI_Bucket_X_Ctx& ctx, if (entry_point.has_bucket_info) { *info = entry_point.old_bucket_info; info->bucket.tenant = bucket.tenant; - ldout(cct, 20) << "rgw_get_bucket_info: old bucket info, bucket=" << info->bucket << " owner " << info->owner << dendl; + ldpp_dout(dpp, 20) << "rgw_get_bucket_info: old bucket info, bucket=" << info->bucket << " owner " << info->owner << dendl; return 0; } @@ -435,7 +443,7 @@ int RGWSI_Bucket_SObj::read_bucket_info(RGWSI_Bucket_X_Ctx& ctx, pattrs->clear(); } - ldout(cct, 20) << "rgw_get_bucket_info: bucket instance: " << entry_point.bucket << dendl; + ldpp_dout(dpp, 20) << "rgw_get_bucket_info: bucket instance: " << entry_point.bucket << dendl; /* read bucket instance info */ @@ -445,6 +453,7 @@ int RGWSI_Bucket_SObj::read_bucket_info(RGWSI_Bucket_X_Ctx& ctx, ret = read_bucket_instance_info(ctx.bi, get_bi_meta_key(entry_point.bucket), &e.info, &e.mtime, &e.attrs, y, + dpp, &cache_info, refresh_version); *info = e.info; if (ret < 0) { @@ -461,7 +470,7 @@ int RGWSI_Bucket_SObj::read_bucket_info(RGWSI_Bucket_X_Ctx& ctx, /* chain to both bucket entry point and bucket instance */ if (!binfo_cache->put(svc.cache, cache_key, &e, {&entry_cache_info, &cache_info})) { - ldout(cct, 20) << "couldn't put binfo cache entry, might have raced with data changes" << dendl; + ldpp_dout(dpp, 20) << "couldn't put binfo cache entry, might have raced with data changes" << dendl; } if (refresh_version && @@ -482,7 +491,8 @@ int RGWSI_Bucket_SObj::store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, bool exclusive, real_time mtime, map *pattrs, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { bufferlist bl; encode(info, bl); @@ -502,10 +512,11 @@ int RGWSI_Bucket_SObj::store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, &shared_bucket_info, nullptr, nullptr, y, + dpp, nullptr, boost::none); if (r < 0) { if (r != -ENOENT) { - ldout(cct, 0) << "ERROR: " << __func__ << "(): read_bucket_instance_info() of key=" << key << " returned r=" << r << dendl; + ldpp_dout(dpp, 0) << "ERROR: " << __func__ << "(): read_bucket_instance_info() of key=" << key << " returned r=" << r << dendl; return r; } } else { @@ -514,16 +525,16 @@ int RGWSI_Bucket_SObj::store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, } if (orig_info && *orig_info && !exclusive) { - int r = svc.bi->handle_overwrite(info, *(orig_info.value())); + int r = svc.bi->handle_overwrite(dpp, info, *(orig_info.value())); if (r < 0) { - ldout(cct, 0) << "ERROR: " << __func__ << "(): svc.bi->handle_overwrite() of key=" << key << " returned r=" << r << dendl; + ldpp_dout(dpp, 0) << "ERROR: " << __func__ << "(): svc.bi->handle_overwrite() of key=" << key << " returned r=" << r << dendl; return r; } } RGWSI_MBSObj_PutParams params(bl, pattrs, mtime, exclusive); - int ret = svc.meta_be->put(ctx.get(), key, params, &info.objv_tracker, y); + int ret = svc.meta_be->put(ctx.get(), key, params, &info.objv_tracker, y, dpp); if (ret >= 0) { int r = svc.bucket_sync->handle_bi_update(info, @@ -555,7 +566,8 @@ int RGWSI_Bucket_SObj::remove_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, const string& key, const RGWBucketInfo& info, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { RGWSI_MBSObj_RemoveParams params; int ret = svc.meta_be->remove_entry(ctx.get(), key, params, objv_tracker, y); @@ -578,7 +590,8 @@ int RGWSI_Bucket_SObj::remove_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, int RGWSI_Bucket_SObj::read_bucket_stats(const RGWBucketInfo& bucket_info, RGWBucketEnt *ent, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { ent->count = 0; ent->size = 0; @@ -588,7 +601,7 @@ int RGWSI_Bucket_SObj::read_bucket_stats(const RGWBucketInfo& bucket_info, int r = svc.bi->read_stats(bucket_info, ent, y); if (r < 0) { - ldout(cct, 0) << "ERROR: " << __func__ << "(): read_stats returned r=" << r << dendl; + ldpp_dout(dpp, 0) << "ERROR: " << __func__ << "(): read_stats returned r=" << r << dendl; return r; } @@ -598,27 +611,29 @@ int RGWSI_Bucket_SObj::read_bucket_stats(const RGWBucketInfo& bucket_info, int RGWSI_Bucket_SObj::read_bucket_stats(RGWSI_Bucket_X_Ctx& ctx, const rgw_bucket& bucket, RGWBucketEnt *ent, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { RGWBucketInfo bucket_info; - int ret = read_bucket_info(ctx, bucket, &bucket_info, nullptr, nullptr, boost::none, y); + int ret = read_bucket_info(ctx, bucket, &bucket_info, nullptr, nullptr, boost::none, y, dpp); if (ret < 0) { return ret; } - return read_bucket_stats(bucket_info, ent, y); + return read_bucket_stats(bucket_info, ent, y, dpp); } int RGWSI_Bucket_SObj::read_buckets_stats(RGWSI_Bucket_X_Ctx& ctx, map& m, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { map::iterator iter; for (iter = m.begin(); iter != m.end(); ++iter) { RGWBucketEnt& ent = iter->second; - int r = read_bucket_stats(ctx, ent.bucket, &ent, y); + int r = read_bucket_stats(ctx, ent.bucket, &ent, y, dpp); if (r < 0) { - ldout(cct, 0) << "ERROR: " << __func__ << "(): read_bucket_stats returned r=" << r << dendl; + ldpp_dout(dpp, 0) << "ERROR: " << __func__ << "(): read_bucket_stats returned r=" << r << dendl; return r; } } diff --git a/src/rgw/services/svc_bucket_sobj.h b/src/rgw/services/svc_bucket_sobj.h index 10e134d5b24f2..776367e8aba4f 100644 --- a/src/rgw/services/svc_bucket_sobj.h +++ b/src/rgw/services/svc_bucket_sobj.h @@ -51,7 +51,7 @@ class RGWSI_Bucket_SObj : public RGWSI_Bucket RGWSI_BucketInstance_BE_Handler bi_be_handler; std::unique_ptr bi_be_module; - int do_start(optional_yield) override; + int do_start(optional_yield, const DoutPrefixProvider *dpp) override; int do_read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, const string& key, @@ -60,11 +60,13 @@ class RGWSI_Bucket_SObj : public RGWSI_Bucket map *pattrs, rgw_cache_entry_info *cache_info, boost::optional refresh_version, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); int read_bucket_stats(const RGWBucketInfo& bucket_info, RGWBucketEnt *ent, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); public: struct Svc { @@ -107,6 +109,7 @@ public: real_time *pmtime, map *pattrs, optional_yield y, + const DoutPrefixProvider *dpp, rgw_cache_entry_info *cache_info = nullptr, boost::optional refresh_version = boost::none) override; @@ -117,12 +120,14 @@ public: real_time mtime, map *pattrs, RGWObjVersionTracker *objv_tracker, - optional_yield y) override; + optional_yield y, + const DoutPrefixProvider *dpp) override; int remove_bucket_entrypoint_info(RGWSI_Bucket_EP_Ctx& ctx, const string& key, RGWObjVersionTracker *objv_tracker, - optional_yield y) override; + optional_yield y, + const DoutPrefixProvider *dpp) override; int read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, const string& key, @@ -130,6 +135,7 @@ public: real_time *pmtime, map *pattrs, optional_yield y, + const DoutPrefixProvider *dpp, rgw_cache_entry_info *cache_info = nullptr, boost::optional refresh_version = boost::none) override; @@ -139,7 +145,8 @@ public: real_time *pmtime, map *pattrs, boost::optional refresh_version, - optional_yield y) override; + optional_yield y, + const DoutPrefixProvider *dpp) override; int store_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, const string& key, @@ -149,21 +156,25 @@ public: bool exclusive, real_time mtime, map *pattrs, - optional_yield y) override; + optional_yield y, + const DoutPrefixProvider *dpp) override; int remove_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx, const string& key, const RGWBucketInfo& bucket_info, RGWObjVersionTracker *objv_tracker, - optional_yield y) override; + optional_yield y, + const DoutPrefixProvider *dpp) override; int read_bucket_stats(RGWSI_Bucket_X_Ctx& ctx, const rgw_bucket& bucket, RGWBucketEnt *ent, - optional_yield y) override; + optional_yield y, + const DoutPrefixProvider *dpp) override; int read_buckets_stats(RGWSI_Bucket_X_Ctx& ctx, map& m, - optional_yield y) override; + optional_yield y, + const DoutPrefixProvider *dpp) override; }; diff --git a/src/rgw/services/svc_bucket_sync.h b/src/rgw/services/svc_bucket_sync.h index 4016490f71db8..c09cc97dff085 100644 --- a/src/rgw/services/svc_bucket_sync.h +++ b/src/rgw/services/svc_bucket_sync.h @@ -34,7 +34,8 @@ public: std::optional zone, std::optional bucket, RGWBucketSyncPolicyHandlerRef *handler, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; virtual int handle_bi_update(RGWBucketInfo& bucket_info, RGWBucketInfo *orig_bucket_info, diff --git a/src/rgw/services/svc_bucket_sync_sobj.cc b/src/rgw/services/svc_bucket_sync_sobj.cc index f80b9618bb9a5..3cd41895475aa 100644 --- a/src/rgw/services/svc_bucket_sync_sobj.cc +++ b/src/rgw/services/svc_bucket_sync_sobj.cc @@ -59,7 +59,7 @@ void RGWSI_Bucket_Sync_SObj::init(RGWSI_Zone *_zone_svc, hint_index_mgr.reset(new RGWSI_Bucket_Sync_SObj_HintIndexManager(svc.zone, svc.sysobj)); } -int RGWSI_Bucket_Sync_SObj::do_start(optional_yield) +int RGWSI_Bucket_Sync_SObj::do_start(optional_yield, const DoutPrefixProvider *dpp) { sync_policy_cache.reset(new RGWChainedCacheImpl); sync_policy_cache->init(svc.cache); @@ -71,7 +71,7 @@ void RGWSI_Bucket_Sync_SObj::get_hint_entities(RGWSI_Bucket_X_Ctx& ctx, const std::set& zones, const std::set& buckets, std::set *hint_entities, - optional_yield y) + optional_yield y, const DoutPrefixProvider *dpp) { vector hint_buckets; @@ -81,9 +81,9 @@ void RGWSI_Bucket_Sync_SObj::get_hint_entities(RGWSI_Bucket_X_Ctx& ctx, RGWBucketInfo hint_bucket_info; int ret = svc.bucket_sobj->read_bucket_info(ctx, b, &hint_bucket_info, nullptr, nullptr, boost::none, - y); + y, dpp); if (ret < 0) { - ldout(cct, 20) << "could not init bucket info for hint bucket=" << b << " ... skipping" << dendl; + ldpp_dout(dpp, 20) << "could not init bucket info for hint bucket=" << b << " ... skipping" << dendl; continue; } @@ -102,7 +102,8 @@ int RGWSI_Bucket_Sync_SObj::resolve_policy_hints(RGWSI_Bucket_X_Ctx& ctx, RGWBucketSyncPolicyHandlerRef& handler, RGWBucketSyncPolicyHandlerRef& zone_policy_handler, std::map& temp_map, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { set source_zones; set target_zones; @@ -115,8 +116,8 @@ int RGWSI_Bucket_Sync_SObj::resolve_policy_hints(RGWSI_Bucket_X_Ctx& ctx, std::set hint_entities; - get_hint_entities(ctx, source_zones, handler->get_source_hints(), &hint_entities, y); - get_hint_entities(ctx, target_zones, handler->get_target_hints(), &hint_entities, y); + get_hint_entities(ctx, source_zones, handler->get_source_hints(), &hint_entities, y, dpp); + get_hint_entities(ctx, target_zones, handler->get_target_hints(), &hint_entities, y, dpp); std::set resolved_sources; std::set resolved_dests; @@ -136,9 +137,9 @@ int RGWSI_Bucket_Sync_SObj::resolve_policy_hints(RGWSI_Bucket_X_Ctx& ctx, if (iter != temp_map.end()) { hint_bucket_handler = iter->second; } else { - int r = do_get_policy_handler(ctx, zid, hint_bucket, temp_map, &hint_bucket_handler, y); + int r = do_get_policy_handler(ctx, zid, hint_bucket, temp_map, &hint_bucket_handler, y, dpp); if (r < 0) { - ldout(cct, 20) << "could not get bucket sync policy handler for hint bucket=" << hint_bucket << " ... skipping" << dendl; + ldpp_dout(dpp, 20) << "could not get bucket sync policy handler for hint bucket=" << hint_bucket << " ... skipping" << dendl; continue; } } @@ -159,7 +160,8 @@ int RGWSI_Bucket_Sync_SObj::do_get_policy_handler(RGWSI_Bucket_X_Ctx& ctx, std::optional _bucket, std::map& temp_map, RGWBucketSyncPolicyHandlerRef *handler, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { if (!_bucket) { *handler = svc.zone->get_sync_policy_handler(zone); @@ -196,6 +198,7 @@ int RGWSI_Bucket_Sync_SObj::do_get_policy_handler(RGWSI_Bucket_X_Ctx& ctx, nullptr, &attrs, y, + dpp, &cache_info); if (r < 0) { if (r != -ENOENT) { @@ -225,7 +228,7 @@ int RGWSI_Bucket_Sync_SObj::do_get_policy_handler(RGWSI_Bucket_X_Ctx& ctx, r = resolve_policy_hints(ctx, self_entity, e.handler, zone_policy_handler, - temp_map, y); + temp_map, y, dpp); if (r < 0) { ldout(cct, 20) << "ERROR: failed to resolve policy hints: bucket_key=" << bucket_key << ", r=" << r << dendl; return r; @@ -244,10 +247,11 @@ int RGWSI_Bucket_Sync_SObj::get_policy_handler(RGWSI_Bucket_X_Ctx& ctx, std::optional zone, std::optional _bucket, RGWBucketSyncPolicyHandlerRef *handler, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { std::map temp_map; - return do_get_policy_handler(ctx, zone, _bucket, temp_map, handler, y); + return do_get_policy_handler(ctx, zone, _bucket, temp_map, handler, y, dpp); } static bool diff_sets(std::set& orig_set, diff --git a/src/rgw/services/svc_bucket_sync_sobj.h b/src/rgw/services/svc_bucket_sync_sobj.h index 49f764881ca4c..5cd8ffd1f8156 100644 --- a/src/rgw/services/svc_bucket_sync_sobj.h +++ b/src/rgw/services/svc_bucket_sync_sobj.h @@ -43,7 +43,7 @@ class RGWSI_Bucket_Sync_SObj : public RGWSI_Bucket_Sync std::unique_ptr hint_index_mgr; - int do_start(optional_yield) override; + int do_start(optional_yield, const DoutPrefixProvider *dpp) override; struct optional_zone_bucket { optional zone; @@ -67,19 +67,21 @@ class RGWSI_Bucket_Sync_SObj : public RGWSI_Bucket_Sync const std::set& zone_names, const std::set& buckets, std::set *hint_entities, - optional_yield y); + optional_yield y, const DoutPrefixProvider *); int resolve_policy_hints(RGWSI_Bucket_X_Ctx& ctx, rgw_sync_bucket_entity& self_entity, RGWBucketSyncPolicyHandlerRef& handler, RGWBucketSyncPolicyHandlerRef& zone_policy_handler, std::map& temp_map, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); int do_get_policy_handler(RGWSI_Bucket_X_Ctx& ctx, std::optional zone, std::optional _bucket, std::map& temp_map, RGWBucketSyncPolicyHandlerRef *handler, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); public: struct Svc { RGWSI_Zone *zone{nullptr}; @@ -101,7 +103,8 @@ public: std::optional zone, std::optional bucket, RGWBucketSyncPolicyHandlerRef *handler, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); int handle_bi_update(RGWBucketInfo& bucket_info, RGWBucketInfo *orig_bucket_info, diff --git a/src/rgw/services/svc_cls.cc b/src/rgw/services/svc_cls.cc index 984d92a5ee95f..a952ede7c0a5c 100644 --- a/src/rgw/services/svc_cls.cc +++ b/src/rgw/services/svc_cls.cc @@ -17,11 +17,11 @@ static string log_lock_name = "rgw_log_lock"; -int RGWSI_Cls::do_start(optional_yield y) +int RGWSI_Cls::do_start(optional_yield y, const DoutPrefixProvider *dpp) { - int r = mfa.do_start(y); + int r = mfa.do_start(y, dpp); if (r < 0) { - ldout(cct, 0) << "ERROR: failed to start mfa service" << dendl; + ldpp_dout(dpp, 0) << "ERROR: failed to start mfa service" << dendl; return r; } diff --git a/src/rgw/services/svc_cls.h b/src/rgw/services/svc_cls.h index 80674a286bcf3..4e0f1040798a1 100644 --- a/src/rgw/services/svc_cls.h +++ b/src/rgw/services/svc_cls.h @@ -152,6 +152,6 @@ public: lock.init(this, zone_svc, rados_svc); } - int do_start(optional_yield) override; + int do_start(optional_yield, const DoutPrefixProvider *dpp) override; }; diff --git a/src/rgw/services/svc_config_key_rados.cc b/src/rgw/services/svc_config_key_rados.cc index 7a16b22f0bb23..9bb0344af03af 100644 --- a/src/rgw/services/svc_config_key_rados.cc +++ b/src/rgw/services/svc_config_key_rados.cc @@ -2,7 +2,7 @@ #include "svc_rados.h" #include "svc_config_key_rados.h" -int RGWSI_ConfigKey_RADOS::do_start(optional_yield) +int RGWSI_ConfigKey_RADOS::do_start(optional_yield, const DoutPrefixProvider *dpp) { maybe_insecure_mon_conn = !svc.rados->check_secure_mon_conn(); diff --git a/src/rgw/services/svc_config_key_rados.h b/src/rgw/services/svc_config_key_rados.h index d7997364fb64d..e0de60cac0113 100644 --- a/src/rgw/services/svc_config_key_rados.h +++ b/src/rgw/services/svc_config_key_rados.h @@ -31,7 +31,7 @@ class RGWSI_ConfigKey_RADOS : public RGWSI_ConfigKey bool maybe_insecure_mon_conn{false}; std::atomic_flag warned_insecure = ATOMIC_FLAG_INIT; - int do_start(optional_yield) override; + int do_start(optional_yield, const DoutPrefixProvider *dpp) override; void warn_if_insecure(); diff --git a/src/rgw/services/svc_finisher.cc b/src/rgw/services/svc_finisher.cc index 70938ecac107d..83e1b1514e42f 100644 --- a/src/rgw/services/svc_finisher.cc +++ b/src/rgw/services/svc_finisher.cc @@ -5,7 +5,7 @@ #include "svc_finisher.h" -int RGWSI_Finisher::do_start(optional_yield) +int RGWSI_Finisher::do_start(optional_yield, const DoutPrefixProvider *dpp) { finisher = new Finisher(cct); finisher->start(); diff --git a/src/rgw/services/svc_finisher.h b/src/rgw/services/svc_finisher.h index 9ce22dbce4a55..2f3ae52236aae 100644 --- a/src/rgw/services/svc_finisher.h +++ b/src/rgw/services/svc_finisher.h @@ -25,7 +25,7 @@ private: protected: void init() {} - int do_start(optional_yield y) override; + int do_start(optional_yield y, const DoutPrefixProvider *dpp) override; public: RGWSI_Finisher(CephContext *cct): RGWServiceInstance(cct) {} diff --git a/src/rgw/services/svc_mdlog.cc b/src/rgw/services/svc_mdlog.cc index cbc729ecfb796..b0f73830ed572 100644 --- a/src/rgw/services/svc_mdlog.cc +++ b/src/rgw/services/svc_mdlog.cc @@ -38,7 +38,7 @@ int RGWSI_MDLog::init(RGWSI_RADOS *_rados_svc, RGWSI_Zone *_zone_svc, RGWSI_SysO return 0; } -int RGWSI_MDLog::do_start(optional_yield y) +int RGWSI_MDLog::do_start(optional_yield y, const DoutPrefixProvider *dpp) { auto& current_period = svc.zone->get_current_period(); @@ -51,20 +51,21 @@ int RGWSI_MDLog::do_start(optional_yield y) if (run_sync && svc.zone->need_to_sync()) { // initialize the log period history - svc.mdlog->init_oldest_log_period(y); + svc.mdlog->init_oldest_log_period(y, dpp); } return 0; } int RGWSI_MDLog::read_history(RGWMetadataLogHistory *state, RGWObjVersionTracker *objv_tracker, - optional_yield y) const + optional_yield y, + const DoutPrefixProvider *dpp) const { auto obj_ctx = svc.sysobj->init_obj_ctx(); auto& pool = svc.zone->get_zone_params().log_pool; const auto& oid = RGWMetadataLogHistory::oid; bufferlist bl; - int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, objv_tracker, nullptr, y); + int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, objv_tracker, nullptr, y, dpp); if (ret < 0) { return ret; } @@ -277,16 +278,16 @@ Cursor RGWSI_MDLog::find_oldest_period(optional_yield y) return cursor; } -Cursor RGWSI_MDLog::init_oldest_log_period(optional_yield y) +Cursor RGWSI_MDLog::init_oldest_log_period(optional_yield y, const DoutPrefixProvider *dpp) { // read the mdlog history RGWMetadataLogHistory state; RGWObjVersionTracker objv; - int ret = read_history(&state, &objv, y); + int ret = read_history(&state, &objv, y, dpp); if (ret == -ENOENT) { // initialize the mdlog history and write it - ldout(cct, 10) << "initializing mdlog history" << dendl; + ldpp_dout(dpp, 10) << "initializing mdlog history" << dendl; auto cursor = find_oldest_period(y); if (!cursor) { return cursor; @@ -298,13 +299,13 @@ Cursor RGWSI_MDLog::init_oldest_log_period(optional_yield y) constexpr bool exclusive = true; // don't overwrite int ret = write_history(state, &objv, y, exclusive); if (ret < 0 && ret != -EEXIST) { - ldout(cct, 1) << "failed to write mdlog history: " + ldpp_dout(dpp, 1) << "failed to write mdlog history: " << cpp_strerror(ret) << dendl; return Cursor{ret}; } return cursor; } else if (ret < 0) { - ldout(cct, 1) << "failed to read mdlog history: " + ldpp_dout(dpp, 1) << "failed to read mdlog history: " << cpp_strerror(ret) << dendl; return Cursor{ret}; } @@ -346,17 +347,17 @@ Cursor RGWSI_MDLog::init_oldest_log_period(optional_yield y) return period_history->attach(std::move(period), y); } -Cursor RGWSI_MDLog::read_oldest_log_period(optional_yield y) const +Cursor RGWSI_MDLog::read_oldest_log_period(optional_yield y, const DoutPrefixProvider *dpp) const { RGWMetadataLogHistory state; - int ret = read_history(&state, nullptr, y); + int ret = read_history(&state, nullptr, y, dpp); if (ret < 0) { - ldout(cct, 1) << "failed to read mdlog history: " + ldpp_dout(dpp, 1) << "failed to read mdlog history: " << cpp_strerror(ret) << dendl; return Cursor{ret}; } - ldout(cct, 10) << "read mdlog history with oldest period id=" + ldpp_dout(dpp, 10) << "read mdlog history with oldest period id=" << state.oldest_period_id << " realm_epoch=" << state.oldest_realm_epoch << dendl; diff --git a/src/rgw/services/svc_mdlog.h b/src/rgw/services/svc_mdlog.h index da15e4b987308..4a5ed8ed85589 100644 --- a/src/rgw/services/svc_mdlog.h +++ b/src/rgw/services/svc_mdlog.h @@ -71,7 +71,7 @@ public: RGWSI_SysObj *_sysobj_svc, RGWSI_Cls *_cls_svc); - int do_start(optional_yield y) override; + int do_start(optional_yield y, const DoutPrefixProvider *dpp) override; // traverse all the way back to the beginning of the period history, and // return a cursor to the first period in a fully attached history @@ -79,11 +79,11 @@ public: /// initialize the oldest log period if it doesn't exist, and attach it to /// our current history - RGWPeriodHistory::Cursor init_oldest_log_period(optional_yield y); + RGWPeriodHistory::Cursor init_oldest_log_period(optional_yield y, const DoutPrefixProvider *dpp); /// read the oldest log period, and return a cursor to it in our existing /// period history - RGWPeriodHistory::Cursor read_oldest_log_period(optional_yield y) const; + RGWPeriodHistory::Cursor read_oldest_log_period(optional_yield y, const DoutPrefixProvider *dpp) const; /// read the oldest log period asynchronously and write its result to the /// given cursor pointer @@ -94,7 +94,7 @@ public: /// using a rados lock to provide atomicity RGWCoroutine* trim_log_period_cr(RGWPeriodHistory::Cursor period, RGWObjVersionTracker *objv) const; - int read_history(RGWMetadataLogHistory *state, RGWObjVersionTracker *objv_tracker,optional_yield y) const; + int read_history(RGWMetadataLogHistory *state, RGWObjVersionTracker *objv_tracker,optional_yield y, const DoutPrefixProvider *dpp) const; int write_history(const RGWMetadataLogHistory& state, RGWObjVersionTracker *objv_tracker, optional_yield y, bool exclusive = false); diff --git a/src/rgw/services/svc_meta_be.cc b/src/rgw/services/svc_meta_be.cc index 08bc03d915009..beaa22b1b8b4f 100644 --- a/src/rgw/services/svc_meta_be.cc +++ b/src/rgw/services/svc_meta_be.cc @@ -47,12 +47,13 @@ int RGWSI_MetaBackend::prepare_mutate(RGWSI_MetaBackend::Context *ctx, const string& key, const real_time& mtime, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { real_time orig_mtime; int ret = call_with_get_params(&orig_mtime, [&](GetParams& params) { - return get_entry(ctx, key, params, objv_tracker, y); + return get_entry(ctx, key, params, objv_tracker, y, dpp); }); if (ret < 0 && ret != -ENOENT) { return ret; @@ -76,12 +77,13 @@ int RGWSI_MetaBackend::do_mutate(RGWSI_MetaBackend::Context *ctx, RGWMDLogStatus op_type, optional_yield y, std::function f, - bool generic_prepare) + bool generic_prepare, + const DoutPrefixProvider *dpp) { int ret; if (generic_prepare) { - ret = prepare_mutate(ctx, key, mtime, objv_tracker, y); + ret = prepare_mutate(ctx, key, mtime, objv_tracker, y, dpp); if (ret < 0 || ret == STATUS_NO_APPLY) { return ret; @@ -109,16 +111,18 @@ int RGWSI_MetaBackend::get(Context *ctx, const string& key, GetParams& params, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { - return get_entry(ctx, key, params, objv_tracker, y); + return get_entry(ctx, key, params, objv_tracker, y, dpp); } int RGWSI_MetaBackend::put(Context *ctx, const string& key, PutParams& params, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { std::function f = [&]() { return put_entry(ctx, key, params, objv_tracker, y); @@ -128,14 +132,16 @@ int RGWSI_MetaBackend::put(Context *ctx, MDLOG_STATUS_WRITE, y, f, - false); + false, + dpp); } int RGWSI_MetaBackend::remove(Context *ctx, const string& key, RemoveParams& params, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { std::function f = [&]() { return remove_entry(ctx, key, params, objv_tracker, y); @@ -145,7 +151,8 @@ int RGWSI_MetaBackend::remove(Context *ctx, MDLOG_STATUS_REMOVE, y, f, - false); + false, + dpp); } int RGWSI_MetaBackend::mutate(Context *ctx, @@ -153,12 +160,14 @@ int RGWSI_MetaBackend::mutate(Context *ctx, MutateParams& params, RGWObjVersionTracker *objv_tracker, optional_yield y, - std::function f) + std::function f, + const DoutPrefixProvider *dpp) { return do_mutate(ctx, key, params.mtime, objv_tracker, params.op_type, y, f, - false); + false, + dpp); } int RGWSI_MetaBackend_Handler::call(std::optional bectx_params, diff --git a/src/rgw/services/svc_meta_be.h b/src/rgw/services/svc_meta_be.h index 0308c239e115b..ff57a0b3d996b 100644 --- a/src/rgw/services/svc_meta_be.h +++ b/src/rgw/services/svc_meta_be.h @@ -46,7 +46,8 @@ protected: const std::string& key, const ceph::real_time& mtime, RGWObjVersionTracker *objv_tracker, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); virtual int do_mutate(Context *ctx, const std::string& key, @@ -54,7 +55,8 @@ protected: RGWMDLogStatus op_type, optional_yield y, std::function f, - bool generic_prepare); + bool generic_prepare, + const DoutPrefixProvider *dpp); virtual int pre_modify(Context *ctx, const std::string& key, @@ -140,7 +142,8 @@ public: const std::string& key, RGWSI_MetaBackend::GetParams& params, RGWObjVersionTracker *objv_tracker, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; virtual int put_entry(RGWSI_MetaBackend::Context *ctx, const std::string& key, RGWSI_MetaBackend::PutParams& params, @@ -175,26 +178,30 @@ public: const std::string& key, GetParams ¶ms, RGWObjVersionTracker *objv_tracker, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); virtual int put(Context *ctx, const std::string& key, PutParams& params, RGWObjVersionTracker *objv_tracker, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); virtual int remove(Context *ctx, const std::string& key, RemoveParams& params, RGWObjVersionTracker *objv_tracker, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); virtual int mutate(Context *ctx, const std::string& key, MutateParams& params, RGWObjVersionTracker *objv_tracker, optional_yield y, - std::function f); + std::function f, + const DoutPrefixProvider *dpp); }; class RGWSI_MetaBackend_Handler { @@ -218,30 +225,31 @@ public: int get(const std::string& key, RGWSI_MetaBackend::GetParams ¶ms, RGWObjVersionTracker *objv_tracker, - optional_yield y) { - return be->get(be_ctx, key, params, objv_tracker, y); + optional_yield y, const DoutPrefixProvider *dpp) { + return be->get(be_ctx, key, params, objv_tracker, y, dpp); } int put(const std::string& key, RGWSI_MetaBackend::PutParams& params, RGWObjVersionTracker *objv_tracker, - optional_yield y) { - return be->put(be_ctx, key, params, objv_tracker, y); + optional_yield y, const DoutPrefixProvider *dpp) { + return be->put(be_ctx, key, params, objv_tracker, y, dpp); } int remove(const std::string& key, RGWSI_MetaBackend::RemoveParams& params, RGWObjVersionTracker *objv_tracker, - optional_yield y) { - return be->remove(be_ctx, key, params, objv_tracker, y); + optional_yield y, const DoutPrefixProvider *dpp) { + return be->remove(be_ctx, key, params, objv_tracker, y, dpp); } int mutate(const std::string& key, RGWSI_MetaBackend::MutateParams& params, RGWObjVersionTracker *objv_tracker, optional_yield y, - std::function f) { - return be->mutate(be_ctx, key, params, objv_tracker, y, f); + std::function f, + const DoutPrefixProvider *dpp) { + return be->mutate(be_ctx, key, params, objv_tracker, y, f, dpp); } int list_init(const string& marker) { diff --git a/src/rgw/services/svc_meta_be_otp.cc b/src/rgw/services/svc_meta_be_otp.cc index 986296a118bc5..e2349a17a23f2 100644 --- a/src/rgw/services/svc_meta_be_otp.cc +++ b/src/rgw/services/svc_meta_be_otp.cc @@ -44,7 +44,8 @@ int RGWSI_MetaBackend_OTP::get_entry(RGWSI_MetaBackend::Context *_ctx, const string& key, RGWSI_MetaBackend::GetParams& _params, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { RGWSI_MBOTP_GetParams& params = static_cast(_params); diff --git a/src/rgw/services/svc_meta_be_otp.h b/src/rgw/services/svc_meta_be_otp.h index 85b9d16b3d323..7efc3fba11d1e 100644 --- a/src/rgw/services/svc_meta_be_otp.h +++ b/src/rgw/services/svc_meta_be_otp.h @@ -77,7 +77,8 @@ public: const string& key, RGWSI_MetaBackend::GetParams& _params, RGWObjVersionTracker *objv_tracker, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); int put_entry(RGWSI_MetaBackend::Context *ctx, const string& key, RGWSI_MetaBackend::PutParams& _params, diff --git a/src/rgw/services/svc_meta_be_sobj.cc b/src/rgw/services/svc_meta_be_sobj.cc index e325b4ae71d58..9696e3d2f8bb0 100644 --- a/src/rgw/services/svc_meta_be_sobj.cc +++ b/src/rgw/services/svc_meta_be_sobj.cc @@ -140,7 +140,8 @@ int RGWSI_MetaBackend_SObj::get_entry(RGWSI_MetaBackend::Context *_ctx, const string& key, GetParams& _params, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { RGWSI_MetaBackend_SObj::Context_SObj *ctx = static_cast(_ctx); RGWSI_MBSObj_GetParams& params = static_cast(_params); @@ -151,7 +152,7 @@ int RGWSI_MetaBackend_SObj::get_entry(RGWSI_MetaBackend::Context *_ctx, return rgw_get_system_obj(*ctx->obj_ctx, pool, oid, *params.pbl, objv_tracker, params.pmtime, - y, + y, dpp, params.pattrs, params.cache_info, params.refresh_version); } diff --git a/src/rgw/services/svc_meta_be_sobj.h b/src/rgw/services/svc_meta_be_sobj.h index 145850b974785..a6033d3ddf93a 100644 --- a/src/rgw/services/svc_meta_be_sobj.h +++ b/src/rgw/services/svc_meta_be_sobj.h @@ -148,7 +148,8 @@ public: const string& key, RGWSI_MetaBackend::GetParams& params, RGWObjVersionTracker *objv_tracker, - optional_yield y) override; + optional_yield y, + const DoutPrefixProvider *dpp) override; int put_entry(RGWSI_MetaBackend::Context *ctx, const string& key, RGWSI_MetaBackend::PutParams& params, diff --git a/src/rgw/services/svc_notify.cc b/src/rgw/services/svc_notify.cc index bb71f3b577a93..3835671c4ba8b 100644 --- a/src/rgw/services/svc_notify.cc +++ b/src/rgw/services/svc_notify.cc @@ -238,20 +238,20 @@ void RGWSI_Notify::finalize_watch() delete[] watchers; } -int RGWSI_Notify::do_start(optional_yield y) +int RGWSI_Notify::do_start(optional_yield y, const DoutPrefixProvider *dpp) { - int r = zone_svc->start(y); + int r = zone_svc->start(y, dpp); if (r < 0) { return r; } assert(zone_svc->is_started()); /* otherwise there's an ordering problem */ - r = rados_svc->start(y); + r = rados_svc->start(y, dpp); if (r < 0) { return r; } - r = finisher_svc->start(y); + r = finisher_svc->start(y, dpp); if (r < 0) { return r; } diff --git a/src/rgw/services/svc_notify.h b/src/rgw/services/svc_notify.h index 567b256d064b9..e4378bb9920dd 100644 --- a/src/rgw/services/svc_notify.h +++ b/src/rgw/services/svc_notify.h @@ -63,7 +63,7 @@ private: rados_svc = _rados_svc; finisher_svc = _finisher_svc; } - int do_start(optional_yield) override; + int do_start(optional_yield, const DoutPrefixProvider *dpp) override; void shutdown() override; int unwatch(RGWSI_RADOS::Obj& obj, uint64_t watch_handle); diff --git a/src/rgw/services/svc_otp.cc b/src/rgw/services/svc_otp.cc index 512c542eb2d48..6adad51efba6d 100644 --- a/src/rgw/services/svc_otp.cc +++ b/src/rgw/services/svc_otp.cc @@ -60,7 +60,7 @@ void RGWSI_OTP::init(RGWSI_Zone *_zone_svc, svc.meta_be = _meta_be_svc; } -int RGWSI_OTP::do_start(optional_yield) +int RGWSI_OTP::do_start(optional_yield, const DoutPrefixProvider *dpp) { /* create first backend handler for bucket entrypoints */ @@ -88,13 +88,13 @@ int RGWSI_OTP::read_all(RGWSI_OTP_BE_Ctx& ctx, otp_devices_list_t *devices, real_time *pmtime, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, const DoutPrefixProvider *dpp) { RGWSI_MBOTP_GetParams params; params.pdevices = devices; params.pmtime = pmtime; - int ret = svc.meta_be->get_entry(ctx.get(), key, params, objv_tracker, y); + int ret = svc.meta_be->get_entry(ctx.get(), key, params, objv_tracker, y, dpp); if (ret < 0) { return ret; } @@ -107,14 +107,16 @@ int RGWSI_OTP::read_all(RGWSI_OTP_BE_Ctx& ctx, otp_devices_list_t *devices, real_time *pmtime, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { return read_all(ctx, uid.to_str(), devices, pmtime, objv_tracker, - y); + y, + dpp); } int RGWSI_OTP::store_all(RGWSI_OTP_BE_Ctx& ctx, diff --git a/src/rgw/services/svc_otp.h b/src/rgw/services/svc_otp.h index 76824bfdf4326..673ba4d9f5caf 100644 --- a/src/rgw/services/svc_otp.h +++ b/src/rgw/services/svc_otp.h @@ -31,7 +31,7 @@ class RGWSI_OTP : public RGWServiceInstance RGWSI_OTP_BE_Handler be_handler; std::unique_ptr be_module; - int do_start(optional_yield) override; + int do_start(optional_yield, const DoutPrefixProvider *dpp) override; public: struct Svc { @@ -57,13 +57,15 @@ public: otp_devices_list_t *devices, real_time *pmtime, RGWObjVersionTracker *objv_tracker, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); int read_all(RGWSI_OTP_BE_Ctx& ctx, const rgw_user& uid, otp_devices_list_t *devices, real_time *pmtime, RGWObjVersionTracker *objv_tracker, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); int store_all(RGWSI_OTP_BE_Ctx& ctx, const string& key, const otp_devices_list_t& devices, diff --git a/src/rgw/services/svc_rados.cc b/src/rgw/services/svc_rados.cc index 1e1b12023f622..6d207581ba224 100644 --- a/src/rgw/services/svc_rados.cc +++ b/src/rgw/services/svc_rados.cc @@ -21,7 +21,7 @@ RGWSI_RADOS::~RGWSI_RADOS() { } -int RGWSI_RADOS::do_start(optional_yield) +int RGWSI_RADOS::do_start(optional_yield, const DoutPrefixProvider *dpp) { int ret = rados.init_with_context(cct); if (ret < 0) { diff --git a/src/rgw/services/svc_rados.h b/src/rgw/services/svc_rados.h index b09cd6d73a975..57b4cd54209ff 100644 --- a/src/rgw/services/svc_rados.h +++ b/src/rgw/services/svc_rados.h @@ -31,7 +31,7 @@ class RGWSI_RADOS : public RGWServiceInstance librados::Rados rados; std::unique_ptr async_processor; - int do_start(optional_yield) override; + int do_start(optional_yield, const DoutPrefixProvider *dpp) override; public: struct OpenParams { diff --git a/src/rgw/services/svc_sync_modules.cc b/src/rgw/services/svc_sync_modules.cc index f232fe5130a8a..317b3b0fdb61d 100644 --- a/src/rgw/services/svc_sync_modules.cc +++ b/src/rgw/services/svc_sync_modules.cc @@ -16,7 +16,7 @@ void RGWSI_SyncModules::init(RGWSI_Zone *zone_svc) rgw_register_sync_modules(sync_modules_manager); } -int RGWSI_SyncModules::do_start(optional_yield) +int RGWSI_SyncModules::do_start(optional_yield, const DoutPrefixProvider *dpp) { auto& zone_public_config = svc.zone->get_zone(); diff --git a/src/rgw/services/svc_sync_modules.h b/src/rgw/services/svc_sync_modules.h index 39a51f58091d5..0640ced1d57b1 100644 --- a/src/rgw/services/svc_sync_modules.h +++ b/src/rgw/services/svc_sync_modules.h @@ -28,7 +28,7 @@ public: } void init(RGWSI_Zone *zone_svc); - int do_start(optional_yield) override; + int do_start(optional_yield, const DoutPrefixProvider *dpp) override; RGWSyncModuleInstanceRef& get_sync_module() { return sync_module; } }; diff --git a/src/rgw/services/svc_sys_obj.cc b/src/rgw/services/svc_sys_obj.cc index 881a8f955d729..b03f339ff7b54 100644 --- a/src/rgw/services/svc_sys_obj.cc +++ b/src/rgw/services/svc_sys_obj.cc @@ -29,7 +29,7 @@ RGWSI_SysObj::Obj::ROp::ROp(Obj& _source) : source(_source) { state.emplace(); } -int RGWSI_SysObj::Obj::ROp::stat(optional_yield y) +int RGWSI_SysObj::Obj::ROp::stat(optional_yield y, const DoutPrefixProvider *dpp) { RGWSI_SysObj_Core *svc = source.core_svc; rgw_raw_obj& obj = source.obj; @@ -37,7 +37,7 @@ int RGWSI_SysObj::Obj::ROp::stat(optional_yield y) return svc->stat(source.get_ctx(), *state, obj, attrs, raw_attrs, lastmod, obj_size, - objv_tracker, y); + objv_tracker, y, dpp); } int RGWSI_SysObj::Obj::ROp::read(int64_t ofs, int64_t end, bufferlist *bl, diff --git a/src/rgw/services/svc_sys_obj.h b/src/rgw/services/svc_sys_obj.h index 5fc2ea27dc3db..05c4929084f4d 100644 --- a/src/rgw/services/svc_sys_obj.h +++ b/src/rgw/services/svc_sys_obj.h @@ -97,7 +97,7 @@ public: ROp(Obj& _source); - int stat(optional_yield y); + int stat(optional_yield y, const DoutPrefixProvider *dpp); int read(int64_t ofs, int64_t end, bufferlist *pbl, optional_yield y); int read(bufferlist *pbl, optional_yield y) { return read(0, -1, pbl, y); diff --git a/src/rgw/services/svc_sys_obj_cache.cc b/src/rgw/services/svc_sys_obj_cache.cc index 9be71f706708c..ad67f29e0318c 100644 --- a/src/rgw/services/svc_sys_obj_cache.cc +++ b/src/rgw/services/svc_sys_obj_cache.cc @@ -30,19 +30,19 @@ public: } }; -int RGWSI_SysObj_Cache::do_start(optional_yield y) +int RGWSI_SysObj_Cache::do_start(optional_yield y, const DoutPrefixProvider *dpp) { int r = asocket.start(); if (r < 0) { return r; } - r = RGWSI_SysObj_Core::do_start(y); + r = RGWSI_SysObj_Core::do_start(y, dpp); if (r < 0) { return r; } - r = notify_svc->start(y); + r = notify_svc->start(y, dpp); if (r < 0) { return r; } diff --git a/src/rgw/services/svc_sys_obj_cache.h b/src/rgw/services/svc_sys_obj_cache.h index b2abb2f550566..a0184e89df2bd 100644 --- a/src/rgw/services/svc_sys_obj_cache.h +++ b/src/rgw/services/svc_sys_obj_cache.h @@ -33,7 +33,7 @@ protected: notify_svc = _notify_svc; } - int do_start(optional_yield) override; + int do_start(optional_yield, const DoutPrefixProvider *dpp) override; void shutdown() override; int raw_stat(const rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *epoch, diff --git a/src/rgw/services/svc_sys_obj_core.cc b/src/rgw/services/svc_sys_obj_core.cc index 04bff6563ef3b..dee172b5f42bb 100644 --- a/src/rgw/services/svc_sys_obj_core.cc +++ b/src/rgw/services/svc_sys_obj_core.cc @@ -53,14 +53,15 @@ int RGWSI_SysObj_Core::get_system_obj_state_impl(RGWSysObjectCtxBase *rctx, const rgw_raw_obj& obj, RGWSysObjState **state, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { if (obj.empty()) { return -EINVAL; } RGWSysObjState *s = rctx->get_state(obj); - ldout(cct, 20) << "get_system_obj_state: rctx=" << (void *)rctx << " obj=" << obj << " state=" << (void *)s << " s->prefetch_data=" << s->prefetch_data << dendl; + ldpp_dout(dpp, 20) << "get_system_obj_state: rctx=" << (void *)rctx << " obj=" << obj << " state=" << (void *)s << " s->prefetch_data=" << s->prefetch_data << dendl; *state = s; if (s->has_attrs) { return 0; @@ -83,11 +84,11 @@ int RGWSI_SysObj_Core::get_system_obj_state_impl(RGWSysObjectCtxBase *rctx, s->has_attrs = true; s->obj_tag = s->attrset[RGW_ATTR_ID_TAG]; - if (s->obj_tag.length()) - ldout(cct, 20) << "get_system_obj_state: setting s->obj_tag to " - << s->obj_tag.c_str() << dendl; - else - ldout(cct, 20) << "get_system_obj_state: s->obj_tag was set empty" << dendl; + if (s->obj_tag.length()) { + ldpp_dout(dpp, 20) << "get_system_obj_state: setting s->obj_tag to " << s->obj_tag.c_str() << dendl; + } else { + ldpp_dout(dpp, 20) << "get_system_obj_state: s->obj_tag was set empty" << dendl; + } return 0; } @@ -96,12 +97,13 @@ int RGWSI_SysObj_Core::get_system_obj_state(RGWSysObjectCtxBase *rctx, const rgw_raw_obj& obj, RGWSysObjState **state, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { int ret; do { - ret = get_system_obj_state_impl(rctx, obj, state, objv_tracker, y); + ret = get_system_obj_state_impl(rctx, obj, state, objv_tracker, y, dpp); } while (ret == -EAGAIN); return ret; @@ -158,11 +160,12 @@ int RGWSI_SysObj_Core::stat(RGWSysObjectCtxBase& obj_ctx, real_time *lastmod, uint64_t *obj_size, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { RGWSysObjState *astate = nullptr; - int r = get_system_obj_state(&obj_ctx, obj, &astate, objv_tracker, y); + int r = get_system_obj_state(&obj_ctx, obj, &astate, objv_tracker, y, dpp); if (r < 0) return r; @@ -179,7 +182,7 @@ int RGWSI_SysObj_Core::stat(RGWSysObjectCtxBase& obj_ctx, if (cct->_conf->subsys.should_gather()) { map::iterator iter; for (iter = attrs->begin(); iter != attrs->end(); ++iter) { - ldout(cct, 20) << "Read xattr: " << iter->first << dendl; + ldpp_dout(dpp, 20) << "Read xattr: " << iter->first << dendl; } } } diff --git a/src/rgw/services/svc_sys_obj_core.h b/src/rgw/services/svc_sys_obj_core.h index 24659ae209d68..39a4f34a5518c 100644 --- a/src/rgw/services/svc_sys_obj_core.h +++ b/src/rgw/services/svc_sys_obj_core.h @@ -119,11 +119,13 @@ protected: int get_system_obj_state_impl(RGWSysObjectCtxBase *rctx, const rgw_raw_obj& obj, RGWSysObjState **state, RGWObjVersionTracker *objv_tracker, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); int get_system_obj_state(RGWSysObjectCtxBase *rctx, const rgw_raw_obj& obj, RGWSysObjState **state, RGWObjVersionTracker *objv_tracker, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); int stat(RGWSysObjectCtxBase& obj_ctx, RGWSI_SysObj_Obj_GetObjState& state, @@ -133,7 +135,8 @@ protected: real_time *lastmod, uint64_t *obj_size, RGWObjVersionTracker *objv_tracker, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); public: RGWSI_SysObj_Core(CephContext *cct): RGWServiceInstance(cct) {} diff --git a/src/rgw/services/svc_user.h b/src/rgw/services/svc_user.h index 5c27e587c512e..902be756d91de 100644 --- a/src/rgw/services/svc_user.h +++ b/src/rgw/services/svc_user.h @@ -49,7 +49,8 @@ public: real_time * const pmtime, rgw_cache_entry_info * const cache_info, map * const pattrs, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; virtual int store_user_info(RGWSI_MetaBackend::Context *ctx, const RGWUserInfo& info, @@ -58,30 +59,35 @@ public: const real_time& mtime, bool exclusive, map *attrs, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; virtual int remove_user_info(RGWSI_MetaBackend::Context *ctx, const RGWUserInfo& info, RGWObjVersionTracker *objv_tracker, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; virtual int get_user_info_by_email(RGWSI_MetaBackend::Context *ctx, const string& email, RGWUserInfo *info, RGWObjVersionTracker *objv_tracker, real_time *pmtime, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; virtual int get_user_info_by_swift(RGWSI_MetaBackend::Context *ctx, const string& swift_name, RGWUserInfo *info, /* out */ RGWObjVersionTracker * const objv_tracker, real_time * const pmtime, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; virtual int get_user_info_by_access_key(RGWSI_MetaBackend::Context *ctx, const std::string& access_key, RGWUserInfo *info, RGWObjVersionTracker* objv_tracker, real_time *pmtime, - optional_yield y) = 0; + optional_yield y, + const DoutPrefixProvider *dpp) = 0; virtual int add_bucket(RGWSI_MetaBackend::Context *ctx, const rgw_user& user, diff --git a/src/rgw/services/svc_user_rados.cc b/src/rgw/services/svc_user_rados.cc index 14dcb6367f287..d701baed3e2a5 100644 --- a/src/rgw/services/svc_user_rados.cc +++ b/src/rgw/services/svc_user_rados.cc @@ -81,7 +81,7 @@ void RGWSI_User_RADOS::init(RGWSI_RADOS *_rados_svc, svc.sync_modules = _sync_modules_svc; } -int RGWSI_User_RADOS::do_start(optional_yield) +int RGWSI_User_RADOS::do_start(optional_yield, const DoutPrefixProvider *dpp) { uinfo_cache.reset(new RGWChainedCacheImpl); uinfo_cache->init(svc.cache); @@ -113,7 +113,8 @@ int RGWSI_User_RADOS::read_user_info(RGWSI_MetaBackend::Context *ctx, real_time * const pmtime, rgw_cache_entry_info * const cache_info, map * const pattrs, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { if(user.id == RGW_USER_ANON_ID) { ldout(svc.meta_be->ctx(), 20) << "RGWSI_User_RADOS::read_user_info(): anonymous user" << dendl; @@ -125,7 +126,7 @@ int RGWSI_User_RADOS::read_user_info(RGWSI_MetaBackend::Context *ctx, RGWSI_MBSObj_GetParams params(&bl, pattrs, pmtime); params.set_cache_info(cache_info); - int ret = svc.meta_be->get_entry(ctx, get_meta_key(user), params, objv_tracker, y); + int ret = svc.meta_be->get_entry(ctx, get_meta_key(user), params, objv_tracker, y, dpp); if (ret < 0) { return ret; } @@ -186,7 +187,7 @@ public: ui.user_id = info.user_id; } - int prepare() { + int prepare(const DoutPrefixProvider *dpp) { if (objv_tracker) { ot = *objv_tracker; } @@ -206,7 +207,7 @@ public: auto& k = iter->second; /* check if swift mapping exists */ RGWUserInfo inf; - int r = svc.user->get_user_info_by_swift(ctx, k.id, &inf, nullptr, nullptr, y); + int r = svc.user->get_user_info_by_swift(ctx, k.id, &inf, nullptr, nullptr, y, dpp); if (r >= 0 && inf.user_id != info.user_id && (!old_info || inf.user_id != old_info->user_id)) { ldout(svc.meta_be->ctx(), 0) << "WARNING: can't store user info, swift id (" << k.id @@ -221,7 +222,7 @@ public: continue; auto& k = iter->second; RGWUserInfo inf; - int r = svc.user->get_user_info_by_access_key(ctx, k.id, &inf, nullptr, nullptr, y); + int r = svc.user->get_user_info_by_access_key(ctx, k.id, &inf, nullptr, nullptr, y, dpp); if (r >= 0 && inf.user_id != info.user_id && (!old_info || inf.user_id != old_info->user_id)) { ldout(svc.meta_be->ctx(), 0) << "WARNING: can't store user info, access key already mapped to another user" << dendl; @@ -232,21 +233,21 @@ public: return 0; } - int put() { + int put(const DoutPrefixProvider *dpp) { bufferlist data_bl; encode(ui, data_bl); encode(info, data_bl); RGWSI_MBSObj_PutParams params(data_bl, pattrs, mtime, exclusive); - int ret = svc.meta_be->put(ctx, RGWSI_User::get_meta_key(info.user_id), params, &ot, y); + int ret = svc.meta_be->put(ctx, RGWSI_User::get_meta_key(info.user_id), params, &ot, y, dpp); if (ret < 0) return ret; return 0; } - int complete() { + int complete(const DoutPrefixProvider *dpp) { int ret; bufferlist link_bl; @@ -288,7 +289,7 @@ public: } if (old_info) { - ret = remove_old_indexes(*old_info, info, y); + ret = remove_old_indexes(*old_info, info, y, dpp); if (ret < 0) { return ret; } @@ -297,7 +298,7 @@ public: return 0; } - int remove_old_indexes(const RGWUserInfo& old_info, const RGWUserInfo& new_info, optional_yield y) { + int remove_old_indexes(const RGWUserInfo& old_info, const RGWUserInfo& new_info, optional_yield y, const DoutPrefixProvider *dpp) { int ret; if (!old_info.user_id.empty() && @@ -306,7 +307,7 @@ public: ldout(svc.user->ctx(), 0) << "ERROR: tenant mismatch: " << old_info.user_id.tenant << " != " << new_info.user_id.tenant << dendl; return -EINVAL; } - ret = svc.user->remove_uid_index(ctx, old_info, nullptr, y); + ret = svc.user->remove_uid_index(ctx, old_info, nullptr, y, dpp); if (ret < 0 && ret != -ENOENT) { set_err_msg("ERROR: could not remove index for uid " + old_info.user_id.to_str()); return ret; @@ -359,7 +360,8 @@ int RGWSI_User_RADOS::store_user_info(RGWSI_MetaBackend::Context *ctx, const real_time& mtime, bool exclusive, map *attrs, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { PutOperation op(svc, ctx, info, old_info, @@ -368,17 +370,17 @@ int RGWSI_User_RADOS::store_user_info(RGWSI_MetaBackend::Context *ctx, attrs, y); - int r = op.prepare(); + int r = op.prepare(dpp); if (r < 0) { return r; } - r = op.put(); + r = op.put(dpp); if (r < 0) { return r; } - r = op.complete(); + r = op.complete(dpp); if (r < 0) { return r; } @@ -427,7 +429,8 @@ int RGWSI_User_RADOS::remove_swift_name_index(RGWSI_MetaBackend::Context *_ctx, int RGWSI_User_RADOS::remove_user_info(RGWSI_MetaBackend::Context *_ctx, const RGWUserInfo& info, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, + const DoutPrefixProvider *dpp) { int ret; @@ -473,7 +476,7 @@ int RGWSI_User_RADOS::remove_user_info(RGWSI_MetaBackend::Context *_ctx, return ret; } - ret = remove_uid_index(ctx, info, objv_tracker, y); + ret = remove_uid_index(ctx, info, objv_tracker, y, dpp); if (ret < 0 && ret != -ENOENT) { return ret; } @@ -482,12 +485,12 @@ int RGWSI_User_RADOS::remove_user_info(RGWSI_MetaBackend::Context *_ctx, } int RGWSI_User_RADOS::remove_uid_index(RGWSI_MetaBackend::Context *ctx, const RGWUserInfo& user_info, RGWObjVersionTracker *objv_tracker, - optional_yield y) + optional_yield y, const DoutPrefixProvider *dpp) { ldout(cct, 10) << "removing user index: " << user_info.user_id << dendl; RGWSI_MBSObj_RemoveParams params; - int ret = svc.meta_be->remove(ctx, get_meta_key(user_info.user_id), params, objv_tracker, y); + int ret = svc.meta_be->remove(ctx, get_meta_key(user_info.user_id), params, objv_tracker, y, dpp); if (ret < 0 && ret != -ENOENT && ret != -ECANCELED) { string key; user_info.user_id.to_str(key); @@ -504,7 +507,7 @@ int RGWSI_User_RADOS::get_user_info_from_index(RGWSI_MetaBackend::Context *_ctx, const rgw_pool& pool, RGWUserInfo *info, RGWObjVersionTracker * const objv_tracker, - real_time * const pmtime, optional_yield y) + real_time * const pmtime, optional_yield y, const DoutPrefixProvider *dpp) { RGWSI_MetaBackend_SObj::Context_SObj *ctx = static_cast(_ctx); @@ -523,7 +526,7 @@ int RGWSI_User_RADOS::get_user_info_from_index(RGWSI_MetaBackend::Context *_ctx, bufferlist bl; RGWUID uid; - int ret = rgw_get_system_obj(*ctx->obj_ctx, pool, key, bl, nullptr, &e.mtime, y); + int ret = rgw_get_system_obj(*ctx->obj_ctx, pool, key, bl, nullptr, &e.mtime, y, dpp); if (ret < 0) return ret; @@ -535,7 +538,7 @@ int RGWSI_User_RADOS::get_user_info_from_index(RGWSI_MetaBackend::Context *_ctx, int ret = read_user_info(ctx, uid.user_id, &e.info, &e.objv_tracker, nullptr, &cache_info, nullptr, - y); + y, dpp); if (ret < 0) { return ret; } @@ -562,10 +565,11 @@ int RGWSI_User_RADOS::get_user_info_from_index(RGWSI_MetaBackend::Context *_ctx, int RGWSI_User_RADOS::get_user_info_by_email(RGWSI_MetaBackend::Context *ctx, const string& email, RGWUserInfo *info, RGWObjVersionTracker *objv_tracker, - real_time *pmtime, optional_yield y) + real_time *pmtime, optional_yield y, + const DoutPrefixProvider *dpp) { return get_user_info_from_index(ctx, email, svc.zone->get_zone_params().user_email_pool, - info, objv_tracker, pmtime, y); + info, objv_tracker, pmtime, y, dpp); } /** @@ -576,12 +580,13 @@ int RGWSI_User_RADOS::get_user_info_by_swift(RGWSI_MetaBackend::Context *ctx, const string& swift_name, RGWUserInfo *info, /* out */ RGWObjVersionTracker * const objv_tracker, - real_time * const pmtime, optional_yield y) + real_time * const pmtime, optional_yield y, + const DoutPrefixProvider *dpp) { return get_user_info_from_index(ctx, swift_name, svc.zone->get_zone_params().user_swift_pool, - info, objv_tracker, pmtime, y); + info, objv_tracker, pmtime, y, dpp); } /** @@ -592,12 +597,13 @@ int RGWSI_User_RADOS::get_user_info_by_access_key(RGWSI_MetaBackend::Context *ct const std::string& access_key, RGWUserInfo *info, RGWObjVersionTracker* objv_tracker, - real_time *pmtime, optional_yield y) + real_time *pmtime, optional_yield y, + const DoutPrefixProvider *dpp) { return get_user_info_from_index(ctx, access_key, svc.zone->get_zone_params().user_keys_pool, - info, objv_tracker, pmtime, y); + info, objv_tracker, pmtime, y, dpp); } int RGWSI_User_RADOS::cls_user_update_buckets(rgw_raw_obj& obj, list& entries, bool add, optional_yield y) diff --git a/src/rgw/services/svc_user_rados.h b/src/rgw/services/svc_user_rados.h index 7014e3430ab30..05244be7bee0a 100644 --- a/src/rgw/services/svc_user_rados.h +++ b/src/rgw/services/svc_user_rados.h @@ -63,10 +63,11 @@ class RGWSI_User_RADOS : public RGWSI_User RGWUserInfo *info, RGWObjVersionTracker * const objv_tracker, real_time * const pmtime, - optional_yield y); + optional_yield y, + const DoutPrefixProvider *dpp); int remove_uid_index(RGWSI_MetaBackend::Context *ctx, const RGWUserInfo& user_info, RGWObjVersionTracker *objv_tracker, - optional_yield y); + optional_yield y, const DoutPrefixProvider *dpp); int remove_key_index(RGWSI_MetaBackend::Context *ctx, const RGWAccessKey& access_key, optional_yield y); int remove_email_index(RGWSI_MetaBackend::Context *ctx, const string& email, optional_yield y); @@ -93,7 +94,7 @@ class RGWSI_User_RADOS : public RGWSI_User int cls_user_get_header(const rgw_user& user, cls_user_header *header, optional_yield y); int cls_user_get_header_async(const string& user, RGWGetUserHeader_CB *cb); - int do_start(optional_yield) override; + int do_start(optional_yield, const DoutPrefixProvider *dpp) override; public: struct Svc { RGWSI_User_RADOS *user{nullptr}; @@ -126,7 +127,8 @@ public: real_time * const pmtime, rgw_cache_entry_info * const cache_info, map * const pattrs, - optional_yield y) override; + optional_yield y, + const DoutPrefixProvider *dpp) override; int store_user_info(RGWSI_MetaBackend::Context *ctx, const RGWUserInfo& info, @@ -135,30 +137,35 @@ public: const real_time& mtime, bool exclusive, map *attrs, - optional_yield y) override; + optional_yield y, + const DoutPrefixProvider *dpp) override; int remove_user_info(RGWSI_MetaBackend::Context *ctx, const RGWUserInfo& info, RGWObjVersionTracker *objv_tracker, - optional_yield y) override; + optional_yield y, + const DoutPrefixProvider *dpp) override; int get_user_info_by_email(RGWSI_MetaBackend::Context *ctx, const string& email, RGWUserInfo *info, RGWObjVersionTracker *objv_tracker, real_time *pmtime, - optional_yield y) override; + optional_yield y, + const DoutPrefixProvider *dpp) override; int get_user_info_by_swift(RGWSI_MetaBackend::Context *ctx, const string& swift_name, RGWUserInfo *info, /* out */ RGWObjVersionTracker * const objv_tracker, real_time * const pmtime, - optional_yield y) override; + optional_yield y, + const DoutPrefixProvider *dpp) override; int get_user_info_by_access_key(RGWSI_MetaBackend::Context *ctx, const std::string& access_key, RGWUserInfo *info, RGWObjVersionTracker* objv_tracker, real_time *pmtime, - optional_yield y) override; + optional_yield y, + const DoutPrefixProvider *dpp) override; /* user buckets directory */ diff --git a/src/rgw/services/svc_zone.cc b/src/rgw/services/svc_zone.cc index 1e67fe89da667..fa3e1b52aab01 100644 --- a/src/rgw/services/svc_zone.cc +++ b/src/rgw/services/svc_zone.cc @@ -64,23 +64,23 @@ bool RGWSI_Zone::zone_syncs_from(const RGWZone& target_zone, const RGWZone& sour sync_modules_svc->get_manager()->supports_data_export(source_zone.tier_type); } -int RGWSI_Zone::do_start(optional_yield y) +int RGWSI_Zone::do_start(optional_yield y, const DoutPrefixProvider *dpp) { - int ret = sysobj_svc->start(y); + int ret = sysobj_svc->start(y, dpp); if (ret < 0) { return ret; } assert(sysobj_svc->is_started()); /* if not then there's ordering issue */ - ret = rados_svc->start(y); + ret = rados_svc->start(y, dpp); if (ret < 0) { return ret; } ret = realm->init(cct, sysobj_svc, y); if (ret < 0 && ret != -ENOENT) { - ldout(cct, 0) << "failed reading realm info: ret "<< ret << " " << cpp_strerror(-ret) << dendl; + ldpp_dout(dpp, 0) << "failed reading realm info: ret "<< ret << " " << cpp_strerror(-ret) << dendl; return ret; } else if (ret != -ENOENT) { ldout(cct, 20) << "realm " << realm->get_name() << " " << realm->get_id() << dendl; @@ -93,13 +93,13 @@ int RGWSI_Zone::do_start(optional_yield y) ldout(cct, 20) << "current period " << current_period->get_id() << dendl; } - ret = replace_region_with_zonegroup(y); + ret = replace_region_with_zonegroup(dpp, y); if (ret < 0) { lderr(cct) << "failed converting region to zonegroup : ret "<< ret << " " << cpp_strerror(-ret) << dendl; return ret; } - ret = convert_regionmap(y); + ret = convert_regionmap(dpp, y); if (ret < 0) { lderr(cct) << "failed converting regionmap: " << cpp_strerror(-ret) << dendl; return ret; @@ -118,7 +118,7 @@ int RGWSI_Zone::do_start(optional_yield y) bool using_local = (!zg_initialized); if (using_local) { ldout(cct, 10) << " cannot find current period zonegroup using local zonegroup" << dendl; - ret = init_zg_from_local(&creating_defaults, y); + ret = init_zg_from_local(dpp, &creating_defaults, y); if (ret < 0) { return ret; } @@ -153,7 +153,7 @@ int RGWSI_Zone::do_start(optional_yield y) return -EINVAL; } ldout(cct, 1) << "Cannot find zone id=" << zone_params->get_id() << " (name=" << zone_params->get_name() << "), switching to local zonegroup configuration" << dendl; - ret = init_zg_from_local(&creating_defaults, y); + ret = init_zg_from_local(dpp, &creating_defaults, y); if (ret < 0) { return ret; } @@ -190,7 +190,7 @@ int RGWSI_Zone::do_start(optional_yield y) &target_zones, false); /* relaxed: also get all zones that we allow to sync to/from */ - ret = sync_modules_svc->start(y); + ret = sync_modules_svc->start(y, dpp); if (ret < 0) { return ret; } @@ -344,7 +344,7 @@ int RGWSI_Zone::list_periods(const string& current_period, list& periods * backward compatability * Returns 0 on success, -ERR# on failure. */ -int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y) +int RGWSI_Zone::replace_region_with_zonegroup(const DoutPrefixProvider *dpp, optional_yield y) { /* copy default region */ /* convert default region to default zonegroup */ @@ -445,7 +445,7 @@ int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y) ldout(cct, 0) << __func__ << " Error initing new realm: " << cpp_strerror(-ret) << dendl; return ret; } - ret = new_realm.create(y); + ret = new_realm.create(dpp, y); if (ret < 0 && ret != -EEXIST) { ldout(cct, 0) << __func__ << " Error creating new realm: " << cpp_strerror(-ret) << dendl; return ret; @@ -713,7 +713,7 @@ int RGWSI_Zone::init_zg_from_period(bool *initialized, optional_yield y) return 0; } -int RGWSI_Zone::init_zg_from_local(bool *creating_defaults, optional_yield y) +int RGWSI_Zone::init_zg_from_local(const DoutPrefixProvider *dpp, bool *creating_defaults, optional_yield y) { int ret = zonegroup->init(cct, sysobj_svc, y); if ( (ret < 0 && ret != -ENOENT) || (ret == -ENOENT && !cct->_conf->rgw_zonegroup.empty())) { @@ -722,7 +722,7 @@ int RGWSI_Zone::init_zg_from_local(bool *creating_defaults, optional_yield y) } else if (ret == -ENOENT) { *creating_defaults = true; ldout(cct, 10) << "Creating default zonegroup " << dendl; - ret = zonegroup->create_default(y); + ret = zonegroup->create_default(dpp, y); if (ret < 0) { ldout(cct, 0) << "failure in zonegroup create_default: ret "<< ret << " " << cpp_strerror(-ret) << dendl; @@ -764,7 +764,7 @@ int RGWSI_Zone::init_zg_from_local(bool *creating_defaults, optional_yield y) return 0; } -int RGWSI_Zone::convert_regionmap(optional_yield y) +int RGWSI_Zone::convert_regionmap(const DoutPrefixProvider *dpp, optional_yield y) { RGWZoneGroupMap zonegroupmap; @@ -805,7 +805,7 @@ int RGWSI_Zone::convert_regionmap(optional_yield y) cpp_strerror(-ret) << dendl; return ret; } else if (ret == -ENOENT) { - ret = zonegroup.create(y); + ret = zonegroup.create(dpp, y); if (ret < 0) { ldout(cct, 0) << "Error could not create " << zonegroup.get_name() << ": " << cpp_strerror(-ret) << dendl; diff --git a/src/rgw/services/svc_zone.h b/src/rgw/services/svc_zone.h index 539d56d57e06a..d42adcdb04bb2 100644 --- a/src/rgw/services/svc_zone.h +++ b/src/rgw/services/svc_zone.h @@ -61,13 +61,13 @@ class RGWSI_Zone : public RGWServiceInstance RGWSI_RADOS *_rados_svc, RGWSI_SyncModules *_sync_modules_svc, RGWSI_Bucket_Sync *_bucket_sync_svc); - int do_start(optional_yield y) override; + int do_start(optional_yield y, const DoutPrefixProvider *dpp) override; void shutdown() override; - int replace_region_with_zonegroup(optional_yield y); + int replace_region_with_zonegroup(const DoutPrefixProvider *dpp, optional_yield y); int init_zg_from_period(bool *initialized, optional_yield y); - int init_zg_from_local(bool *creating_defaults, optional_yield y); - int convert_regionmap(optional_yield y); + int init_zg_from_local(const DoutPrefixProvider *dpp, bool *creating_defaults, optional_yield y); + int convert_regionmap(const DoutPrefixProvider *dpp, optional_yield y); int update_placement_map(optional_yield y); public: diff --git a/src/rgw/services/svc_zone_utils.cc b/src/rgw/services/svc_zone_utils.cc index 55e02e061005a..b292d7b992f07 100644 --- a/src/rgw/services/svc_zone_utils.cc +++ b/src/rgw/services/svc_zone_utils.cc @@ -7,7 +7,7 @@ #include "rgw/rgw_zone.h" -int RGWSI_ZoneUtils::do_start(optional_yield) +int RGWSI_ZoneUtils::do_start(optional_yield, const DoutPrefixProvider *dpp) { init_unique_trans_id_deps(); diff --git a/src/rgw/services/svc_zone_utils.h b/src/rgw/services/svc_zone_utils.h index f596ec64754d9..24abe528e53b3 100644 --- a/src/rgw/services/svc_zone_utils.h +++ b/src/rgw/services/svc_zone_utils.h @@ -24,7 +24,7 @@ class RGWSI_ZoneUtils : public RGWServiceInstance zone_svc = _zone_svc; } - int do_start(optional_yield) override; + int do_start(optional_yield, const DoutPrefixProvider *dpp) override; void init_unique_trans_id_deps(); diff --git a/src/test/rgw/test_rgw_lua.cc b/src/test/rgw/test_rgw_lua.cc index bdfe37ef2db25..7d7af6d786f3d 100644 --- a/src/test/rgw/test_rgw_lua.cc +++ b/src/test/rgw/test_rgw_lua.cc @@ -22,7 +22,7 @@ public: class TestRGWUser : public sal::RGWUser { public: - virtual int list_buckets(const string&, const string&, uint64_t, bool, sal::RGWBucketList&, optional_yield y) override { + virtual int list_buckets(const DoutPrefixProvider *dpp, const string&, const string&, uint64_t, bool, sal::RGWBucketList&, optional_yield y) override { return 0; } @@ -30,7 +30,7 @@ public: return nullptr; } - virtual int load_by_id(optional_yield y) override { + virtual int load_by_id(const DoutPrefixProvider *dpp, optional_yield y) override { return 0; } diff --git a/src/test/rgw/test_rgw_throttle.cc b/src/test/rgw/test_rgw_throttle.cc index a762a8c7a06ca..c2e2540ca46b4 100644 --- a/src/test/rgw/test_rgw_throttle.cc +++ b/src/test/rgw/test_rgw_throttle.cc @@ -29,7 +29,8 @@ struct RadosEnv : public ::testing::Environment { void SetUp() override { rados.emplace(g_ceph_context); - ASSERT_EQ(0, rados->start(null_yield)); + const NoDoutPrefix no_dpp(g_ceph_context, 1); + ASSERT_EQ(0, rados->start(null_yield, &no_dpp)); int r = rados->pool({poolname}).create(); if (r == -EEXIST) r = 0; -- 2.39.5