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)
{
RGWOp *op = (req->op) ? req->op : dynamic_cast<RGWOp*>(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;
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,
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;
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()
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;
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;
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;
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<ACLGrant>& _grants)
{
std::list<string> grantees;
for (list<string>::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;
{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<ACLGrant> 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;
}
/*
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)
}
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;
}
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;
}
}
- 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;
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;
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);
};
/**
}
}
-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)
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);
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<std::string>& uids,
const uint32_t perm)
{
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);
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);
}
-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,
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;
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;
}
}
-void RGWAccessControlPolicy_SWIFTAcct::add_grants(RGWUserCtl * const user_ctl,
+void RGWAccessControlPolicy_SWIFTAcct::add_grants(const DoutPrefixProvider *dpp,
+ RGWUserCtl * const user_ctl,
const std::vector<std::string>& uids,
const uint32_t perm)
{
} 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);
}
}
-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)
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");
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");
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;
class RGWAccessControlPolicy_SWIFT : public RGWAccessControlPolicy
{
- int add_grants(RGWUserCtl *user_ctl,
+ int add_grants(const DoutPrefixProvider *dpp, RGWUserCtl *user_ctl,
const std::vector<std::string>& uids,
uint32_t perm);
}
~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,
}
~RGWAccessControlPolicy_SWIFTAcct() override {}
- void add_grants(RGWUserCtl *user_ctl,
+ void add_grants(const DoutPrefixProvider *dpp,
+ RGWUserCtl *user_ctl,
const std::vector<std::string>& 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);
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; }
};
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;
{
RGWBucketInfo bucket_info;
map<string, bufferlist> 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;
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;
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;
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;
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;
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);
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";
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;
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;
}
auto& hint_bucket = *hint_entity.bucket;
RGWBucketSyncPolicyHandlerRef hint_bucket_handler;
- int r = store->ctl()->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;
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;
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;
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;
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) {
}
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;
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;
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;
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;
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;
}
}
- 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;
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;
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)
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;
}
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;
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";
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;
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;
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;
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;
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;
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;
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;
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;
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;
}
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;
}
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;
}
}
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;
}
case OPT::ROLE_LIST:
{
vector<RGWRole> 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;
}
}
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;
}
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;
}
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;
}
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;
}
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;
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 */
/* 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;
}
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);
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) {
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) {
}
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;
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;
}
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;
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;
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;
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;
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) {
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;
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;
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;
}
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;
}
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;
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,
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());
}
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;
int num_logshards =
store->ctx()->_conf.get_val<uint64_t>("rgw_reshard_num_logs");
- RGWReshard reshard(store);
+ RGWReshard reshard(store, dpp());
formatter->open_array_section("reshard");
for (int i = 0; i < num_logshards; i++) {
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;
}
}
- RGWReshard reshard(store);
+ RGWReshard reshard(store, dpp());
cls_rgw_reshard_entry entry;
entry.tenant = tenant;
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;
}
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);
}
}
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;
}
cerr << "could not init search, ret=" << ret << std::endl;
return -ret;
}
- ret = search.run();
+ ret = search.run(dpp());
if (ret < 0) {
return -ret;
}
}
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) {
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;
}
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;
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;
}
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;
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());
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;
}
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;
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);
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;
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);
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;
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);
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;
}
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;
}
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;
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;
}
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 {
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;
}
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="
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;
}
/* 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. */
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
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="
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;
}
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;
}
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
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 */
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. */
* 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;
}
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 {
} 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;
}
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;
}
/* 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;
}
}
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 */
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;
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;
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) {
}
/* 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;
/* 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;
}
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,
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;
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);
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;
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);
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;
}
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);
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;
}
}
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<AWSv4ComplMulti>(s,
std::move(date),
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)
{
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*,
* 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,
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)
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);
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;
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;
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;
}
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);
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)
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<RGWObjCategory, RGWStorageStats> stats;
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;
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;
}
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;
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;
}
} // 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;
// 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;
}
}
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<string, bufferlist> *pattrs)
{
if (!storage) {
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) {
}
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;
return false;
}
-int RGWBucket::link(RGWBucketAdminOpState& op_state, optional_yield y,
+int RGWBucket::link(RGWBucketAdminOpState& op_state, optional_yield y, const DoutPrefixProvider *dpp,
map<string, bufferlist>& attrs, std::string *err_msg)
{
if (!op_state.is_user_op()) {
}
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;
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;
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;
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) {
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) {
}
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));
}
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();
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));
}
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<string, bufferlist> 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;
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;
}
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();
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;
do {
vector<rgw_bucket_dir_entry> 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 +
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)
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);
return 0;
}
-int RGWBucket::sync(RGWBucketAdminOpState& op_state, map<string, bufferlist> *attrs, std::string *err_msg)
+int RGWBucket::sync(RGWBucketAdminOpState& op_state, map<string, bufferlist> *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");
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;
}
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;
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)
{
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<string, bufferlist> 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;
}
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;
}
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;
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;
}
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;
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<string, bufferlist> 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<string, bufferlist> 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<RGWObjCategory, RGWStorageStats> existing_stats;
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;
}
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<rgw::sal::RGWBucket> bucket;
std::unique_ptr<rgw::sal::RGWUser> 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<string, bufferlist> 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<RGWObjCategory, RGWStorageStats> stats;
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;
}
RGWBucketAdminOpState& op_state,
const std::list<std::string>& user_ids,
RGWFormatterFlusher& flusher, optional_yield y,
+ const DoutPrefixProvider *dpp,
bool warnings_only)
{
int ret = 0;
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;
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;
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)
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;
}
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);
}
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;
}
&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);
}
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;
using bucket_instance_ls = std::vector<RGWBucketInfo>;
void get_stale_instances(rgw::sal::RGWRadosStore *store, const std::string& bucket_name,
const vector<std::string>& lst,
- bucket_instance_ls& stale_instances)
+ bucket_instance_ls& stale_instances,
+ const DoutPrefixProvider *dpp)
{
auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
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
// 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
static int process_stale_instances(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
RGWFormatterFlusher& flusher,
+ const DoutPrefixProvider *dpp,
std::function<void(const bucket_instance_ls&,
Formatter *,
rgw::sal::RGWRadosStore*)> process_f)
}
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);
}
}
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,
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());
}
};
- 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 <std::string, bufferlist> 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?
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;
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);
} 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
}
-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
}
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)
{
do {
std::vector<rgw_bucket_dir_entry> 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;
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);
}
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 {
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;
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;
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;
* 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;
}
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<RGWBucketEntryMetadataObject *>(old_obj);
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();
/* 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;
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());
RGWBucketEntryPoint be;
map<string, bufferlist> 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;
}
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) {
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)
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;
/* 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;
/* 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;
}
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;
}
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;
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;
}
}
return RGWBucketMetadataHandler::do_put(op, entry, obj,
- objv_tracker, y, type, from_remote_zone);
+ objv_tracker, y, dpp, type, from_remote_zone);
}
};
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:
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;
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<int(RGWSI_Bucket_BI_Ctx& ctx)> f) {
}
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,
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,
return 0;
}
-int RGWMetadataHandlerPut_BucketInstance::put_checked()
+int RGWMetadataHandlerPut_BucketInstance::put_checked(const DoutPrefixProvider *dpp)
{
RGWBucketInstanceMetadataObject *orig_obj = static_cast<RGWBucketInstanceMetadataObject *>(old_obj);
false,
mtime,
pattrs,
- y);
+ y,
+ dpp);
}
-int RGWMetadataHandlerPut_BucketInstance::put_post()
+int RGWMetadataHandlerPut_BucketInstance::put_post(const DoutPrefixProvider *dpp)
{
RGWBucketCompleteInfo& bci = obj->get_bci();
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;
}
void RGWBucketCtl::init(RGWUserCtl *user_ctl,
RGWBucketMetadataHandler *_bm_handler,
RGWBucketInstanceMetadataHandler *_bmi_handler,
- RGWDataChangesLog *datalog)
+ RGWDataChangesLog *datalog,
+ const DoutPrefixProvider *dpp)
{
ctl.user = 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);
});
}
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) {
params.mtime,
params.attrs,
y,
+ dpp,
params.cache_info,
params.refresh_version);
});
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) {
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) {
params.mtime,
params.attrs,
y,
+ dpp,
params.cache_info,
params.refresh_version);
});
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)
{
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) {
info,
params.mtime,
params.attrs,
- y,
+ y, dpp,
params.cache_info,
params.refresh_version);
});
const rgw_bucket& bucket,
RGWBucketInfo& info,
optional_yield y,
+ const DoutPrefixProvider *dpp,
const BucketInstance::PutParams& params)
{
if (params.objv_tracker) {
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) {
RGWSI_Bucket::get_bi_meta_key(bucket),
info,
&info.objv_tracker,
- y);
+ y,
+ dpp);
});
}
obj_version *pep_objv,
map<string, bufferlist> *pattrs,
bool create_entry_point,
- optional_yield y)
+ optional_yield y, const DoutPrefixProvider *dpp)
{
bool create_head = !info.has_instance_obj || create_entry_point;
orig_info,
exclusive,
mtime, pattrs,
- y);
+ y, dpp);
if (ret < 0) {
return ret;
}
mtime,
pattrs,
&ot,
- y);
+ y,
+ dpp);
if (ret < 0)
return ret;
}
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;
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;
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;
int RGWBucketCtl::set_bucket_instance_attrs(RGWBucketInfo& bucket_info,
map<string, bufferlist>& 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;
bucket,
bucket_info,
y,
+ dpp,
BucketInstance::PutParams().set_attrs(&attrs)
.set_objv_tracker(objv_tracker)
.set_orig_info(&bucket_info));
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);
});
}
ceph::real_time creation_time,
bool update_entrypoint,
rgw_ep_info *pinfo,
- optional_yield y)
+ optional_yield y,
+ const DoutPrefixProvider *dpp)
{
int ret;
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;
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;
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);
});
}
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) {
RGWObjVersionTracker ot;
map<string, bufferlist> 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)
}
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<std::string, bufferlist> 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;
// 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<rgw_bucket_dir_entry> objs;
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;
map<string, bufferlist> 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;
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;
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<string, RGWBucketEnt>& 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);
});
}
int RGWBucketCtl::get_sync_policy_handler(std::optional<rgw_zone_id> zone,
std::optional<rgw_bucket> 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;
}
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;
}
}
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;
}
* 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,
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;
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<string, bufferlist> *pattrs = NULL);
+ const DoutPrefixProvider *dpp, std::string *err_msg = NULL, map<string, bufferlist> *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);
map<RGWObjCategory, RGWStorageStats>& 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<string, bufferlist>& 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<string, bufferlist> *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<string, bufferlist> *attrs, const DoutPrefixProvider *dpp, std::string *err_msg = NULL);
void clear_failure() { failure = false; }
{
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<std::string>& 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 {
void init(RGWUserCtl *user_ctl,
RGWBucketMetadataHandler *_bm_handler,
RGWBucketInstanceMetadataHandler *_bmi_handler,
- RGWDataChangesLog *datalog);
+ RGWDataChangesLog *datalog,
+ const DoutPrefixProvider *dpp);
struct Bucket {
struct GetParams {
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 = {});
/*
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);
int set_bucket_instance_attrs(RGWBucketInfo& bucket_info,
map<string, bufferlist>& 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<string, RGWBucketEnt>& 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,
int get_sync_policy_handler(std::optional<rgw_zone_id> zone,
std::optional<rgw_bucket> 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,
obj_version *pep_objv,
map<string, bufferlist> *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,
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);
};
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();
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;
}
}
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;
}
}
return ret;
}
-int RGWHTTPArgs::parse()
+int RGWHTTPArgs::parse(const DoutPrefixProvider *dpp)
{
int pos = 0;
bool end = false;
});
}
string& val = nv.get_val();
- dout(10) << "name: " << name << " val: " << val << dendl;
+ ldpp_dout(dpp, 10) << "name: " << name << " val: " << val << dendl;
append(name, val);
}
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 */
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;
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;
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) {
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;
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;
}
P params;
std::shared_ptr<R> result;
+ const DoutPrefixProvider *dpp;
class Request : public RGWAsyncRadosRequest {
rgw::sal::RGWRadosStore *store;
P params;
std::shared_ptr<R> result;
+ const DoutPrefixProvider *dpp;
protected:
int _send_request() override;
public:
RGWAioCompletionNotifier *cn,
rgw::sal::RGWRadosStore *_store,
const P& _params,
- std::shared_ptr<R>& _result) : RGWAsyncRadosRequest(caller, cn),
+ std::shared_ptr<R>& _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<R>& _result) : RGWSimpleCoroutine(_store->ctx()),
+ std::shared_ptr<R>& _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();
stack->create_completion_notifier(),
store,
params,
- result);
+ result,
+ dpp);
async_rados->queue(req);
return 0;
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<string, bufferlist> attrs;
rgw_bucket bucket;
RGWBucketInfo *bucket_info;
map<string, bufferlist> *pattrs;
+ const DoutPrefixProvider *dpp;
RGWAsyncGetBucketInstanceInfo *req{nullptr};
// rgw_bucket constructor
RGWGetBucketInstanceInfoCR(RGWAsyncRadosProcessor *_async_rados, rgw::sal::RGWRadosStore *_store,
const rgw_bucket& _bucket, RGWBucketInfo *_bucket_info,
- map<string, bufferlist> *_pattrs)
+ map<string, bufferlist> *_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();
}
}
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;
}
};
class RGWAsyncRemoveObj : public RGWAsyncRadosRequest {
+ const DoutPrefixProvider *dpp;
rgw::sal::RGWRadosStore *store;
rgw_zone_id source_zone;
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,
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),
};
class RGWRemoveObjCR : public RGWSimpleCoroutine {
+ const DoutPrefixProvider *dpp;
CephContext *cct;
RGWAsyncRadosProcessor *async_rados;
rgw::sal::RGWRadosStore *store;
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,
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),
}
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);
}
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<>
map<string, bufferlist> 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);
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) {
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)
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;
}
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;
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;
}
map<string, bufferlist> 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);
}
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);
}
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);
}
(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;
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);
}
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 {
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}));
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);
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;
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;
}
void renew_stop();
std::thread renew_thread;
- std::function<bool(const rgw_bucket& bucket, optional_yield y)> bucket_filter;
+ std::function<bool(const rgw_bucket& bucket, optional_yield y, const DoutPrefixProvider *dpp)> 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:
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<rgw_data_change_log_entry>& entries,
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<string, string>::iterator iter;
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;
}
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;
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;
(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))
}
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) {
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;
}
int exec_start() override;
int exec_continue() override;
- int exec_finish() override;
+ int exec_finish(const DoutPrefixProvider *dpp) override;
void send_response() override {}
#include "rgw_sal_rados.h"
#define dout_context g_ceph_context
-#define dout_subsys ceph_subsys_rgw
namespace rgw::dmclock {
class SyncScheduler;
}
}; /* 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);
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;
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<rgw::sal::RGWObject::ReadOp> 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;
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;
}
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;
}
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;
}
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<void(void)> fetch_barrier
= []() { /* nada */}) {
if (obj_iter == list_results.objs.end()) {
} 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;
}; /* 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();
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 */
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;
}
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 */
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);
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;
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<rgw::sal::RGWObject::ReadOp> 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)
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;
*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="
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()) {
bool skip;
- int ret = check_tags(oc, &skip);
+ int ret = check_tags(dpp, oc, &skip);
if (ret < 0) {
if (ret == -ENOENT) {
return false;
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;
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();
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;
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;
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
<< " " << 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
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;
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
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;
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
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()) {
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;
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;
bool cont = false;
for (auto& f : filters) {
- if (f->check(ctx)) {
+ if (f->check(dpp, ctx)) {
cont = true;
break;
}
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;
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;
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<LCOpRule, rgw_bucket_dir_entry> t1 = {orule, *o};
worker->workpool->enqueue(WorkItem{t1});
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;
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;
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 */
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,
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;
}
const ceph::real_time& mtime,
RGWObjVersionTracker *objv_tracker,
optional_yield y,
+ const DoutPrefixProvider *dpp,
RGWMDLogStatus op_type,
std::function<int()> f) {
return -ENOTSUP;
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;
}
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;
}
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;
}
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);
});
}
const ceph::real_time& mtime,
RGWObjVersionTracker *objv_tracker,
optional_yield y,
+ const DoutPrefixProvider *dpp,
RGWMDLogStatus op_type,
std::function<int()> f)
{
params,
objv_tracker,
y,
- f);
+ f,
+ dpp);
});
}
}
-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;
RGWMetadataObject *obj;
- ret = handler->get(entry, &obj, y);
+ ret = handler->get(entry, &obj, y, dpp);
if (ret < 0) {
return ret;
}
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)
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;
}
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;
}
RGWMetadataObject *obj;
- ret = handler->get(entry, &obj, y);
+ ret = handler->get(entry, &obj, y, dpp);
if (ret < 0) {
return ret;
}
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<int()> f)
{
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)
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<int()> f) = 0;
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() {}
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,
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() {
}
};
- 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<int()> f) override;
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<int()> f);
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) {}
};
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)
{
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 {
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;
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,
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;
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__ <<
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
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,
vector<rgw_bucket_dir_entry> *objs,
map<string, bool> *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
using queues_t = std::set<std::string>;
-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;
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;
}
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);
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;
}
// 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;
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);
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;
}
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;
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;
}
});
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;
}
}
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]);
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);
// 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
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();
}
(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;
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;
}
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;
}
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;
}
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;
}
};
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;
}
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;
}
}
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) {
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;
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;
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;
}
}
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;
}
// 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;
// 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();
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);
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;
}
-int RGWObjectExpirer::garbage_single_object(objexp_hint_entry& hint)
+int RGWObjectExpirer::garbage_single_object(const DoutPrefixProvider *dpp, objexp_hint_entry& hint)
{
RGWBucketInfo bucket_info;
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<cls_timeindex_entry>& entries, /* in */
+void RGWObjectExpirer::garbage_chunk(const DoutPrefixProvider *dpp,
+ list<cls_timeindex_entry>& entries, /* in */
bool& need_trim) /* out */
{
need_trim = false;
/* 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) {
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)
{
}
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);
}
/* 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();
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;
}
}
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;
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: ";
+}
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");
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};
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<cls_timeindex_entry>& entries, /* in */
+ void garbage_chunk(const DoutPrefixProvider *dpp,
+ std::list<cls_timeindex_entry>& entries, /* in */
bool& need_trim); /* out */
void trim_chunk(const std::string& shard,
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();
return 0;
}
-int RGWOIDCProvider::create(bool exclusive, optional_yield y)
+int RGWOIDCProvider::create(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y)
{
int ret;
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;
return ret;
}
-int RGWOIDCProvider::get()
+int RGWOIDCProvider::get(const DoutPrefixProvider *dpp)
{
string url, tenant;
auto ret = get_tenant_url_from_arn(tenant, url);
return -EINVAL;
}
- ret = read_url(url, tenant);
+ ret = read_url(dpp, url, tenant);
if (ret < 0) {
return ret;
}
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;
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;
}
return true;
}
-int RGWOIDCProvider::get_providers(RGWRados *store,
+int RGWOIDCProvider::get_providers(const DoutPrefixProvider *dpp, RGWRados *store,
const string& tenant,
vector<RGWOIDCProvider>& providers)
{
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;
}
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:
const vector<string>& get_client_ids() const { return client_ids;}
const vector<string>& 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<RGWOIDCProvider>& providers);
};
* 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<string, bufferlist>& bucket_attrs,
ldout(cct, 0) << "WARNING: couldn't find acl header for bucket, generating default" << dendl;
std::unique_ptr<rgw::sal::RGWUser> 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;
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,
std::unique_ptr<rgw::sal::RGWObject::ReadOp> 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)
/* object exists, but policy is broken */
ldout(cct, 0) << "WARNING: couldn't find acl header for object, generating default" << dendl;
std::unique_ptr<rgw::sal::RGWUser> 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;
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 {
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<rgw::sal::RGWObject::ReadOp> 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;
}
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;
}
};
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)
{
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;
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)
{
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<string, bufferlist>& bucket_attrs,
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;
}
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;
}
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<string, bufferlist>& bucket_attrs,
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;
}
policy = get_iam_policy_from_attr(s->cct, bucket_attrs, bucket->get_tenant());
RGWObjectCtx *obj_ctx = static_cast<RGWObjectCtx *>(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;
}
* 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();
/* check if copy source is within the current domain */
if (!s->src_bucket_name.empty()) {
std::unique_ptr<rgw::sal::RGWBucket> 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) {
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;
}
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 = {
}
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
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;
}
/* handle user ACL only for those APIs which support it */
if (s->user_acl) {
map<string, bufferlist> 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);
}
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;
}
if (! s->user->get_id().empty() && s->auth.identity->get_identity_type() != TYPE_ROLE) {
try {
map<string, bufferlist> 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()),
// 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;
* 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;
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);
}
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();
// general, they should just return op_ret.
namespace {
template<typename F>
-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();
}
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);
}
}
}
// 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);
}
}
}
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;
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);
}
}
}
}
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;
}
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);
}
}
}
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)
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);
});
}
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()
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) {
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;
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;
}
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;
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;
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);
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,
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;
}
if (bucket_name.compare(s->bucket->get_name()) != 0) {
map<string, bufferlist> 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;
* - 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);
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);
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);
std::unique_ptr<rgw::sal::RGWBucket> 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;
}
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 "
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();
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) {
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();
}
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;
}
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
}
}
- 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;
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
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;
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) {
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;
});
<< "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) {
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)
}
if (need_container_stats()) {
- op_ret = s->bucket->update_container_stats();
+ op_ret = s->bucket->update_container_stats(s);
}
rgw::sal::RGWBucket::ListParams params;
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;
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) {
/* 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);
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;
}
/* 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,
}
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;
do {
map<string, bufferlist> 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())) {
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;
}
/* 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. */
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;
}
}
}
- 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()
}
}
std::unique_ptr<rgw::sal::RGWBucket> 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;
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;
}
std::unique_ptr<rgw::sal::RGWObject> obj = bucket->get_object(rgw_obj_key(copy_source_object_name, copy_source_version_id));
std::unique_ptr<rgw::sal::RGWObject::ReadOp> 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;
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;
}
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();
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;
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;
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;
}
}
// 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
} 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
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) {
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;
}
{
/* 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) {
/* 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)
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;
}
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. */
/* 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;
});
}
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;
}
}
}
- 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)
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;
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();
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
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;
if (! params_str.empty()) {
RGWHTTPArgs args;
args.set(std::string(params_str));
- args.parse();
+ args.parse(s);
key.instance = args.get("versionId", NULL);
}
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) {
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;
}
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) {
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) {
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;
}
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;
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
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);
}
}
}
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);
*_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;
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<string,bufferlist> 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 */
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);
});
}
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;
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;
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;
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;
}
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
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;
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();
}
// 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
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<RGWObjectCtx *>(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)
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;
}
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;
// 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
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;
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
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;
}
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;
}
std::unique_ptr<rgw::sal::RGWObject> 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;
}
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,
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,
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 = {
bool RGWBulkDelete::Deleter::delete_chunk(const std::list<acct_path_t>& 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);
}
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) {
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,
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;
}
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;
std::unique_ptr<rgw::sal::RGWBucket> 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) {
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;
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;
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() */
std::unique_ptr<rgw::sal::RGWObject::ReadOp> 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);
}
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;
{
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;
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;
/* 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 << ":"
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) {
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;
});
}
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;
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;
}
}
- 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;
}
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;
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;
}
return;
}
map<string, bufferlist> 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;
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);
});
}
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;
});
}
}
}
-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<string, bufferlist>& bucket_attrs,
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:
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));
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);
* 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<std::string, ceph::bufferlist>& attrs,
const bool allow_empty_attrs = true)
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);
return ret;
}
-int RGWOrphanSearch::build_linked_oids_for_bucket(const string& bucket_instance_id, map<int, list<string> >& oids)
+int RGWOrphanSearch::build_linked_oids_for_bucket(const DoutPrefixProvider *dpp, const string& bucket_instance_id, map<int, list<string> >& oids)
{
RGWObjectCtx obj_ctx(store);
auto sysobj_ctx = store->svc()->sysobj->init_obj_ctx();
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 */
}
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 */
do {
vector<rgw_bucket_dir_entry> 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;
return 0;
}
-int RGWOrphanSearch::build_linked_oids_index()
+int RGWOrphanSearch::build_linked_oids_index(const DoutPrefixProvider *dpp)
{
map<int, list<string> > oids;
map<int, string>::iterator iter = buckets_instance_index.find(search_stage.shard);
for (map<string, bufferlist>::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;
return 0;
}
-int RGWOrphanSearch::run()
+int RGWOrphanSearch::run(const DoutPrefixProvider *dpp)
{
int r;
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;
int RGWRadosList::process_bucket(
+ const DoutPrefixProvider *dpp,
const std::string& bucket_instance_id,
const std::string& prefix,
const std::set<rgw_obj_key>& entries_filter)
bucket_info,
nullptr,
nullptr,
- null_yield);
+ null_yield,
+ dpp);
if (ret < 0) {
if (ret == -ENOENT) {
// probably raced with bucket removal
std::vector<rgw_bucket_dir_entry> 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?
}
-int RGWRadosList::run()
+int RGWRadosList::run(const DoutPrefixProvider *dpp)
{
int ret;
void* handle = nullptr;
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) {
} // 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);
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?" <<
static const std::string empty_prefix;
auto do_process_bucket =
- [&bucket_id, this]
+ [dpp, &bucket_id, this]
(const std::string& prefix,
const std::set<rgw_obj_key>& 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;
start_bucket_name,
bucket_info,
nullptr,
- null_yield);
+ null_yield,
+ dpp);
if (ret == -ENOENT) {
// bucket deletion race?
return 0;
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;
int RGWRadosList::do_incomplete_multipart(
+ const DoutPrefixProvider *dpp,
rgw::sal::RGWRadosStore* store,
RGWBucketInfo& bucket_info)
{
do {
std::vector<rgw_bucket_dir_entry> objs;
std::map<string, bool> 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?
int build_all_oids_index();
int build_buckets_instance_index();
- int build_linked_oids_for_bucket(const string& bucket_instance_id, map<int, list<string> >& oids);
- int build_linked_oids_index();
+ int build_linked_oids_for_bucket(const DoutPrefixProvider *dpp, const string& bucket_instance_id, map<int, list<string> >& oids);
+ int build_linked_oids_index(const DoutPrefixProvider *dpp);
int compare_oid_indexes();
- int run();
+ int run(const DoutPrefixProvider *dpp);
int finish();
};
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<rgw_obj_key>& 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
}
s->info.args.set(p);
- s->info.args.parse();
+ s->info.args.parse(s);
if (*req_name != '/')
return 0;
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<RGWOTPMetadataObject> mdo(new RGWOTPMetadataObject);
&mdo->get_devs(),
&mdo->get_mtime(),
&objv_tracker,
- y);
+ y,
+ dpp);
if (ret < 0) {
return ret;
}
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<RGWOTPMetadataObject *>(_obj);
}
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());
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);
});
}
};
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 = {});
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();
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();
}
template<typename EventType>
-int RGWPubSub::SubWithEvents<EventType>::list_events(const string& marker, int max_events)
+int RGWPubSub::SubWithEvents<EventType>::list_events(const DoutPrefixProvider *dpp, const string& marker, int max_events)
{
RGWRados *store = ps->store->getRados();
rgw_pubsub_sub_config sub_conf;
std::vector<rgw_bucket_dir_entry> 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;
}
template<typename EventType>
-int RGWPubSub::SubWithEvents<EventType>::remove_event(const string& event_id)
+int RGWPubSub::SubWithEvents<EventType>::remove_event(const DoutPrefixProvider *dpp, const string& event_id)
{
rgw::sal::RGWRadosStore *store = ps->store;
rgw_pubsub_sub_config sub_conf;
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;
}
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);}
};
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;
};
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;
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;
}
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;
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;
}
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;
}
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;
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;
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;
}
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;
}
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;
}
}
};
- 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;
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);
}
template<class T>
-int RGWQuotaCache<T>::get_stats(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, RGWQuotaInfo& quota, optional_yield y) {
+int RGWQuotaCache<T>::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)) {
}
}
- 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;
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;
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<rgw_bucket>(_store, _store->ctx()->_conf->rgw_bucket_quota_cache_size) {
}
};
-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;
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;
}
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;
}
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;
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) {
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;
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;
// 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;
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;
++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;
* 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;
}
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;
}
*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);
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;
}
};
-class RGWIndexCompletionThread : public RGWRadosThread {
+class RGWIndexCompletionThread : public RGWRadosThread, public DoutPrefixProvider {
RGWRados *store;
uint64_t interval_msec() override {
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()
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);
/* 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;
}
* 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;
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;
}
}
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();
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);
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();
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();
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 */
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;
cct->_conf.get_val<double>("rgw_inject_notify_timeout_probability");
max_notify_retries = cct->_conf.get_val<uint64_t>("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;
}
if (ret < 0)
return ret;
- return init_complete();
+ return init_complete(dpp);
}
/**
}
-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);
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;
}
* max, then truncated.
*/
int RGWRados::Bucket::List::list_objects_ordered(
+ const DoutPrefixProvider *dpp,
int64_t max_p,
vector<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
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,
* 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<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
bool *is_truncated,
std::vector<rgw_bucket_dir_entry> 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,
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 */
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;
}
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 */
* 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);
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;
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;
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;
}
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;
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;
}
/* 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<int(const rgw_bucket_dir_entry&)> handler)
static constexpr int MAX_LIST_OBJS = 100;
std::vector<rgw_bucket_dir_entry> 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;
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;
}
}
/* 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;
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<string, bufferlist>& attrs,
bool assume_noent, bool modify_tail,
void *_index_op, optional_yield y)
#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;
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;
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;
}
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);
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;
}
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;
}
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<string, bufferlist>& attrs, optional_yield y)
{
RGWBucketInfo& bucket_info = target->get_bucket_info();
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;
}
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;
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;
}
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;
// 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
}
-int RGWRados::copy_obj_to_remote_dest(RGWObjState *astate,
+int RGWRados::copy_obj_to_remote_dest(const DoutPrefixProvider *dpp,
+ RGWObjState *astate,
map<string, bufferlist>& src_attrs,
RGWRados::Object::Read& read_op,
const rgw_user& user_id,
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;
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;
}
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;
}
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;
}
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;
}
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;
}
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;
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;
}
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;
std::vector<rgw_bucket_dir_entry> 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,
* 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;
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;
}
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 ||
}
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)
/* 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;
}
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<string, bufferlist> attrs;
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;
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;
}
-int RGWRados::set_buckets_enabled(vector<rgw_bucket>& buckets, bool enabled)
+int RGWRados::set_buckets_enabled(vector<rgw_bucket>& buckets, bool enabled, const DoutPrefixProvider *dpp)
{
int ret = 0;
RGWBucketInfo info;
map<string, bufferlist> 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;
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;
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;
}
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<RGWObjectCtx *>(ctx);
std::string oid, key;
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;
* 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();
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;
}
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;
}
}
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;
}
RGWObjState *state;
- r = target->get_state(&state, false, y);
+ r = target->get_state(dpp, &state, false, y);
if (r < 0)
return r;
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;
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;
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) {
}
/* 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;
}
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,
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)
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);
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;
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<string, bufferlist>& attrset, RGWObjManifest& manifest, bufferlist& manifest_bl, bufferlist& tag_bl)
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;
}
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()) {
*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;
}
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;
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;
}
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)
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;
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()
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;
* 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<string, bufferlist> 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<string, bufferlist>& attrs,
map<string, bufferlist>* rmattrs,
optional_yield y)
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;
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;
}
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;
}
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();
map<string, bufferlist>::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;
*params.attrs = astate->attrset;
if (cct->_conf->subsys.should_gather<ceph_subsys_rgw, 20>()) {
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;
}
}
}
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;
}
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;
}
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;
}
return 0;
}
-int RGWRados::Bucket::UpdateIndex::guard_reshard(BucketShard **pbs, std::function<int(BucketShard *)> call)
+int RGWRados::Bucket::UpdateIndex::guard_reshard(const DoutPrefixProvider *dpp, BucketShard **pbs, std::function<int(BucketShard *)> call)
{
RGWRados *store = target->get_store();
BucketShard *bs;
#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;
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;
}
}
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;
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;
}
}
- 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);
});
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,
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;
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;
}
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<rgw_obj_index_key> *remove_objs)
{
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;
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;
}
}
-int RGWRados::Bucket::UpdateIndex::cancel()
+int RGWRados::Bucket::UpdateIndex::cancel(const DoutPrefixProvider *dpp)
{
if (blind) {
return 0;
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);
});
* 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;
}
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();
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;
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;
}
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;
}
}
- 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) {
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;
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();
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;
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)
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;
}
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<int(BucketShard *)> call)
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;
}
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;
}
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;
// 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 " <<
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,
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();
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;
}
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;
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;
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<uint64_t, vector<rgw_bucket_olh_log_entry> > *log,
bool *is_truncated)
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;
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;
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);
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;
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);
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);
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();
}
}
-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<uint64_t, vector<rgw_bucket_olh_log_entry> >& log,
uint64_t *plast_ver, rgw_zone_set* zones_trace)
{
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;
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;
/*
* 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;
/*
* 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<uint64_t, vector<rgw_bucket_olh_log_entry> > 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;
}
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)
{
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;
}
}
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) {
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;
}
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;
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;
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) {
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;
}
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<string, bufferlist> pending_entries;
rgw_filter_attrset(state->attrset, RGW_ATTR_OLH_PENDING_PREFIX, &pending_entries);
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;
}
RGWBucketInfo& info,
real_time *pmtime,
map<string, bufferlist> *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<string, bufferlist> *pattrs, optional_yield y)
+ real_time *pmtime, map<string, bufferlist> *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)
const string& tenant, const string& bucket_name,
RGWBucketInfo& info,
real_time *pmtime,
- optional_yield y, map<string, bufferlist> *pattrs)
+ optional_yield y,
+ const DoutPrefixProvider *dpp, map<string, bufferlist> *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)
int RGWRados::try_refresh_bucket_info(RGWBucketInfo& info,
ceph::real_time *pmtime,
+ const DoutPrefixProvider *dpp,
map<string, bufferlist> *pattrs)
{
rgw_bucket bucket = info.bucket;
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)
}
int RGWRados::put_bucket_instance_info(RGWBucketInfo& info, bool exclusive,
- real_time mtime, map<string, bufferlist> *pattrs)
+ real_time mtime, map<string, bufferlist> *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)
}
int RGWRados::put_linked_bucket_info(RGWBucketInfo& info, bool exclusive, real_time mtime, obj_version *pep_objv,
- map<string, bufferlist> *pattrs, bool create_entry_point)
+ map<string, bufferlist> *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;
}
*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));
return 0;
}
-int RGWRados::update_containers_stats(map<string, RGWBucketEnt>& m)
+int RGWRados::update_containers_stats(map<string, RGWBucketEnt>& m, const DoutPrefixProvider *dpp)
{
auto obj_ctx = svc.sysobj->init_obj_ctx();
vector<rgw_bucket_dir_header> 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;
}
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;
return bi_put(bs, entry);
}
-int RGWRados::bi_list(rgw_bucket& bucket, const string& obj_name, const string& marker, uint32_t max, list<rgw_cls_bi_entry> *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<rgw_cls_bi_entry> *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;
return 0;
}
-int RGWRados::bi_list(const RGWBucketInfo& bucket_info, int shard_id, const string& filter_obj, const string& marker, uint32_t max, list<rgw_cls_bi_entry> *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<rgw_cls_bi_entry> *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;
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,
}
-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,
* 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;
}
-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,
* 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;
}
return r;
}
-int RGWRados::check_disk_state(librados::IoCtx io_ctx,
+int RGWRados::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,
RGWObjState *astate = NULL;
RGWObjectCtx rctx(this->store);
- 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;
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;
}
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<bool>("rgw_dynamic_resharding")) {
return 0;
"; 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);
return 0;
}
-int RGWRados::delete_obj_aio(const rgw_obj& obj,
+int RGWRados::delete_obj_aio(const DoutPrefixProvider *dpp, const rgw_obj& obj,
RGWBucketInfo& bucket_info, RGWObjState *astate,
list<librados::AioCompletion *>& handles, bool keep_index_consistent,
optional_yield y)
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;
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;
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);
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();
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<string, string>& meta);
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; }
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);
};
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();
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;
}
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 {
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<std::string, bufferlist>& 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<std::string, bufferlist>& attrs, optional_yield y);
int write_data(const char *data, uint64_t ofs, uint64_t len, bool exclusive);
const req_state* get_req_state() {
explicit Delete(RGWRados::Object *_target) : target(_target) {}
- int delete_obj(optional_yield y);
+ int delete_obj(optional_yield y, const DoutPrefixProvider *dpp);
};
struct Stat {
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) {
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;
}
bs_initialized = false;
}
- int guard_reshard(BucketShard **pbs, std::function<int(BucketShard *)> call);
+ int guard_reshard(const DoutPrefixProvider *dpp, BucketShard **pbs, std::function<int(BucketShard *)> call);
public:
UpdateIndex(RGWRados::Bucket *_target, const rgw_obj& _obj) : target(_target), obj(_obj),
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;
}
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<rgw_obj_index_key> *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<rgw_obj_index_key> *remove_objs);
- int cancel();
+ int cancel(const DoutPrefixProvider *dpp);
const string *get_optag() { return &optag; }
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<rgw_bucket_dir_entry> *result,
map<string, bool> *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<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
bool *is_truncated,
explicit List(RGWRados::Bucket *_target) : target(_target) {}
- int list_objects(int64_t max,
+ int list_objects(const DoutPrefixProvider *dpp, int64_t max,
vector<rgw_bucket_dir_entry> *result,
map<string, bool> *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);
}
}
}; // 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<int(const rgw_bucket_dir_entry&)> handler);
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<string, bufferlist>& src_attrs,
RGWRados::Object::Read& read_op,
const rgw_user& user_id,
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<int>& shard_ids);
void wakeup_data_sync_shards(const rgw_zone_id& source_zone, map<int, set<string> >& shard_ids);
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<rgw_bucket>& 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<rgw_bucket>& 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,
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.
* 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<string, bufferlist>& attrs,
map<string, bufferlist>* 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);
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<int(BucketShard *)> 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<uint64_t, vector<rgw_bucket_olh_log_entry> > *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<uint64_t, vector<rgw_bucket_olh_log_entry> >& 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<string, bufferlist>& pending_entries, map<string, bufferlist> *rm_pending_entries);
int remove_olh_pending_entries(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& olh_obj, map<string, bufferlist>& 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<string, RGWBucketEnt>& m);
+ int update_containers_stats(map<string, RGWBucketEnt>& m, const DoutPrefixProvider *dpp);
int append_async(rgw_raw_obj& obj, size_t size, bufferlist& bl);
public:
map<RGWObjCategory, RGWStorageStats>& 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<string, bufferlist> *pattrs);
+ int put_bucket_instance_info(RGWBucketInfo& info, bool exclusive, ceph::real_time mtime, map<string, bufferlist> *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<string, bufferlist> *pattrs, optional_yield y);
- int get_bucket_instance_info(RGWSysObjectCtx& obj_ctx, const rgw_bucket& bucket, RGWBucketInfo& info, ceph::real_time *pmtime, map<string, bufferlist> *pattrs, optional_yield y);
+ int get_bucket_instance_info(RGWSysObjectCtx& obj_ctx, const string& meta_key, RGWBucketInfo& info, ceph::real_time *pmtime, map<string, bufferlist> *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<string, bufferlist> *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<string, bufferlist> *pattrs = NULL);
+ ceph::real_time *pmtime, optional_yield y,
+ const DoutPrefixProvider *dpp, map<string, bufferlist> *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
//
int try_refresh_bucket_info(RGWBucketInfo& info,
ceph::real_time *pmtime,
+ const DoutPrefixProvider *dpp,
map<string, bufferlist> *pattrs = nullptr);
int put_linked_bucket_info(RGWBucketInfo& info, bool exclusive, ceph::real_time mtime, obj_version *pep_objv,
- map<string, bufferlist> *pattrs, bool create_entry_point);
+ map<string, bufferlist> *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,
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,
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,
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<rgw_cls_bi_entry> *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<rgw_cls_bi_entry> *entries, bool *is_truncated);
int bi_list(BucketShard& bs, const string& filter_obj, const string& marker, uint32_t max, list<rgw_cls_bi_entry> *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<rgw_cls_bi_entry> *entries, bool *is_truncated);
int bi_remove(BucketShard& bs);
int list_gc_objs(int *index, string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& 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,
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<librados::AioCompletion *>& 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<librados::AioCompletion *>& handles, bool keep_index_consistent,
optional_yield y);
* 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,
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,
}
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<librados::AioCompletion *>& _completions) :
store(_store), bucket_info(_bucket_info), idx_layout(_idx_layout), bs(store->getRados()),
{
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<uint64_t>("rgw_reshard_max_aio");
vector<BucketReshardShard *> 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),
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);
}
}
int new_num_shards,
const RGWBucketInfo& bucket_info,
map<string, bufferlist>& attrs,
- RGWBucketInfo& new_bucket_info)
+ RGWBucketInfo& new_bucket_info,
+ const DoutPrefixProvider *dpp)
{
new_bucket_info = bucket_info;
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;
}
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()
class BucketInfoReshardUpdate
{
+ const DoutPrefixProvider *dpp;
rgw::sal::RGWRadosStore *store;
RGWBucketInfo& bucket_info;
std::map<string, bufferlist> 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;
}
public:
- BucketInfoReshardUpdate(rgw::sal::RGWRadosStore *_store,
+ BucketInfoReshardUpdate(const DoutPrefixProvider *_dpp,
+ rgw::sal::RGWRadosStore *_store,
RGWBucketInfo& _bucket_info,
map<string, bufferlist>& _bucket_attrs,
const string& new_bucket_id) :
+ dpp(_dpp),
store(_store),
bucket_info(_bucket_info),
bucket_attrs(_bucket_attrs)
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;
}
}
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;
}
int max_entries,
bool verbose,
ostream *out,
- Formatter *formatter)
+ Formatter *formatter,
+ const DoutPrefixProvider *dpp)
{
if (out) {
const rgw_bucket& bucket = bucket_info.bucket;
// 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) {
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);
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;
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;
int RGWBucketReshard::execute(int num_shards, int max_op_entries,
+ const DoutPrefixProvider *dpp,
bool verbose, ostream *out, Formatter *formatter,
RGWReshard* reshard_log)
{
}
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;
ret = do_reshard(num_shards,
new_bucket_info,
max_op_entries,
- verbose, out, formatter);
+ verbose, out, formatter, dpp);
if (ret < 0) {
goto error_out;
}
}
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 \"" <<
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 \"" <<
}
}
-int RGWReshard::process_single_logshard(int logshard_num)
+int RGWReshard::process_single_logshard(int logshard_num, const DoutPrefixProvider *dpp)
{
string marker;
bool truncated = true;
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__ <<
}
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__ <<
*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;
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;
}
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;
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: ";
+}
static const std::initializer_list<uint16_t> 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
const std::map<string, bufferlist>& _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);
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");
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;
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();
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;
}
}
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;
}
}
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");
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;
}
}
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;
}
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;
}
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;
}
}
{
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;
}
if (s->cct->_conf->subsys.should_gather<ceph_subsys_rgw, 20>()) {
- 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;
}
}
{
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;
}
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;
}
if (! s->user->get_id().empty() && s->auth.identity->get_identity_type() != TYPE_ROLE) {
try {
map<string, bufferlist> 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()),
return 0;
}
- return do_init_permissions(y);
+ return do_init_permissions(op, y);
}
int RGWHandler_REST::read_permissions(RGWOp* op_obj, optional_yield y)
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()) {
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;
}
}
- ldout(s->cct, 20)
+ ldpp_dout(s, 20)
<< "subdomain=" << subdomain
<< " domain=" << domain
<< " in_hosted_domain=" << in_hosted_domain
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);
}
}
- ldout(s->cct, 20)
+ ldpp_dout(s, 20)
<< "subdomain=" << subdomain
<< " domain=" << domain
<< " in_hosted_domain=" << in_hosted_domain
s->info.domain = domain;
}
- ldout(s->cct, 20)
+ ldpp_dout(s, 20)
<< "final domain/bucket"
<< " subdomain=" << subdomain
<< " domain=" << domain
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;
}
}
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;
}
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 {
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 {
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 {
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 {
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 {
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 {
if (use_http_params) {
RGWBucketInfo bucket_info;
map<string, bufferlist> 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;
}
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 {
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 {
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);
}
}
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)
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();
}
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;
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;
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;
// 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;
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;
op_ret = store->ctl()->bucket->read_bucket_info(*pipe.dest.bucket,
pinfo,
s->yield,
+ s,
RGWBucketCtl::BucketInstance::GetParams(),
nullptr);
if (op_ret < 0) {
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;
}
}
- 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;
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;
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");
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;
void RGWListOIDCProviders::execute(optional_yield y)
{
vector<RGWOIDCProvider> 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");
}
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;
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;
// 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;
}
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;
}
}
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;
return;
}
- op_ret = _role.delete_obj(y);
+ op_ret = _role.delete_obj(s, y);
if (op_ret == -ENOENT) {
op_ret = -ERR_NO_ROLE_FOUND;
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;
return;
}
vector<RGWRole> 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");
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);
read_op.params.attrs = &attrs;
- return read_op.prepare(s->yield);
+ return read_op.prepare(s->yield, s);
}
static inline void set_attr(map<string, bufferlist>& attrs, const char* key, const std::string& value)
}
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);
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;
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?
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) {
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;
client_signature,
date,
session_token,
- using_qs);
+ using_qs,
+ s);
if (ret < 0) {
throw ret;
}
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
/* 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,
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);
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;
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);
}
boost::optional<RGWOIDCProvider>
-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);
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;
}
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;
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;
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) {
}
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)
bool is_cert_valid(const vector<string>& thumbprints, const string& cert) const;
- boost::optional<RGWOIDCProvider> get_provider(const string& role_arn, const string& iss) const;
+ boost::optional<RGWOIDCProvider> get_provider(const DoutPrefixProvider *dpp, const string& role_arn, const string& iss) const;
std::string get_role_tenant(const string& role_arn) const;
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()
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,
map<string, bufferlist> 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;
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;
}
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));
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;
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;
}
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;
}
}
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;
}
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;
}
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("<NULL>"))
<< " s->bucket="
<< rgw_make_bucket_entry_name(s->bucket_tenant, s->bucket_name)
}
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] != '/') {
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);
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;
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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;
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;
}
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;
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<string, bufferlist> 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;
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));
rgw_user user_id(user_name);
map<string, bufferlist> 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;
rgw_user user_id(user_name);
map<string, bufferlist> 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;
RGWUserInfo info;
map<string, bufferlist> 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) {
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)
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;
}
/* 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;
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;
}
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;
}
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;
}
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;
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;
}
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;
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;
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;
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;
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,
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;
}
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);
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);
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,
using RGWAttrs = std::map<std::string, ceph::buffer::list>;
-class RGWStore : public DoutPrefixProvider {
+class RGWStore {
public:
RGWStore() {}
virtual ~RGWStore() = default;
virtual std::unique_ptr<RGWUser> get_user(const rgw_user& u) = 0;
virtual std::unique_ptr<RGWObject> get_object(const rgw_obj_key& k) = 0;
- virtual int get_bucket(RGWUser* u, const rgw_bucket& b, std::unique_ptr<RGWBucket>* bucket, optional_yield y) = 0;
+ virtual int get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const rgw_bucket& b, std::unique_ptr<RGWBucket>* bucket, optional_yield y) = 0;
virtual int get_bucket(RGWUser* u, const RGWBucketInfo& i, std::unique_ptr<RGWBucket>* bucket) = 0;
- virtual int get_bucket(RGWUser* u, const std::string& tenant, const std::string& name, std::unique_ptr<RGWBucket>* 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<RGWBucket>* 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,
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;
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;
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;
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; }
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<RGWObject> 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<RGWObjCategory, RGWStorageStats>& 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<rgw_user_bucket, rgw_usage_log_entry>& usage) = 0;
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 {
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;
};
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;
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;
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;
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)
{
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;
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<RGWObject> RGWRadosStore::get_object(const rgw_obj_key& k)
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;
do {
results.objs.clear();
- ret = list(params, 1000, results, y);
+ ret = list(dpp, params, 1000, results, y);
if (ret < 0)
return ret;
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;
}
/* 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;
}
// 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;
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;
}
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)
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;
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,
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;
}
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<std::string, RGWBucketEnt> 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)
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;
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)
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 */
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,
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,
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<RGWObject> RGWRadosBucket::get_object(const rgw_obj_key& k)
return std::unique_ptr<RGWObject>(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) {
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();
}
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();
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,
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,
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;
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,
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;
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;
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());
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;
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<RGWObject::WriteOp> RGWRadosObject::get_write_op(RGWObjectCtx* ctx)
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;
y);
}
-int RGWRadosStore::get_bucket(RGWUser* u, const rgw_bucket& b, std::unique_ptr<RGWBucket>* bucket, optional_yield y)
+int RGWRadosStore::get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const rgw_bucket& b, std::unique_ptr<RGWBucket>* 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;
return 0;
}
-int RGWRadosStore::get_bucket(RGWUser* u, const std::string& tenant, const std::string&name, std::unique_ptr<RGWBucket>* bucket, optional_yield y)
+int RGWRadosStore::get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const std::string& tenant, const std::string&name, std::unique_ptr<RGWBucket>* 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,
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,
} 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;
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()
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,
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;
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);
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;
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;
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) :
} // 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();
.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;
}
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();
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;
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;
};
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 {
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;
};
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;
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;
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;
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 {
~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<RGWObject> 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<RGWObjCategory, RGWStorageStats>& 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<rgw_user_bucket, rgw_usage_log_entry>& usage) override;
virtual std::unique_ptr<RGWUser> get_user(const rgw_user& u);
virtual std::unique_ptr<RGWObject> get_object(const rgw_obj_key& k) override;
- virtual int get_bucket(RGWUser* u, const rgw_bucket& b, std::unique_ptr<RGWBucket>* bucket, optional_yield y) override;
+ virtual int get_bucket(const DoutPrefixProvider *dpp, RGWUser* u, const rgw_bucket& b, std::unique_ptr<RGWBucket>* bucket, optional_yield y) override;
virtual int get_bucket(RGWUser* u, const RGWBucketInfo& i, std::unique_ptr<RGWBucket>* bucket) override;
- virtual int get_bucket(RGWUser* u, const std::string& tenant, const std::string&name, std::unique_ptr<RGWBucket>* 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<RGWBucket>* 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,
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;
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; }
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;
}
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);
};
bool have_cache,
bool raw,
bool run_sync,
- optional_yield y)
+ optional_yield y,
+ const DoutPrefixProvider *dpp)
{
finisher = std::make_unique<RGWSI_Finisher>(cct);
bucket_sobj = std::make_unique<RGWSI_Bucket_SObj>(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;
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;
}
-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;
}
return 0;
}
-int RGWServiceInstance::start(optional_yield y)
+int RGWServiceInstance::start(optional_yield y, const DoutPrefixProvider *dpp)
{
if (start_state != StateInit) {
return 0;
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;
}
RGWCtlDef::_meta::~_meta() {}
-int RGWCtlDef::init(RGWServices& svc)
+int RGWCtlDef::init(RGWServices& svc, const DoutPrefixProvider *dpp)
{
meta.mgr.reset(new RGWMetadataManager(svc.meta));
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;
} 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);
}
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();
};
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();
RGWCtlDef();
~RGWCtlDef();
- int init(RGWServices& svc);
+ int init(RGWServices& svc, const DoutPrefixProvider *dpp);
};
struct RGWCtl {
RGWBucketCtl *bucket{nullptr};
RGWOTPCtl *otp{nullptr};
- int init(RGWServices *_svc);
+ int init(RGWServices *_svc, const DoutPrefixProvider *dpp);
};
#endif
return AssumeRoleRequestBase::validate_input();
}
-std::tuple<int, RGWRole> STSService::getRoleInfo(const string& arn,
+std::tuple<int, RGWRole> 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;
}
}
-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;
}
return response;
}
-AssumeRoleResponse STSService::assumeRole(AssumeRoleRequest& req,
+AssumeRoleResponse STSService::assumeRole(const DoutPrefixProvider *dpp,
+ AssumeRoleRequest& req,
optional_yield y)
{
AssumeRoleResponse response;
//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;
}
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<int, RGWRole> getRoleInfo(const string& arn, optional_yield y);
- AssumeRoleResponse assumeRole(AssumeRoleRequest& req, optional_yield y);
+ std::tuple<int, RGWRole> 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);
};
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;
/* 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;
}
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;
}
}
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;
}
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;
}
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;
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;
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) {}
};
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;
}
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;
}
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) {}
};
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;
}
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;
// 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;
}
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;
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;
}
}
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;
env(_env),
sub_conf(std::make_shared<PSSubConfig>()),
data_access(std::make_shared<RGWDataAccess>(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) {
}
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);
}
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<string, bufferlist> *pattrs,
+ RGWObjVersionTracker *objv_tracker, real_time *pmtime, optional_yield y, const DoutPrefixProvider *dpp, map<string, bufferlist> *pattrs,
rgw_cache_entry_info *cache_info,
boost::optional<obj_version> refresh_version)
{
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;
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;
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<string, bufferlist> *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<string, bufferlist> *pattrs = NULL,
+ RGWObjVersionTracker *objv_tracker, real_time *pmtime, optional_yield y, const DoutPrefixProvider *dpp, map<string, bufferlist> *pattrs = NULL,
rgw_cache_entry_info *cache_info = NULL,
boost::optional<obj_version> refresh_version = boost::none);
int rgw_delete_system_obj(RGWSI_SysObj *sysobj_svc, const rgw_pool& pool, const string& oid,
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<string, bufferlist>& _attrs);
public:
int get_object(const rgw_obj_key& key,
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,
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<rgw_bucket_shard_sync_info>;
std::vector<StatusShards> peer_status; //< sync status for each peer
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<rgw_bucket_get_sync_policy_result>();
}
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;
BucketTrimObserver *const observer;
std::vector<std::string>::const_iterator bucket;
std::vector<std::string>::const_iterator end;
+ const DoutPrefixProvider *dpp;
public:
BucketTrimInstanceCollectCR(rgw::sal::RGWRadosStore *store, RGWHTTPManager *http,
BucketTrimObserver *observer,
const std::vector<std::string>& 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;
};
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;
}
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;
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
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;
};
}
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");
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
#include "include/common_fwd.h"
#include "include/encoding.h"
#include "common/ceph_time.h"
+#include "common/dout.h"
class RGWCoroutine;
class RGWHTTPManager;
/// 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> impl;
public:
/// 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
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;
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;
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;
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;
}
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<string, cls_user_bucket_entry>& buckets_usage_map,
optional_yield y)
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;
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;
* 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,
optional_yield y,
map<string, bufferlist> *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)
* 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,
rgw_cache_entry_info * const cache_info,
map<string, bufferlist> * 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)
* 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));
* 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));
* 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));
}
// 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;
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;
}
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) {
}
// 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;
}
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)
{
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);
// 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;
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;
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;
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)
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;
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)
{
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;
}
// 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)
}
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;
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)
{
// 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;
// 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;
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;
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;
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)
{
}
// 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;
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;
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;
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;
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;
// 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;
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;
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;
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;
}
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;
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;
}
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;
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();
if (ret < 0)
return ret;
- ret = init(op_state, y);
+ ret = init(dpp, op_state, y);
if (ret < 0)
return ret;
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;
}
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<bool>("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;
}
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;
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");
}
}
-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();
}
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;
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));
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;
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;
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;
// 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;
// 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;
}
-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;
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;
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;
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;
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;
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");
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;
} 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");
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;
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;
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;
// 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;
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;
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());
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;
// 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;
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;
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;
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;
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;
}
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
}
-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;
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;
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;
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;
}
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);
}
};
uobj = static_cast<RGWUserMetadataObject *>(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<RGWUserMetadataObject *>(old_obj);
RGWUserCompleteInfo& uci = uobj->get_uci();
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;
}
}
};
-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)
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)
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)
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)
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<string, bufferlist> *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);
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)
{
return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
return svc.user->remove_user_info(op->ctx(), info,
params.objv_tracker,
- y);
+ y, dpp);
});
}
});
}
-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,
}
if (need_stats) {
map<string, RGWBucketEnt>& 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;
};
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<string, cls_user_bucket_entry>& buckets_usage_map, optional_yield y);
* 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,
* 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,
* 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,
* 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,
* 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,
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);
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);
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;
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);
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;
};
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:
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;
};
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; }
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 */
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);
};
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);
};
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);
};
}
};
- 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<string, bufferlist> *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,
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,
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;
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;
}
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) {
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;
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;
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;
return 0;
}
-int RGWPeriod::create(optional_yield y, bool exclusive)
+int RGWPeriod::create(const DoutPrefixProvider *dpp, optional_yield y, bool exclusive)
{
int ret;
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)
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;
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;
}
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 */
return r;
}
- r = RGWSystemMetaObj::create(y, exclusive);
+ r = RGWSystemMetaObj::create(dpp, y, exclusive);
if (r < 0) {
return r;
}
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);}
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;
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<std::string>& endpoints, const std::string *ptier_type,
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;
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);
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);
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;
};
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();
}
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;
int get_reshard_status(const RGWBucketInfo& bucket_info,
std::list<cls_rgw_bucket_instance_entry> *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,
real_time *pmtime,
map<string, bufferlist> *pattrs,
optional_yield y,
+ const DoutPrefixProvider *dpp,
rgw_cache_entry_info *cache_info = nullptr,
boost::optional<obj_version> refresh_version = boost::none) = 0;
real_time mtime,
map<string, bufferlist> *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,
real_time *pmtime,
map<string, bufferlist> *pattrs,
optional_yield y,
+ const DoutPrefixProvider *dpp,
rgw_cache_entry_info *cache_info = nullptr,
boost::optional<obj_version> refresh_version = boost::none) = 0;
real_time *pmtime,
map<string, bufferlist> *pattrs,
boost::optional<obj_version> 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,
bool exclusive,
real_time mtime,
map<string, bufferlist> *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<string, RGWBucketEnt>& m,
- optional_yield y) = 0;
+ optional_yield y,
+ const DoutPrefixProvider *dpp) = 0;
};
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<bucket_info_cache_entry>);
binfo_cache->init(svc.cache);
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;
}
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;
}
real_time *pmtime,
map<string, bufferlist> *pattrs,
optional_yield y,
+ const DoutPrefixProvider *dpp,
rgw_cache_entry_info *cache_info,
boost::optional<obj_version> refresh_version)
{
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;
}
real_time mtime,
map<string, bufferlist> *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;
}
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,
RGWBucketInfo *info,
real_time *pmtime, map<string, bufferlist> *pattrs,
optional_yield y,
+ const DoutPrefixProvider *dpp,
rgw_cache_entry_info *cache_info,
boost::optional<obj_version> refresh_version)
{
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;
}
/* 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 &&
real_time *pmtime, map<string, bufferlist> *pattrs,
rgw_cache_entry_info *cache_info,
boost::optional<obj_version> refresh_version,
- optional_yield y)
+ optional_yield y,
+ const DoutPrefixProvider *dpp)
{
bufferlist bl;
RGWObjVersionTracker ot;
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;
}
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;
real_time *pmtime,
map<string, bufferlist> *pattrs,
boost::optional<obj_version> refresh_version,
- optional_yield y)
+ optional_yield y,
+ const DoutPrefixProvider *dpp)
{
rgw_cache_entry_info cache_info;
info,
pmtime, pattrs,
y,
+ dpp,
&cache_info, refresh_version);
}
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 */
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;
}
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 */
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) {
/* 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 &&
bool exclusive,
real_time mtime,
map<string, bufferlist> *pattrs,
- optional_yield y)
+ optional_yield y,
+ const DoutPrefixProvider *dpp)
{
bufferlist bl;
encode(info, bl);
&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 {
}
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,
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);
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;
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;
}
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<string, RGWBucketEnt>& m,
- optional_yield y)
+ optional_yield y,
+ const DoutPrefixProvider *dpp)
{
map<string, RGWBucketEnt>::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;
}
}
RGWSI_BucketInstance_BE_Handler bi_be_handler;
std::unique_ptr<RGWSI_MetaBackend::Module> 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,
map<string, bufferlist> *pattrs,
rgw_cache_entry_info *cache_info,
boost::optional<obj_version> 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 {
real_time *pmtime,
map<string, bufferlist> *pattrs,
optional_yield y,
+ const DoutPrefixProvider *dpp,
rgw_cache_entry_info *cache_info = nullptr,
boost::optional<obj_version> refresh_version = boost::none) override;
real_time mtime,
map<string, bufferlist> *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,
real_time *pmtime,
map<string, bufferlist> *pattrs,
optional_yield y,
+ const DoutPrefixProvider *dpp,
rgw_cache_entry_info *cache_info = nullptr,
boost::optional<obj_version> refresh_version = boost::none) override;
real_time *pmtime,
map<string, bufferlist> *pattrs,
boost::optional<obj_version> 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,
bool exclusive,
real_time mtime,
map<string, bufferlist> *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<string, RGWBucketEnt>& m,
- optional_yield y) override;
+ optional_yield y,
+ const DoutPrefixProvider *dpp) override;
};
std::optional<rgw_zone_id> zone,
std::optional<rgw_bucket> 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,
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<bucket_sync_policy_cache_entry>);
sync_policy_cache->init(svc.cache);
const std::set<rgw_zone_id>& zones,
const std::set<rgw_bucket>& buckets,
std::set<rgw_sync_bucket_entity> *hint_entities,
- optional_yield y)
+ optional_yield y, const DoutPrefixProvider *dpp)
{
vector<rgw_bucket> hint_buckets;
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;
}
RGWBucketSyncPolicyHandlerRef& handler,
RGWBucketSyncPolicyHandlerRef& zone_policy_handler,
std::map<optional_zone_bucket, RGWBucketSyncPolicyHandlerRef>& temp_map,
- optional_yield y)
+ optional_yield y,
+ const DoutPrefixProvider *dpp)
{
set<rgw_zone_id> source_zones;
set<rgw_zone_id> target_zones;
std::set<rgw_sync_bucket_entity> 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<rgw_sync_bucket_pipe> resolved_sources;
std::set<rgw_sync_bucket_pipe> resolved_dests;
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;
}
}
std::optional<rgw_bucket> _bucket,
std::map<optional_zone_bucket, RGWBucketSyncPolicyHandlerRef>& temp_map,
RGWBucketSyncPolicyHandlerRef *handler,
- optional_yield y)
+ optional_yield y,
+ const DoutPrefixProvider *dpp)
{
if (!_bucket) {
*handler = svc.zone->get_sync_policy_handler(zone);
nullptr,
&attrs,
y,
+ dpp,
&cache_info);
if (r < 0) {
if (r != -ENOENT) {
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;
std::optional<rgw_zone_id> zone,
std::optional<rgw_bucket> _bucket,
RGWBucketSyncPolicyHandlerRef *handler,
- optional_yield y)
+ optional_yield y,
+ const DoutPrefixProvider *dpp)
{
std::map<optional_zone_bucket, RGWBucketSyncPolicyHandlerRef> 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<rgw_bucket>& orig_set,
std::unique_ptr<RGWSI_Bucket_Sync_SObj_HintIndexManager> hint_index_mgr;
- int do_start(optional_yield) override;
+ int do_start(optional_yield, const DoutPrefixProvider *dpp) override;
struct optional_zone_bucket {
optional<rgw_zone_id> zone;
const std::set<rgw_zone_id>& zone_names,
const std::set<rgw_bucket>& buckets,
std::set<rgw_sync_bucket_entity> *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<optional_zone_bucket, RGWBucketSyncPolicyHandlerRef>& temp_map,
- optional_yield y);
+ optional_yield y,
+ const DoutPrefixProvider *dpp);
int do_get_policy_handler(RGWSI_Bucket_X_Ctx& ctx,
std::optional<rgw_zone_id> zone,
std::optional<rgw_bucket> _bucket,
std::map<optional_zone_bucket, RGWBucketSyncPolicyHandlerRef>& temp_map,
RGWBucketSyncPolicyHandlerRef *handler,
- optional_yield y);
+ optional_yield y,
+ const DoutPrefixProvider *dpp);
public:
struct Svc {
RGWSI_Zone *zone{nullptr};
std::optional<rgw_zone_id> zone,
std::optional<rgw_bucket> bucket,
RGWBucketSyncPolicyHandlerRef *handler,
- optional_yield y);
+ optional_yield y,
+ const DoutPrefixProvider *dpp);
int handle_bi_update(RGWBucketInfo& bucket_info,
RGWBucketInfo *orig_bucket_info,
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;
}
lock.init(this, zone_svc, rados_svc);
}
- int do_start(optional_yield) override;
+ int do_start(optional_yield, const DoutPrefixProvider *dpp) override;
};
#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();
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();
#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();
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) {}
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();
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;
}
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;
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};
}
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;
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
/// 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
/// 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);
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;
RGWMDLogStatus op_type,
optional_yield y,
std::function<int()> 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;
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<int()> f = [&]() {
return put_entry(ctx, key, params, objv_tracker, y);
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<int()> f = [&]() {
return remove_entry(ctx, key, params, objv_tracker, y);
MDLOG_STATUS_REMOVE,
y,
f,
- false);
+ false,
+ dpp);
}
int RGWSI_MetaBackend::mutate(Context *ctx,
MutateParams& params,
RGWObjVersionTracker *objv_tracker,
optional_yield y,
- std::function<int()> f)
+ std::function<int()> 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<RGWSI_MetaBackend_CtxParams> bectx_params,
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,
RGWMDLogStatus op_type,
optional_yield y,
std::function<int()> f,
- bool generic_prepare);
+ bool generic_prepare,
+ const DoutPrefixProvider *dpp);
virtual int pre_modify(Context *ctx,
const std::string& key,
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,
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<int()> f);
+ std::function<int()> f,
+ const DoutPrefixProvider *dpp);
};
class RGWSI_MetaBackend_Handler {
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<int()> f) {
- return be->mutate(be_ctx, key, params, objv_tracker, y, f);
+ std::function<int()> f,
+ const DoutPrefixProvider *dpp) {
+ return be->mutate(be_ctx, key, params, objv_tracker, y, f, dpp);
}
int list_init(const string& marker) {
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<RGWSI_MBOTP_GetParams&>(_params);
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,
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<RGWSI_MetaBackend_SObj::Context_SObj *>(_ctx);
RGWSI_MBSObj_GetParams& params = static_cast<RGWSI_MBSObj_GetParams&>(_params);
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);
}
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,
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;
}
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);
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 */
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;
}
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,
RGWSI_OTP_BE_Handler be_handler;
std::unique_ptr<RGWSI_MetaBackend::Module> be_module;
- int do_start(optional_yield) override;
+ int do_start(optional_yield, const DoutPrefixProvider *dpp) override;
public:
struct Svc {
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,
{
}
-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) {
librados::Rados rados;
std::unique_ptr<RGWAsyncRadosProcessor> async_processor;
- int do_start(optional_yield) override;
+ int do_start(optional_yield, const DoutPrefixProvider *dpp) override;
public:
struct OpenParams {
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();
}
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; }
};
state.emplace<RGWSI_SysObj_Core::GetObjState>();
}
-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;
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,
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);
}
};
-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;
}
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,
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;
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;
}
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;
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;
if (cct->_conf->subsys.should_gather<ceph_subsys_rgw, 20>()) {
map<string, bufferlist>::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;
}
}
}
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,
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) {}
real_time * const pmtime,
rgw_cache_entry_info * const cache_info,
map<string, bufferlist> * 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,
const real_time& mtime,
bool exclusive,
map<string, bufferlist> *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,
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<user_info_cache_entry>);
uinfo_cache->init(svc.cache);
real_time * const pmtime,
rgw_cache_entry_info * const cache_info,
map<string, bufferlist> * 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;
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;
}
ui.user_id = info.user_id;
}
- int prepare() {
+ int prepare(const DoutPrefixProvider *dpp) {
if (objv_tracker) {
ot = *objv_tracker;
}
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
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;
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;
}
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;
}
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() &&
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;
const real_time& mtime,
bool exclusive,
map<string, bufferlist> *attrs,
- optional_yield y)
+ optional_yield y,
+ const DoutPrefixProvider *dpp)
{
PutOperation op(svc, ctx,
info, old_info,
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;
}
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;
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;
}
}
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);
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<RGWSI_MetaBackend_SObj::Context_SObj *>(_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;
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;
}
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);
}
/**
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);
}
/**
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<cls_user_bucket_entry>& entries, bool add, optional_yield y)
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);
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};
real_time * const pmtime,
rgw_cache_entry_info * const cache_info,
map<string, bufferlist> * const pattrs,
- optional_yield y) override;
+ optional_yield y,
+ const DoutPrefixProvider *dpp) override;
int store_user_info(RGWSI_MetaBackend::Context *ctx,
const RGWUserInfo& info,
const real_time& mtime,
bool exclusive,
map<string, bufferlist> *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 */
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;
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;
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;
}
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;
}
&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;
}
* 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 */
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;
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())) {
} 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;
return 0;
}
-int RGWSI_Zone::convert_regionmap(optional_yield y)
+int RGWSI_Zone::convert_regionmap(const DoutPrefixProvider *dpp, optional_yield y)
{
RGWZoneGroupMap zonegroupmap;
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;
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:
#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();
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();
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;
}
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;
}
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;