op_state.set_bucket_quota(user_info.bucket_quota);
string err;
- int r = user.modify(op_state, &err);
+ int r = user.modify(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, &err);
+ int r = user.modify(op_state, null_yield, &err);
if (r < 0) {
cerr << "ERROR: failed updating user info: " << cpp_strerror(-r) << ": " << err << std::endl;
return -r;
if (yes_i_really_mean_it) {
user_op.set_overwrite_new_user(true);
}
- ret = user.rename(user_op, &err_msg);
+ ret = user.rename(user_op, null_yield, &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, &err_msg);
+ ret = user.modify(user_op, null_yield, &err_msg);
if (ret < 0) {
cerr << "could not modify user: " << err_msg << std::endl;
return -ret;
break;
case OPT::SUBUSER_MODIFY:
- ret = user.subusers.modify(user_op, &err_msg);
+ ret = user.subusers.modify(user_op, null_yield, &err_msg);
if (ret < 0) {
cerr << "could not modify subuser: " << err_msg << std::endl;
return -ret;
user_ids.push_back(user_id.id);
ret =
RGWBucketAdminOp::limit_check(store, bucket_op, user_ids, f,
- warnings_only);
+ null_yield, 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,
- warnings_only);
+ null_yield, warnings_only);
if (ret < 0)
break;
}
return -ENOENT;
}
}
- RGWBucketAdminOp::info(store, bucket_op, f);
+ RGWBucketAdminOp::info(store, bucket_op, f, null_yield);
} else {
RGWBucketInfo bucket_info;
int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket);
}
bucket_op.set_fetch_stats(true);
- int r = RGWBucketAdminOp::info(store, bucket_op, f);
+ int r = RGWBucketAdminOp::info(store, bucket_op, f, null_yield);
if (r < 0) {
cerr << "failure: " << cpp_strerror(-r) << ": " << err << std::endl;
return -r;
exit(1);
}
- int ret = store->svc()->zone->add_bucket_placement(pool);
+ int ret = store->svc()->zone->add_bucket_placement(pool, null_yield);
if (ret < 0)
cerr << "failed to add bucket placement: " << cpp_strerror(-ret) << std::endl;
}
exit(1);
}
- int ret = store->svc()->zone->remove_bucket_placement(pool);
+ int ret = store->svc()->zone->remove_bucket_placement(pool, null_yield);
if (ret < 0)
cerr << "failed to remove bucket placement: " << cpp_strerror(-ret) << std::endl;
}
if (opt_cmd == OPT::POOLS_LIST) {
set<rgw_pool> pools;
- int ret = store->svc()->zone->list_placement_set(pools);
+ int ret = store->svc()->zone->list_placement_set(pools, null_yield);
if (ret < 0) {
cerr << "could not list placement set: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
if (opt_cmd == OPT::USER_CHECK) {
- check_bad_user_bucket_mapping(store, user_id, fix);
+ check_bad_user_bucket_mapping(store, user_id, fix, null_yield);
}
if (opt_cmd == OPT::USER_STATS) {
"so at most one of the two should be specified" << std::endl;
return EINVAL;
}
- ret = store->ctl()->user->reset_stats(user_id);
+ ret = store->ctl()->user->reset_stats(user_id, null_yield);
if (ret < 0) {
cerr << "ERROR: could not reset user stats: " << cpp_strerror(-ret) <<
std::endl;
cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- ret = store->ctl()->bucket->sync_user_stats(user_id, bucket_info);
+ ret = store->ctl()->bucket->sync_user_stats(user_id, bucket_info, null_yield);
if (ret < 0) {
cerr << "ERROR: could not sync bucket stats: " <<
cpp_strerror(-ret) << std::endl;
return -ret;
}
} else {
- int ret = rgw_user_sync_all_stats(store, user_id);
+ int ret = rgw_user_sync_all_stats(store, user_id, null_yield);
if (ret < 0) {
cerr << "ERROR: could not sync user stats: " <<
cpp_strerror(-ret) << std::endl;
RGWStorageStats stats;
ceph::real_time last_stats_sync;
ceph::real_time last_stats_update;
- int ret = store->ctl()->user->read_stats(user_id, &stats, &last_stats_sync, &last_stats_update);
+ int ret = store->ctl()->user->read_stats(user_id, &stats, null_yield,
+ &last_stats_sync,
+ &last_stats_update);
if (ret < 0) {
if (ret == -ENOENT) { /* in case of ENOENT */
cerr << "User has not been initialized or user does not exist" << std::endl;
if (opt_cmd == OPT::MDLOG_AUTOTRIM) {
// need a full history for purging old mdlog periods
- store->svc()->mdlog->init_oldest_log_period();
+ store->svc()->mdlog->init_oldest_log_period(null_yield);
RGWCoroutinesManager crs(store->ctx(), store->getRados()->get_cr_registry());
RGWHTTPManager http(store->ctx(), crs.get_completion_mgr());
return -ret;
}
map<int, string> markers;
- ret = store->svc()->bilog_rados->get_log_status(bucket_info, shard_id, &markers);
+ ret = store->svc()->bilog_rados->get_log_status(bucket_info, shard_id,
+ &markers, null_yield);
if (ret < 0) {
cerr << "ERROR: get_bi_log_status(): " << cpp_strerror(-ret) << std::endl;
return -ret;
user_info.mfa_ids.insert(totp_serial);
user_op.set_mfa_ids(user_info.mfa_ids);
string err;
- ret = user.modify(user_op, &err);
+ ret = user.modify(user_op, null_yield, &err);
if (ret < 0) {
cerr << "ERROR: failed storing user info, error: " << err << std::endl;
return -ret;
user_info.mfa_ids.erase(totp_serial);
user_op.set_mfa_ids(user_info.mfa_ids);
string err;
- ret = user.modify(user_op, &err);
+ ret = user.modify(user_op, null_yield, &err);
if (ret < 0) {
cerr << "ERROR: failed storing user info, error: " << err << std::endl;
return -ret;
const string& marker,
const string& end_marker,
uint64_t max,
- bool need_stats)
+ bool need_stats,
+ optional_yield y)
{
rgw::sal::RGWRadosUser user(store, user_id);
- return user.list_buckets(marker, end_marker, max, need_stats, buckets);
+ return user.list_buckets(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)
+ bool fix,
+ optional_yield y)
{
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);
+ int ret = user.list_buckets(marker, string(), max_entries, false, user_buckets, y);
if (ret < 0) {
ldout(store->ctx(), 0) << "failed to read user buckets: "
<< cpp_strerror(-ret) << dendl;
return ret;
}
- ret = store->ctl()->bucket->sync_user_stats(info.owner, info);
+ ret = store->ctl()->bucket->sync_user_stats(info.owner, info, y);
if (ret < 0) {
dout(1) << "WARNING: failed sync user stats before bucket delete. ret=" << ret << dendl;
}
int RGWBucketAdminOp::limit_check(rgw::sal::RGWRadosStore *store,
RGWBucketAdminOpState& op_state,
const std::list<std::string>& user_ids,
- RGWFormatterFlusher& flusher,
+ RGWFormatterFlusher& flusher, optional_yield y,
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);
+ ret = user.list_buckets(marker, string(), max_entries, false, buckets, y);
if (ret < 0)
return ret;
int RGWBucketAdminOp::info(rgw::sal::RGWRadosStore *store,
RGWBucketAdminOpState& op_state,
- RGWFormatterFlusher& flusher)
+ RGWFormatterFlusher& flusher,
+ optional_yield y)
{
RGWBucket bucket;
int ret = 0;
do {
ret = user.list_buckets(marker, empty_end_marker, max_entries,
- no_need_stats, buckets);
+ no_need_stats, buckets, y);
if (ret < 0) {
return ret;
}
bci.info.bucket.tenant = tenant_name;
// if the sync module never writes data, don't require the zone to specify all placement targets
if (bihandler->svc.zone->sync_module_supports_writes()) {
- ret = bihandler->svc.zone->select_bucket_location_by_rule(bci.info.placement_rule, &rule_info);
+ ret = bihandler->svc.zone->select_bucket_location_by_rule(bci.info.placement_rule, &rule_info, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: select_bucket_placement() returned " << ret << dendl;
return ret;
rgw_ep_info *pinfo)
{
return bm_handler->call([&](RGWSI_Bucket_EP_Ctx& ctx) {
- return do_link_bucket(ctx, user_id, bucket, creation_time, y,
- update_entrypoint, pinfo);
+ return do_link_bucket(ctx, user_id, bucket, creation_time,
+ update_entrypoint, pinfo, y);
});
}
const rgw_user& user_id,
const rgw_bucket& bucket,
ceph::real_time creation_time,
- optional_yield y,
bool update_entrypoint,
- rgw_ep_info *pinfo)
+ rgw_ep_info *pinfo,
+ optional_yield y)
{
int ret;
}
}
- ret = ctl.user->add_bucket(user_id, bucket, creation_time);
+ ret = ctl.user->add_bucket(user_id, bucket, creation_time, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: error adding bucket to user directory:"
<< " user=" << user_id
return 0;
done_err:
- int r = do_unlink_bucket(ctx, user_id, bucket, y, true);
+ int r = do_unlink_bucket(ctx, user_id, bucket, true, y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed unlinking bucket on error cleanup: "
<< cpp_strerror(-r) << dendl;
int RGWBucketCtl::unlink_bucket(const rgw_user& user_id, const rgw_bucket& bucket, optional_yield y, bool update_entrypoint)
{
return bm_handler->call([&](RGWSI_Bucket_EP_Ctx& ctx) {
- return do_unlink_bucket(ctx, user_id, bucket, y, update_entrypoint);
+ return do_unlink_bucket(ctx, user_id, bucket, update_entrypoint, y);
});
}
int RGWBucketCtl::do_unlink_bucket(RGWSI_Bucket_EP_Ctx& ctx,
const rgw_user& user_id,
const rgw_bucket& bucket,
- optional_yield y,
- bool update_entrypoint)
+ bool update_entrypoint,
+ optional_yield y)
{
- int ret = ctl.user->remove_bucket(user_id, bucket);
+ int ret = ctl.user->remove_bucket(user_id, bucket, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: error removing bucket from directory: "
<< cpp_strerror(-ret)<< dendl;
int RGWBucketCtl::sync_user_stats(const rgw_user& user_id,
const RGWBucketInfo& bucket_info,
+ optional_yield y,
RGWBucketEnt* pent)
{
RGWBucketEnt ent;
return r;
}
- return ctl.user->flush_bucket_stats(user_id, *pent);
+ return ctl.user->flush_bucket_stats(user_id, *pent, y);
}
int RGWBucketCtl::get_sync_policy_handler(std::optional<rgw_zone_id> zone,
const string& marker,
const string& end_marker,
uint64_t max,
- bool need_stats);
+ 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_bucket_bypass_gc(rgw::sal::RGWRadosStore *store, rgw_bucket& bucket, int concurrent_max, optional_yield y);
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);
+extern void check_bad_user_bucket_mapping(rgw::sal::RGWRadosStore *store, const rgw_user& user_id, bool fix, optional_yield y);
struct RGWBucketAdminOpState {
rgw_user uid;
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);
+ static int info(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y);
static int limit_check(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state,
const std::list<std::string>& user_ids,
- RGWFormatterFlusher& flusher,
+ RGWFormatterFlusher& flusher, optional_yield y,
bool warnings_only = false);
static int set_quota(rgw::sal::RGWRadosStore *store, RGWBucketAdminOpState& op_state);
/* quota related */
int sync_user_stats(const rgw_user& user_id, const RGWBucketInfo& bucket_info,
+ optional_yield y,
RGWBucketEnt* pent = nullptr);
/* bucket sync */
const rgw_user& user,
const rgw_bucket& bucket,
ceph::real_time creation_time,
- optional_yield y,
bool update_entrypoint,
- rgw_ep_info *pinfo);
+ rgw_ep_info *pinfo,
+ optional_yield y);
int do_unlink_bucket(RGWSI_Bucket_EP_Ctx& ctx,
const rgw_user& user_id,
const rgw_bucket& bucket,
- optional_yield y,
- bool update_entrypoint);
+ bool update_entrypoint,
+ optional_yield y);
};
bucket.tenant = user.tenant;
bucket.name = bucket_name;
ret = zone_svc->select_bucket_placement(*user_info, zonegroup_id,
- placement_rule,
- &selected_placement_rule, nullptr);
+ placement_rule,
+ &selected_placement_rule, nullptr, null_yield);
if (selected_placement_rule != bucket_info.placement_rule) {
ldout(cct, 0) << "bucket already exists on a different placement rule: "
<< " selected_rule= " << selected_placement_rule
placement_rule, bucket_info.swift_ver_location,
pquota_info, attrs,
info, nullptr, &ep_objv, creation_time,
- pmaster_bucket, pmaster_num_shards, true);
+ pmaster_bucket, pmaster_num_shards, null_yield, true);
if (ret && ret != -EEXIST)
return -EIO;
}
- op_ret = state->bucket->check_quota(user_quota, bucket_quota, real_ofs, true);
+ op_ret = state->bucket->check_quota(user_quota, bucket_quota, real_ofs, null_yield, true);
/* max_size exceed */
if (op_ret < 0)
return -EIO;
goto done;
}
- op_ret = state->bucket->check_quota(user_quota, bucket_quota, state->obj_size, true);
+ op_ret = state->bucket->check_quota(user_quota, bucket_quota, state->obj_size, null_yield, true);
/* max_size exceed */
if (op_ret < 0) {
goto done;
read_count = max_buckets;
}
- op_ret = s->user->list_buckets(marker, end_marker, read_count, should_get_stats(), buckets);
+ op_ret = s->user->list_buckets(marker, end_marker, read_count, should_get_stats(), buckets, null_yield);
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());
+ op_ret = rgw_user_sync_all_stats(store, s->user->get_id(), null_yield);
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);
+ op_ret = rgw_user_get_all_buckets_stats(store, s->user->get_id(), buckets_usage, null_yield);
if (op_ret < 0) {
ldpp_dout(this, 0) << "ERROR: failed to get user's buckets stats" << dendl;
return;
}
- op_ret = store->ctl()->user->read_stats(s->user->get_id(), &stats);
+ op_ret = store->ctl()->user->read_stats(s->user->get_id(), &stats, null_yield);
if (op_ret < 0) {
ldpp_dout(this, 0) << "ERROR: can't read user header" << dendl;
return;
lastmarker = nullptr;
op_ret = rgw_read_user_buckets(store, s->user->get_id(), buckets, marker,
- string(), max_buckets, true);
+ string(), max_buckets, true, null_yield);
if (op_ret < 0) {
/* hmm.. something wrong here.. the user was authenticated, so it
should exist */
string marker;
op_ret = rgw_read_user_buckets(store, s->user->get_id(), buckets,
marker, string(), s->user->get_max_buckets(),
- false);
+ false, null_yield);
if (op_ret < 0) {
return op_ret;
}
info.swift_ver_location,
pquota_info, policy, attrs, info, ep_objv,
true, obj_lock_enabled, &s->bucket_exists, s->info,
- &s->bucket);
+ &s->bucket, null_yield);
/* continue if EEXIST and create_bucket will fail below. this way we can
* recover from a partial create by retrying it. */
}
}
- op_ret = s->bucket->sync_user_stats();
+ op_ret = s->bucket->sync_user_stats(null_yield);
if ( op_ret < 0) {
ldpp_dout(this, 1) << "WARNING: failed to sync user stats before bucket delete: op_ret= " << op_ret << dendl;
}
if (!chunked_upload) { /* with chunked upload we don't know how big is the upload.
we also check sizes at the end anyway */
- op_ret = s->bucket->check_quota(user_quota, bucket_quota, s->content_length);
+ op_ret = s->bucket->check_quota(user_quota, bucket_quota, s->content_length, null_yield);
if (op_ret < 0) {
ldpp_dout(this, 20) << "check_quota() returned ret=" << op_ret << dendl;
return;
return;
}
- op_ret = s->bucket->check_quota(user_quota, bucket_quota, s->obj_size);
+ op_ret = s->bucket->check_quota(user_quota, bucket_quota, s->obj_size, null_yield);
if (op_ret < 0) {
ldpp_dout(this, 20) << "second check_quota() returned op_ret=" << op_ret << dendl;
return;
ceph::buffer::list bl, aclbl;
int len = 0;
- op_ret = s->bucket->check_quota(user_quota, bucket_quota, s->content_length);
+ op_ret = s->bucket->check_quota(user_quota, bucket_quota, s->content_length, null_yield);
if (op_ret < 0) {
return;
}
s->object->set_obj_size(ofs);
- op_ret = s->bucket->check_quota(user_quota, bucket_quota, s->obj_size);
+ op_ret = s->bucket->check_quota(user_quota, bucket_quota, s->obj_size, null_yield);
if (op_ret < 0) {
return;
}
}
// enforce quota against the destination bucket owner
op_ret = dest_bucket->check_quota(user_quota, bucket_quota,
- astate->accounted_size);
+ astate->accounted_size, null_yield);
if (op_ret < 0) {
return;
}
std::string marker;
op_ret = rgw_read_user_buckets(store, s->user->get_user(), buckets,
marker, std::string(), s->user->get_max_buckets(),
- false);
+ false, null_yield);
if (op_ret < 0) {
return op_ret;
}
pquota_info, policy, attrs,
out_info, ep_objv,
true, false, &bucket_exists,
- info, &bucket);
+ info, &bucket, null_yield);
/* continue if EEXIST and create_bucket will fail below. this way we can
* recover from a partial create by retrying it. */
ldpp_dout(this, 20) << "rgw_create_bucket returned ret=" << op_ret
return op_ret;
}
- op_ret = bucket->check_quota(user_quota, bucket_quota, size);
+ op_ret = bucket->check_quota(user_quota, bucket_quota, size, null_yield);
if (op_ret < 0) {
return op_ret;
}
return op_ret;
}
- op_ret = bucket->check_quota(user_quota, bucket_quota, size);
+ op_ret = bucket->check_quota(user_quota, bucket_quota, size, null_yield);
if (op_ret < 0) {
ldpp_dout(this, 20) << "quota exceeded for path=" << path << dendl;
return op_ret;
}
};
- virtual int fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats) = 0;
+ virtual int fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, optional_yield y) = 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);
+ int get_stats(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, RGWQuotaInfo& quota, optional_yield y);
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) {
+int RGWQuotaCache<T>::get_stats(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, RGWQuotaInfo& quota, optional_yield y) {
RGWQuotaCacheStats qs;
utime_t now = ceph_clock_now();
if (map_find(user, bucket, qs)) {
}
}
- int ret = fetch_stats_from_storage(user, bucket, stats);
+ int ret = fetch_stats_from_storage(user, bucket, stats, y);
if (ret < 0 && ret != -ENOENT)
return ret;
stats_map.add(bucket, qs);
}
- int fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats) override;
+ int fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, optional_yield y) 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)
+int RGWBucketStatsCache::fetch_stats_from_storage(const rgw_user& user, const rgw_bucket& bucket, RGWStorageStats& stats, optional_yield y)
{
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, null_yield);
+ int r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket, bucket_info, NULL, NULL, y);
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);
+ int r = stats->sync_bucket(user, bucket, null_yield);
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();
+ int ret = stats->sync_all_users(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) override;
- int sync_bucket(const rgw_user& rgw_user, rgw_bucket& bucket);
- int sync_user(const rgw_user& user);
- int sync_all_users();
+ 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);
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)
+int RGWUserStatsCache::fetch_stats_from_storage(const rgw_user& user,
+ const rgw_bucket& bucket,
+ RGWStorageStats& stats,
+ optional_yield y)
{
- int r = store->ctl()->user->read_stats(user, &stats);
+ int r = store->ctl()->user->read_stats(user, &stats, y);
if (r < 0) {
ldout(store->ctx(), 0) << "could not get user stats for user=" << user << dendl;
return r;
return 0;
}
-int RGWUserStatsCache::sync_bucket(const rgw_user& user, rgw_bucket& bucket)
+int RGWUserStatsCache::sync_bucket(const rgw_user& user, rgw_bucket& bucket, optional_yield y)
{
RGWBucketInfo bucket_info;
- int r = store->ctl()->bucket->read_bucket_instance_info(bucket, &bucket_info, null_yield);
+ int r = store->ctl()->bucket->read_bucket_instance_info(bucket, &bucket_info, y);
if (r < 0) {
ldout(store->ctx(), 0) << "could not get bucket info for bucket=" << bucket << " r=" << r << dendl;
return r;
}
RGWBucketEnt ent;
- r = store->ctl()->bucket->sync_user_stats(user, bucket_info, &ent);
+ r = store->ctl()->bucket->sync_user_stats(user, bucket_info, y, &ent);
if (r < 0) {
ldout(store->ctx(), 0) << "ERROR: sync_user_stats() for user=" << user << ", bucket=" << bucket << " returned " << r << dendl;
return r;
return store->getRados()->check_bucket_shards(bucket_info, bucket, ent.count);
}
-int RGWUserStatsCache::sync_user(const rgw_user& user)
+int RGWUserStatsCache::sync_user(const rgw_user& user, optional_yield y)
{
string user_str = user.to_str();
RGWStorageStats stats;
ceph::real_time last_stats_sync;
ceph::real_time last_stats_update;
- int ret = store->ctl()->user->read_stats(rgw_user(user_str), &stats, &last_stats_sync, &last_stats_update);
+ int ret = store->ctl()->user->read_stats(rgw_user(user_str), &stats, y, &last_stats_sync, &last_stats_update);
if (ret < 0) {
ldout(store->ctx(), 5) << "ERROR: can't read user header: ret=" << ret << dendl;
return ret;
// check if enough time passed since last full sync
/* FIXME: missing check? */
- ret = rgw_user_sync_all_stats(store, user);
+ ret = rgw_user_sync_all_stats(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()
+int RGWUserStatsCache::sync_all_users(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);
+ int ret = sync_user(user, y);
if (ret < 0) {
ldout(store->ctx(), 5) << "ERROR: sync_user() failed, user=" << user << " ret=" << ret << dendl;
user_stats_cache(_store, quota_threads) {}
int check_quota(const rgw_user& user,
- rgw_bucket& bucket,
- RGWQuotaInfo& user_quota,
- RGWQuotaInfo& bucket_quota,
- uint64_t num_objs,
- uint64_t size) override {
+ rgw_bucket& bucket,
+ RGWQuotaInfo& user_quota,
+ RGWQuotaInfo& bucket_quota,
+ uint64_t num_objs,
+ uint64_t size, optional_yield y) override {
if (!bucket_quota.enabled && !user_quota.enabled) {
return 0;
if (bucket_quota.enabled) {
RGWStorageStats bucket_stats;
int ret = bucket_stats_cache.get_stats(user, bucket, bucket_stats,
- bucket_quota);
+ bucket_quota, y);
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);
+ int ret = user_stats_cache.get_stats(user, bucket, user_stats,
+ user_quota, y);
if (ret < 0) {
return ret;
}
#include <atomic>
+#include "rgw/rgw_basic_types.h"
+#include "common/async/yield_context.h"
+
static inline int64_t rgw_rounded_kb(int64_t bytes)
{
return (bytes + 1023) / 1024;
}
virtual int check_quota(const rgw_user& bucket_owner, rgw_bucket& bucket,
RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota,
- uint64_t num_objs, uint64_t size) = 0;
+ uint64_t num_objs, uint64_t size, optional_yield y) = 0;
virtual void check_bucket_shards(uint64_t max_objs_per_shard, uint64_t num_shards,
uint64_t num_objs, bool& need_resharding, uint32_t *suggested_num_shards) = 0;
int RGWRados::init_svc(bool raw)
{
if (raw) {
- return svc.init_raw(cct, use_cache);
+ return svc.init_raw(cct, use_cache, null_yield);
}
- return svc.init(cct, use_cache, run_sync_thread);
+ return svc.init(cct, use_cache, run_sync_thread, null_yield);
}
int RGWRados::init_ctl()
real_time creation_time,
rgw_bucket *pmaster_bucket,
uint32_t *pmaster_num_shards,
+ optional_yield y,
bool exclusive)
{
#define MAX_CREATE_RETRIES 20 /* need to bound retries */
for (int i = 0; i < MAX_CREATE_RETRIES; i++) {
int ret = 0;
ret = svc.zone->select_bucket_placement(owner, zonegroup_id, placement_rule,
- &selected_placement_rule, &rule_info);
+ &selected_placement_rule, &rule_info, y);
if (ret < 0)
return ret;
}
int RGWRados::check_quota(const rgw_user& bucket_owner, rgw_bucket& bucket,
- RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size, bool check_size_only)
+ RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota,
+ uint64_t obj_size, optional_yield y,
+ bool check_size_only)
{
// if we only check size, then num_objs will set to 0
if(check_size_only)
- return quota_handler->check_quota(bucket_owner, bucket, user_quota, bucket_quota, 0, obj_size);
+ return quota_handler->check_quota(bucket_owner, bucket, user_quota, bucket_quota, 0, obj_size, y);
- return quota_handler->check_quota(bucket_owner, bucket, user_quota, bucket_quota, 1, obj_size);
+ return quota_handler->check_quota(bucket_owner, bucket, user_quota, bucket_quota, 1, obj_size, y);
}
int RGWRados::get_target_shard_id(const rgw::bucket_index_normal_layout& layout, const string& obj_key,
bool obj_to_raw(const rgw_placement_rule& placement_rule, const rgw_obj& obj, rgw_raw_obj *raw_obj);
int create_bucket(const RGWUserInfo& owner, rgw_bucket& bucket,
- const string& zonegroup_id,
- const rgw_placement_rule& placement_rule,
- const string& swift_ver_location,
- const RGWQuotaInfo * pquota_info,
- map<std::string,bufferlist>& attrs,
- RGWBucketInfo& bucket_info,
- obj_version *pobjv,
- obj_version *pep_objv,
- ceph::real_time creation_time,
- rgw_bucket *master_bucket,
- uint32_t *master_num_shards,
- bool exclusive = true);
+ const string& zonegroup_id,
+ const rgw_placement_rule& placement_rule,
+ const string& swift_ver_location,
+ const RGWQuotaInfo * pquota_info,
+ map<std::string,bufferlist>& attrs,
+ RGWBucketInfo& bucket_info,
+ obj_version *pobjv,
+ obj_version *pep_objv,
+ ceph::real_time creation_time,
+ rgw_bucket *master_bucket,
+ uint32_t *master_num_shards,
+ optional_yield y,
+ bool exclusive = true);
RGWCoroutinesManagerRegistry *get_cr_registry() { return cr_registry; }
int fix_tail_obj_locator(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, bool check_size_only = false);
+ 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);
op_state.set_bucket_name(bucket);
op_state.set_fetch_stats(fetch_stats);
- op_ret = RGWBucketAdminOp::info(store, op_state, flusher);
+ op_ret = RGWBucketAdminOp::info(store, op_state, flusher, null_yield);
}
class RGWOp_Get_Policy : public RGWRESTOp {
void RGWOp_MDLog_Info::execute() {
num_objects = s->cct->_conf->rgw_md_log_max_shards;
- period = store->svc()->mdlog->read_oldest_log_period();
+ period = store->svc()->mdlog->read_oldest_log_period(null_yield);
op_ret = period.get_error();
}
op_state.set_fetch_stats(fetch_stats);
op_state.set_sync_stats(sync_stats);
- op_ret = RGWUserAdminOp_User::info(store, op_state, flusher);
+ op_ret = RGWUserAdminOp_User::info(store, op_state, flusher, null_yield);
}
class RGWOp_User_Create : 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);
+ op_ret = RGWUserAdminOp_User::modify(store, op_state, flusher, null_yield);
}
class RGWOp_User_Remove : 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);
+ op_ret = RGWUserAdminOp_Subuser::modify(store, op_state, flusher, null_yield);
}
class RGWOp_Subuser_Remove : public RGWRESTOp {
}
string err;
- op_ret = user.modify(op_state, &err);
+ op_ret = user.modify(op_state, null_yield, &err);
if (op_ret < 0) {
ldout(store->ctx(), 20) << "failed updating user info: " << op_ret << ": " << err << dendl;
return;
bool obj_lock_enabled,
bool *existed,
req_info& req_info,
- std::unique_ptr<RGWBucket>* bucket) = 0;
+ std::unique_ptr<RGWBucket>* bucket,
+ optional_yield y) = 0;
virtual RGWBucketList* list_buckets(void) = 0;
virtual bool is_meta_master() = 0;
virtual int forward_request_to_master(RGWUser* user, obj_version *objv,
virtual ~RGWUser() = default;
virtual int list_buckets(const std::string& marker, const std::string& end_marker,
- uint64_t max, bool need_stats, RGWBucketList& buckets) = 0;
+ 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;
friend class RGWBucket;
virtual std::string& get_display_name() { return info.display_name; }
std::string *max_marker = nullptr,
bool *syncstopped = nullptr) = 0;
virtual int read_bucket_stats(optional_yield y) = 0;
- virtual int sync_user_stats() = 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 put_instance_info(bool exclusive, ceph::real_time mtime) = 0;
virtual bool is_owner(RGWUser* user) = 0;
virtual int check_empty(optional_yield y) = 0;
- virtual int check_quota(RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size, bool check_size_only = false) = 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 read_usage(uint64_t start_epoch, uint64_t end_epoch, uint32_t max_entries,
namespace rgw::sal {
int RGWRadosUser::list_buckets(const string& marker, const string& end_marker,
- uint64_t max, bool need_stats, RGWBucketList &buckets)
+ uint64_t max, bool need_stats, RGWBucketList &buckets,
+ optional_yield y)
{
RGWUserBuckets ulist;
bool is_truncated = false;
buckets.clear();
ret = store->ctl()->user->list_buckets(info.user_id, marker, end_marker, max,
- need_stats, &ulist, &is_truncated);
+ need_stats, &ulist, &is_truncated, y);
if (ret < 0)
return ret;
}
}
- ret = store->ctl()->bucket->sync_user_stats(info.owner, info);
- if ( ret < 0) {
+ ret = store->ctl()->bucket->sync_user_stats(info.owner, info, y);
+ if (ret < 0) {
ldout(store->ctx(), 1) << "WARNING: failed sync user stats before bucket delete. ret=" << ret << dendl;
}
return ret;
}
-int RGWRadosBucket::sync_user_stats()
+int RGWRadosBucket::sync_user_stats(optional_yield y)
{
- return store->ctl()->bucket->sync_user_stats(owner->get_id(), info);
+ return store->ctl()->bucket->sync_user_stats(owner->get_id(), info, y);
}
int RGWRadosBucket::update_container_stats(void)
return store->getRados()->check_bucket_empty(info, y);
}
-int RGWRadosBucket::check_quota(RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size, bool check_size_only)
+int RGWRadosBucket::check_quota(RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size,
+ optional_yield y, bool check_size_only)
{
return store->getRados()->check_quota(owner->get_user(), get_key(),
- user_quota, bucket_quota, obj_size, check_size_only);
+ user_quota, bucket_quota, obj_size, y, check_size_only);
}
int RGWRadosBucket::set_instance_attrs(RGWAttrs& attrs, optional_yield y)
bool obj_lock_enabled,
bool *existed,
req_info& req_info,
- std::unique_ptr<RGWBucket>* bucket_out)
+ std::unique_ptr<RGWBucket>* bucket_out,
+ optional_yield y)
{
int ret;
bufferlist in_data;
if (*existed) {
rgw_placement_rule selected_placement_rule;
ret = svc()->zone->select_bucket_placement(u.get_info(),
- zid, placement_rule,
- &selected_placement_rule, nullptr);
+ zid, placement_rule,
+ &selected_placement_rule, nullptr, y);
if (selected_placement_rule != info.placement_rule) {
ret = -EEXIST;
bucket_out->swap(bucket);
zid, placement_rule, swift_ver_location,
pquota_info, attrs,
info, pobjv, &ep_objv, creation_time,
- pmaster_bucket, pmaster_num_shards, exclusive);
+ pmaster_bucket, pmaster_num_shards, y, exclusive);
if (ret == -EEXIST) {
*existed = true;
ret = 0;
RGWRadosUser() {}
int list_buckets(const std::string& marker, const std::string& end_marker,
- uint64_t max, bool need_stats, RGWBucketList& buckets);
+ uint64_t max, bool need_stats, RGWBucketList& buckets,
+ optional_yield y) override;
RGWBucket* create_bucket(rgw_bucket& bucket, ceph::real_time creation_time);
/* Placeholders */
std::string *max_marker = nullptr,
bool *syncstopped = nullptr) override;
virtual int read_bucket_stats(optional_yield y) override;
- virtual int sync_user_stats() 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 put_instance_info(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_quota(RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size, bool check_size_only = false) 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 read_usage(uint64_t start_epoch, uint64_t end_epoch, uint32_t max_entries,
bool obj_lock_enabled,
bool *existed,
req_info& req_info,
- std::unique_ptr<RGWBucket>* bucket);
+ std::unique_ptr<RGWBucket>* bucket,
+ optional_yield y);
virtual RGWBucketList* list_buckets(void) { return new RGWBucketList(); }
virtual bool is_meta_master() override;
virtual int forward_request_to_master(RGWUser* user, obj_version *objv,
#define dout_subsys ceph_subsys_rgw
-
RGWServices_Def::RGWServices_Def() = default;
RGWServices_Def::~RGWServices_Def()
{
int RGWServices_Def::init(CephContext *cct,
bool have_cache,
bool raw,
- bool run_sync)
+ bool run_sync,
+ optional_yield y)
{
finisher = std::make_unique<RGWSI_Finisher>(cct);
bucket_sobj = std::make_unique<RGWSI_Bucket_SObj>(cct);
can_shutdown = true;
- int r = finisher->start();
+ int r = finisher->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start finisher service (" << cpp_strerror(-r) << dendl;
return r;
}
if (!raw) {
- r = notify->start();
+ r = notify->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start notify service (" << cpp_strerror(-r) << dendl;
return r;
}
}
- r = rados->start();
+ r = rados->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start rados service (" << cpp_strerror(-r) << dendl;
return r;
}
if (!raw) {
- r = zone->start();
+ r = zone->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start zone service (" << cpp_strerror(-r) << dendl;
return r;
return r;
}
- r = mdlog->start();
+ r = mdlog->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start mdlog service (" << cpp_strerror(-r) << dendl;
return r;
}
- r = sync_modules->start();
+ r = sync_modules->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start sync modules service (" << cpp_strerror(-r) << dendl;
return r;
}
}
- r = cls->start();
+ r = cls->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start cls service (" << cpp_strerror(-r) << dendl;
return r;
}
- r = config_key_rados->start();
+ r = config_key_rados->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start config_key service (" << cpp_strerror(-r) << dendl;
return r;
}
- r = zone_utils->start();
+ r = zone_utils->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start zone_utils service (" << cpp_strerror(-r) << dendl;
return r;
}
- r = quota->start();
+ r = quota->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start quota service (" << cpp_strerror(-r) << dendl;
return r;
}
- r = sysobj_core->start();
+ r = sysobj_core->start(y);
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();
+ r = sysobj_cache->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start sysobj_cache service (" << cpp_strerror(-r) << dendl;
return r;
}
}
- r = sysobj->start();
+ r = sysobj->start(y);
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();
+ r = meta_be_sobj->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start meta_be_sobj service (" << cpp_strerror(-r) << dendl;
return r;
}
- r = meta->start();
+ r = meta->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start meta service (" << cpp_strerror(-r) << dendl;
return r;
}
- r = bucket_sobj->start();
+ r = bucket_sobj->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start bucket service (" << cpp_strerror(-r) << dendl;
return r;
}
- r = bucket_sync_sobj->start();
+ r = bucket_sync_sobj->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start bucket_sync service (" << cpp_strerror(-r) << dendl;
return r;
}
- r = user_rados->start();
+ r = user_rados->start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start user_rados service (" << cpp_strerror(-r) << dendl;
return r;
}
- r = otp->start();
+ r = otp->start(y);
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)
+int RGWServices::do_init(CephContext *_cct, bool have_cache, bool raw, bool run_sync, optional_yield y)
{
cct = _cct;
- int r = _svc.init(cct, have_cache, raw, run_sync);
+ int r = _svc.init(cct, have_cache, raw, run_sync, y);
if (r < 0) {
return r;
}
return 0;
}
-int RGWServiceInstance::start()
+int RGWServiceInstance::start(optional_yield y)
{
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();
+ int r = do_start(y);
if (r < 0) {
return r;
}
#include <vector>
#include <memory>
+#include "common/async/yield_context.h"
+
#include "rgw/rgw_common.h"
struct RGWServices_Def;
} start_state{StateInit};
virtual void shutdown() {}
- virtual int do_start() {
+ virtual int do_start(optional_yield) {
return 0;
}
public:
RGWServiceInstance(CephContext *_cct) : cct(_cct) {}
virtual ~RGWServiceInstance() {}
- int start();
+ int start(optional_yield y);
bool is_started() {
return (start_state == StateStarted);
}
RGWServices_Def();
~RGWServices_Def();
- int init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync);
+ int init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync, optional_yield y);
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);
+ int do_init(CephContext *cct, bool have_cache, bool raw_storage, bool run_sync, optional_yield y);
- int init(CephContext *cct, bool have_cache, bool run_sync) {
- return do_init(cct, have_cache, false, run_sync);
+ 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_raw(CephContext *cct, bool have_cache) {
- return do_init(cct, have_cache, true, false);
+ int init_raw(CephContext *cct, bool have_cache, optional_yield y) {
+ return do_init(cct, have_cache, true, false, y);
}
void shutdown() {
_svc.shutdown();
info.access_keys.clear();
}
-int rgw_user_sync_all_stats(rgw::sal::RGWRadosStore *store, const rgw_user& user_id)
+int rgw_user_sync_all_stats(rgw::sal::RGWRadosStore *store,
+ const rgw_user& user_id, optional_yield y)
{
rgw::sal::RGWBucketList user_buckets;
rgw::sal::RGWRadosUser user(store, user_id);
int ret;
do {
- ret = user.list_buckets(marker, string(), max_entries, false, user_buckets);
+ ret = user.list_buckets(marker, string(), max_entries, false, user_buckets, y);
if (ret < 0) {
ldout(cct, 0) << "failed to read user buckets: ret=" << ret << dendl;
return ret;
ldout(cct, 0) << "ERROR: could not read bucket info: bucket=" << bucket << " ret=" << ret << dendl;
continue;
}
- ret = bucket->sync_user_stats();
+ ret = bucket->sync_user_stats(y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: could not sync bucket stats: ret=" << ret << dendl;
return ret;
}
} while (user_buckets.is_truncated());
- ret = store->ctl()->user->complete_flush_stats(user.get_user());
+ ret = store->ctl()->user->complete_flush_stats(user.get_user(), y);
if (ret < 0) {
cerr << "ERROR: failed to complete syncing user stats: ret=" << ret << std::endl;
return ret;
return 0;
}
-int rgw_user_get_all_buckets_stats(rgw::sal::RGWRadosStore *store, const rgw_user& user_id, map<string, cls_user_bucket_entry>& buckets_usage_map)
+int rgw_user_get_all_buckets_stats(rgw::sal::RGWRadosStore *store,
+ const rgw_user& user_id,
+ map<string, cls_user_bucket_entry>& buckets_usage_map,
+ optional_yield y)
{
CephContext *cct = store->ctx();
size_t max_entries = cct->_conf->rgw_list_buckets_max_chunk;
do {
rgw::sal::RGWBucketList buckets;
ret = rgw_read_user_buckets(store, user_id, buckets, marker,
- string(), max_entries, false);
+ string(), max_entries, false, y);
if (ret < 0) {
ldout(cct, 0) << "failed to read user buckets: ret=" << ret << dendl;
return ret;
return 0;
}
-int RGWSubUserPool::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update)
+int RGWSubUserPool::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update, optional_yield y)
{
int ret = 0;
std::string subprocess_msg;
return 0;
}
-int RGWSubUserPool::modify(RGWUserAdminOpState& op_state, std::string *err_msg)
+int RGWSubUserPool::modify(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg)
{
- return RGWSubUserPool::modify(op_state, err_msg, false);
+ return RGWSubUserPool::modify(op_state, y, err_msg, false);
}
-int RGWSubUserPool::modify(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_user_update)
+int RGWSubUserPool::modify(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);
+ ret = execute_modify(op_state, &subprocess_msg, defer_user_update, y);
if (ret < 0) {
set_err_msg(err_msg, "unable to modify subuser, " + subprocess_msg);
return ret;
}
}
-int RGWUser::execute_rename(RGWUserAdminOpState& op_state, std::string *err_msg)
+int RGWUser::execute_rename(RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y)
{
int ret;
bool populated = op_state.is_populated();
rgw::sal::RGWBucketList buckets;
do {
- ret = old_user.list_buckets(marker, "", max_buckets, false, buckets);
+ ret = old_user.list_buckets(marker, "", max_buckets, false, buckets, y);
if (ret < 0) {
set_err_msg(err_msg, "unable to list user buckets");
return ret;
return 0;
}
-int RGWUser::rename(RGWUserAdminOpState& op_state, std::string *err_msg)
+int RGWUser::rename(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg)
{
std::string subprocess_msg;
int ret;
return ret;
}
- ret = execute_rename(op_state, &subprocess_msg);
+ ret = execute_rename(op_state, &subprocess_msg, y);
if (ret < 0) {
set_err_msg(err_msg, "unable to rename user, " + subprocess_msg);
return ret;
size_t max_buckets = cct->_conf->rgw_list_buckets_max_chunk;
do {
ret = rgw_read_user_buckets(store, uid, buckets, marker, string(),
- max_buckets, false);
+ max_buckets, false, y);
if (ret < 0) {
set_err_msg(err_msg, "unable to read user bucket info");
return ret;
return 0;
}
-int RGWUser::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg)
+int RGWUser::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y)
{
bool populated = op_state.is_populated();
int ret = 0;
size_t max_buckets = cct->_conf->rgw_list_buckets_max_chunk;
do {
ret = rgw_read_user_buckets(store, user_id, buckets, marker, string(),
- max_buckets, false);
+ max_buckets, false, y);
if (ret < 0) {
set_err_msg(err_msg, "could not get buckets for uid: " + user_id.to_str());
return ret;
return 0;
}
-int RGWUser::modify(RGWUserAdminOpState& op_state, std::string *err_msg)
+int RGWUser::modify(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);
+ ret = execute_modify(op_state, &subprocess_msg, y);
if (ret < 0) {
set_err_msg(err_msg, "unable to modify user, " + subprocess_msg);
return ret;
}
int RGWUserAdminOp_User::info(rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state,
- RGWFormatterFlusher& flusher)
+ RGWFormatterFlusher& flusher,
+ optional_yield y)
{
RGWUserInfo info;
RGWUser user;
return ret;
if (op_state.sync_stats) {
- ret = rgw_user_sync_all_stats(store, info.user_id);
+ ret = rgw_user_sync_all_stats(store, info.user_id, y);
if (ret < 0) {
return ret;
}
RGWStorageStats stats;
RGWStorageStats *arg_stats = NULL;
if (op_state.fetch_stats) {
- int ret = store->ctl()->user->read_stats(info.user_id, &stats);
+ int ret = store->ctl()->user->read_stats(info.user_id, &stats, y);
if (ret < 0 && ret != -ENOENT) {
return ret;
}
}
int RGWUserAdminOp_User::modify(rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state,
- RGWFormatterFlusher& flusher)
+ RGWFormatterFlusher& flusher, optional_yield y)
{
RGWUserInfo info;
RGWUser user;
return ret;
Formatter *formatter = flusher.get_formatter();
- ret = user.modify(op_state, NULL);
+ ret = user.modify(op_state, y, NULL);
if (ret < 0) {
if (ret == -ENOENT)
ret = -ERR_NO_SUCH_USER;
}
int RGWUserAdminOp_Subuser::modify(rgw::sal::RGWRadosStore *store, RGWUserAdminOpState& op_state,
- RGWFormatterFlusher& flusher)
+ RGWFormatterFlusher& flusher, optional_yield y)
{
RGWUserInfo info;
RGWUser user;
Formatter *formatter = flusher.get_formatter();
- ret = user.subusers.modify(op_state, NULL);
+ ret = user.subusers.modify(op_state, y, NULL);
if (ret < 0)
return ret;
int RGWUserCtl::add_bucket(const rgw_user& user,
const rgw_bucket& bucket,
- ceph::real_time creation_time)
+ ceph::real_time creation_time,
+ optional_yield y)
{
return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
- return svc.user->add_bucket(op->ctx(), user, bucket, creation_time);
+ return svc.user->add_bucket(op->ctx(), user, bucket, creation_time, y);
});
}
int RGWUserCtl::remove_bucket(const rgw_user& user,
- const rgw_bucket& bucket)
+ const rgw_bucket& bucket,
+ optional_yield y)
{
return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
- return svc.user->remove_bucket(op->ctx(), user, bucket);
+ return svc.user->remove_bucket(op->ctx(), user, bucket, y);
});
}
bool need_stats,
RGWUserBuckets *buckets,
bool *is_truncated,
+ optional_yield y,
uint64_t default_max)
{
if (!max) {
return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
int ret = svc.user->list_buckets(op->ctx(), user, marker, end_marker,
- max, buckets, is_truncated);
+ max, buckets, is_truncated, y);
if (ret < 0) {
return ret;
}
}
int RGWUserCtl::flush_bucket_stats(const rgw_user& user,
- const RGWBucketEnt& ent)
+ const RGWBucketEnt& ent,
+ optional_yield y)
{
return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
- return svc.user->flush_bucket_stats(op->ctx(), user, ent);
+ return svc.user->flush_bucket_stats(op->ctx(), user, ent, y);
});
}
-int RGWUserCtl::complete_flush_stats(const rgw_user& user)
+int RGWUserCtl::complete_flush_stats(const rgw_user& user, optional_yield y)
{
return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
- return svc.user->complete_flush_stats(op->ctx(), user);
+ return svc.user->complete_flush_stats(op->ctx(), user, y);
});
}
-int RGWUserCtl::reset_stats(const rgw_user& user)
+int RGWUserCtl::reset_stats(const rgw_user& user, optional_yield y)
{
return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
- return svc.user->reset_bucket_stats(op->ctx(), user);
+ return svc.user->reset_bucket_stats(op->ctx(), user, y);
});
}
int RGWUserCtl::read_stats(const rgw_user& user, RGWStorageStats *stats,
+ optional_yield y,
ceph::real_time *last_stats_sync,
ceph::real_time *last_stats_update)
{
return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) {
return svc.user->read_stats(op->ctx(), user, stats,
- last_stats_sync, last_stats_update);
+ last_stats_sync, last_stats_update, y);
});
}
};
WRITE_CLASS_ENCODER(RGWUID)
-extern int rgw_user_sync_all_stats(rgw::sal::RGWRadosStore *store, const rgw_user& user_id);
-extern int rgw_user_get_all_buckets_stats(rgw::sal::RGWRadosStore *store, const rgw_user& user_id, map<string, cls_user_bucket_entry>&buckets_usage_map);
+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(
+ rgw::sal::RGWRadosStore *store,const rgw_user& user_id,
+ map<string, cls_user_bucket_entry>& buckets_usage_map, optional_yield y);
/**
* Get the anonymous (ie, unauthenticated) user info.
/* API Contract Fulfillment */
int execute_add(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save);
int execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save);
- int execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save);
+ int execute_modify(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 remove(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save);
- int modify(RGWUserAdminOpState& op_state, std::string *err_msg, bool defer_save);
+ int modify(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg, bool defer_save);
public:
explicit RGWSubUserPool(RGWUser *user);
/* API contracted methods */
int add(RGWUserAdminOpState& op_state, std::string *err_msg = NULL);
int remove(RGWUserAdminOpState& op_state, std::string *err_msg = NULL);
- int modify(RGWUserAdminOpState& op_state, std::string *err_msg = NULL);
+ int modify(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL);
friend class RGWUser;
};
int execute_add(RGWUserAdminOpState& op_state, std::string *err_msg);
int execute_remove(RGWUserAdminOpState& op_state,
std::string *err_msg, optional_yield y);
- int execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg);
- int execute_rename(RGWUserAdminOpState& op_state, std::string *err_msg);
+ 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);
public:
RGWUser();
int remove(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL);
- int rename(RGWUserAdminOpState& op_state, std::string *err_msg = NULL);
+ int rename(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL);
/* remove an already populated RGWUser */
int remove(std::string *err_msg = NULL);
- int modify(RGWUserAdminOpState& op_state, std::string *err_msg = NULL);
+ int modify(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, std::string *err_msg = NULL);
RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher);
static int info(rgw::sal::RGWRadosStore *store,
- RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher);
+ RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher,
+ optional_yield y);
static int create(rgw::sal::RGWRadosStore *store,
RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher);
static int modify(rgw::sal::RGWRadosStore *store,
- RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher);
+ RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y);
static int remove(rgw::sal::RGWRadosStore *store,
RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y);
RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher);
static int modify(rgw::sal::RGWRadosStore *store,
- RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher);
+ RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher,
+ optional_yield y);
static int remove(rgw::sal::RGWRadosStore *store,
RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher);
int add_bucket(const rgw_user& user,
const rgw_bucket& bucket,
- ceph::real_time creation_time);
+ ceph::real_time creation_time,
+ optional_yield y);
int remove_bucket(const rgw_user& user,
- const rgw_bucket& bucket);
+ const rgw_bucket& bucket, optional_yield y);
int list_buckets(const rgw_user& user,
const string& marker,
const string& end_marker,
bool need_stats,
RGWUserBuckets *buckets,
bool *is_truncated,
+ optional_yield y,
uint64_t default_max = 1000);
int flush_bucket_stats(const rgw_user& user,
- const RGWBucketEnt& ent);
- int complete_flush_stats(const rgw_user& user);
- int reset_stats(const rgw_user& user);
+ const RGWBucketEnt& ent,
+ optional_yield y);
+ int complete_flush_stats(const rgw_user& user, optional_yield y);
+ int reset_stats(const rgw_user& user, optional_yield y);
int read_stats(const rgw_user& user, RGWStorageStats *stats,
+ optional_yield y,
ceph::real_time *last_stats_sync = nullptr, /* last time a full stats sync completed */
ceph::real_time *last_stats_update = nullptr); /* last time a stats update was done */
int read_stats_async(const rgw_user& user, RGWGetUserStats_CB *ctx);
int RGWSI_BILog_RADOS::get_log_status(const RGWBucketInfo& bucket_info,
int shard_id,
- map<int, string> *markers)
+ map<int, string> *markers,
+ optional_yield y)
{
vector<rgw_bucket_dir_header> headers;
map<int, string> bucket_instance_ids;
- int r = svc.bi->cls_bucket_head(bucket_info, shard_id, &headers, &bucket_instance_ids, null_yield);
+ int r = svc.bi->cls_bucket_head(bucket_info, shard_id, &headers, &bucket_instance_ids, y);
if (r < 0)
return r;
int get_log_status(const RGWBucketInfo& bucket_info,
int shard_id,
- map<int, string> *markers);
+ map<int, string> *markers,
+ optional_yield y);
};
svc.bucket_sync = _bucket_sync_svc;
}
-int RGWSI_Bucket_SObj::do_start()
+int RGWSI_Bucket_SObj::do_start(optional_yield)
{
binfo_cache.reset(new RGWChainedCacheImpl<bucket_info_cache_entry>);
binfo_cache->init(svc.cache);
RGWSI_BucketInstance_BE_Handler bi_be_handler;
std::unique_ptr<RGWSI_MetaBackend::Module> bi_be_module;
- int do_start() override;
+ int do_start(optional_yield) override;
int do_read_bucket_instance_info(RGWSI_Bucket_BI_Ctx& ctx,
const string& key,
hint_index_mgr.reset(new RGWSI_Bucket_Sync_SObj_HintIndexManager(svc.zone, svc.sysobj));
}
-int RGWSI_Bucket_Sync_SObj::do_start()
+int RGWSI_Bucket_Sync_SObj::do_start(optional_yield)
{
sync_policy_cache.reset(new RGWChainedCacheImpl<bucket_sync_policy_cache_entry>);
sync_policy_cache->init(svc.cache);
std::unique_ptr<RGWSI_Bucket_Sync_SObj_HintIndexManager> hint_index_mgr;
- int do_start() override;
+ int do_start(optional_yield) override;
struct optional_zone_bucket {
optional<rgw_zone_id> zone;
static string log_lock_name = "rgw_log_lock";
-int RGWSI_Cls::do_start()
+int RGWSI_Cls::do_start(optional_yield y)
{
- int r = mfa.do_start();
+ int r = mfa.do_start(y);
if (r < 0) {
ldout(cct, 0) << "ERROR: failed to start mfa service" << dendl;
return r;
lock.init(this, zone_svc, rados_svc);
}
- int do_start() override;
+ int do_start(optional_yield) override;
};
#include "svc_rados.h"
#include "svc_config_key_rados.h"
-int RGWSI_ConfigKey_RADOS::do_start()
+int RGWSI_ConfigKey_RADOS::do_start(optional_yield)
{
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() override;
+ int do_start(optional_yield) override;
void warn_if_insecure();
#include "svc_finisher.h"
-int RGWSI_Finisher::do_start()
+int RGWSI_Finisher::do_start(optional_yield)
{
finisher = new Finisher(cct);
finisher->start();
protected:
void init() {}
- int do_start() override;
+ int do_start(optional_yield y) override;
public:
RGWSI_Finisher(CephContext *cct): RGWServiceInstance(cct) {}
return 0;
}
-int RGWSI_MDLog::do_start()
+int RGWSI_MDLog::do_start(optional_yield y)
{
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();
+ svc.mdlog->init_oldest_log_period(y);
}
return 0;
}
int RGWSI_MDLog::read_history(RGWMetadataLogHistory *state,
- RGWObjVersionTracker *objv_tracker) const
+ RGWObjVersionTracker *objv_tracker,
+ optional_yield y) 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, null_yield);
+ int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, objv_tracker, nullptr, y);
if (ret < 0) {
return ret;
}
/* bad history object, remove it */
rgw_raw_obj obj(pool, oid);
auto sysobj = obj_ctx.get_obj(obj);
- ret = sysobj.wop().remove(null_yield);
+ ret = sysobj.wop().remove(y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: meta history is empty, but cannot remove it (" << cpp_strerror(-ret) << ")" << dendl;
return ret;
return cursor;
}
-Cursor RGWSI_MDLog::init_oldest_log_period()
+Cursor RGWSI_MDLog::init_oldest_log_period(optional_yield y)
{
// read the mdlog history
RGWMetadataLogHistory state;
RGWObjVersionTracker objv;
- int ret = read_history(&state, &objv);
+ int ret = read_history(&state, &objv, y);
if (ret == -ENOENT) {
// initialize the mdlog history and write it
return period_history->attach(std::move(period));
}
-Cursor RGWSI_MDLog::read_oldest_log_period() const
+Cursor RGWSI_MDLog::read_oldest_log_period(optional_yield y) const
{
RGWMetadataLogHistory state;
- int ret = read_history(&state, nullptr);
+ int ret = read_history(&state, nullptr, y);
if (ret < 0) {
ldout(cct, 1) << "failed to read mdlog history: "
<< cpp_strerror(ret) << dendl;
RGWSI_SysObj *_sysobj_svc,
RGWSI_Cls *_cls_svc);
- int do_start() override;
+ int do_start(optional_yield y) 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();
+ RGWPeriodHistory::Cursor init_oldest_log_period(optional_yield y);
/// read the oldest log period, and return a cursor to it in our existing
/// period history
- RGWPeriodHistory::Cursor read_oldest_log_period() const;
+ RGWPeriodHistory::Cursor read_oldest_log_period(optional_yield y) 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) const;
+ int read_history(RGWMetadataLogHistory *state, RGWObjVersionTracker *objv_tracker,optional_yield y) const;
int write_history(const RGWMetadataLogHistory& state,
RGWObjVersionTracker *objv_tracker,
bool exclusive = false);
return notify_objs[i];
}
-int RGWSI_Notify::init_watch()
+int RGWSI_Notify::init_watch(optional_yield y)
{
num_watchers = cct->_conf->rgw_num_control_oids;
librados::ObjectWriteOperation op;
op.create(false);
- r = notify_obj.operate(&op, null_yield);
+ r = notify_obj.operate(&op, y);
if (r < 0 && r != -EEXIST) {
ldout(cct, 0) << "ERROR: notify_obj.operate() returned r=" << r << dendl;
return r;
delete[] watchers;
}
-int RGWSI_Notify::do_start()
+int RGWSI_Notify::do_start(optional_yield y)
{
- int r = zone_svc->start();
+ int r = zone_svc->start(y);
if (r < 0) {
return r;
}
assert(zone_svc->is_started()); /* otherwise there's an ordering problem */
- r = rados_svc->start();
+ r = rados_svc->start(y);
if (r < 0) {
return r;
}
- r = finisher_svc->start();
+ r = finisher_svc->start(y);
if (r < 0) {
return r;
}
control_pool = zone_svc->get_zone_params().control_pool;
- int ret = init_watch();
+ int ret = init_watch(y);
if (ret < 0) {
lderr(cct) << "ERROR: failed to initialize watch: " << cpp_strerror(-ret) << dendl;
return ret;
bool finalized{false};
- int init_watch();
+ int init_watch(optional_yield y);
void finalize_watch();
void init(RGWSI_Zone *_zone_svc,
rados_svc = _rados_svc;
finisher_svc = _finisher_svc;
}
- int do_start() override;
+ int do_start(optional_yield) 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()
+int RGWSI_OTP::do_start(optional_yield)
{
/* create first backend handler for bucket entrypoints */
RGWSI_OTP_BE_Handler be_handler;
std::unique_ptr<RGWSI_MetaBackend::Module> be_module;
- int do_start() override;
+ int do_start(optional_yield) override;
public:
struct Svc {
{
}
-int RGWSI_RADOS::do_start()
+int RGWSI_RADOS::do_start(optional_yield)
{
int ret = rados.init_with_context(cct);
if (ret < 0) {
librados::Rados rados;
std::unique_ptr<RGWAsyncRadosProcessor> async_processor;
- int do_start() override;
+ int do_start(optional_yield) override;
public:
struct OpenParams {
rgw_register_sync_modules(sync_modules_manager);
}
-int RGWSI_SyncModules::do_start()
+int RGWSI_SyncModules::do_start(optional_yield)
{
auto& zone_public_config = svc.zone->get_zone();
}
void init(RGWSI_Zone *zone_svc);
- int do_start() override;
+ int do_start(optional_yield) override;
RGWSyncModuleInstanceRef& get_sync_module() { return sync_module; }
};
}
};
-int RGWSI_SysObj_Cache::do_start()
+int RGWSI_SysObj_Cache::do_start(optional_yield y)
{
int r = asocket.start();
if (r < 0) {
return r;
}
- r = RGWSI_SysObj_Core::do_start();
+ r = RGWSI_SysObj_Core::do_start(y);
if (r < 0) {
return r;
}
- r = notify_svc->start();
+ r = notify_svc->start(y);
if (r < 0) {
return r;
}
notify_svc = _notify_svc;
}
- int do_start() override;
+ int do_start(optional_yield) override;
void shutdown() override;
int raw_stat(const rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *epoch,
virtual int add_bucket(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user,
const rgw_bucket& bucket,
- ceph::real_time creation_time) = 0;
+ ceph::real_time creation_time,
+ optional_yield y) = 0;
virtual int remove_bucket(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user,
- const rgw_bucket& _bucket) = 0;
+ const rgw_bucket& _bucket, optional_yield) = 0;
virtual int list_buckets(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user,
const string& marker,
const string& end_marker,
uint64_t max,
RGWUserBuckets *buckets,
- bool *is_truncated) = 0;
+ bool *is_truncated,
+ optional_yield y) = 0;
virtual int flush_bucket_stats(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user,
- const RGWBucketEnt& ent) = 0;
+ const RGWBucketEnt& ent, optional_yield y) = 0;
virtual int complete_flush_stats(RGWSI_MetaBackend::Context *ctx,
- const rgw_user& user) = 0;
+ const rgw_user& user, optional_yield y) = 0;
virtual int reset_bucket_stats(RGWSI_MetaBackend::Context *ctx,
- const rgw_user& user) = 0;
+ const rgw_user& user,
+ optional_yield y) = 0;
virtual int read_stats(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user, RGWStorageStats *stats,
ceph::real_time *last_stats_sync, /* last time a full stats sync completed */
- ceph::real_time *last_stats_update) = 0; /* last time a stats update was done */
+ ceph::real_time *last_stats_update,
+ optional_yield y) = 0; /* last time a stats update was done */
virtual int read_stats_async(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user, RGWGetUserStats_CB *cb) = 0;
svc.sync_modules = _sync_modules_svc;
}
-int RGWSI_User_RADOS::do_start()
+int RGWSI_User_RADOS::do_start(optional_yield)
{
uinfo_cache.reset(new RGWChainedCacheImpl<user_info_cache_entry>);
uinfo_cache->init(svc.cache);
info, objv_tracker, pmtime, y);
}
-int RGWSI_User_RADOS::cls_user_update_buckets(rgw_raw_obj& obj, list<cls_user_bucket_entry>& entries, bool add)
+int RGWSI_User_RADOS::cls_user_update_buckets(rgw_raw_obj& obj, list<cls_user_bucket_entry>& entries, bool add, optional_yield y)
{
auto rados_obj = svc.rados->obj(obj);
int r = rados_obj.open();
librados::ObjectWriteOperation op;
cls_user_set_buckets(op, entries, add);
- r = rados_obj.operate(&op, null_yield);
+ r = rados_obj.operate(&op, y);
if (r < 0) {
return r;
}
return 0;
}
-int RGWSI_User_RADOS::cls_user_add_bucket(rgw_raw_obj& obj, const cls_user_bucket_entry& entry)
+int RGWSI_User_RADOS::cls_user_add_bucket(rgw_raw_obj& obj, const cls_user_bucket_entry& entry, optional_yield y)
{
list<cls_user_bucket_entry> l;
l.push_back(entry);
- return cls_user_update_buckets(obj, l, true);
+ return cls_user_update_buckets(obj, l, true, y);
}
-int RGWSI_User_RADOS::cls_user_remove_bucket(rgw_raw_obj& obj, const cls_user_bucket& bucket)
+int RGWSI_User_RADOS::cls_user_remove_bucket(rgw_raw_obj& obj, const cls_user_bucket& bucket, optional_yield y)
{
auto rados_obj = svc.rados->obj(obj);
int r = rados_obj.open();
librados::ObjectWriteOperation op;
::cls_user_remove_bucket(op, bucket);
- r = rados_obj.operate(&op, null_yield);
+ r = rados_obj.operate(&op, y);
if (r < 0)
return r;
int RGWSI_User_RADOS::add_bucket(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user,
const rgw_bucket& bucket,
- ceph::real_time creation_time)
+ ceph::real_time creation_time,
+ optional_yield y)
{
int ret;
new_bucket.creation_time = creation_time;
rgw_raw_obj obj = get_buckets_obj(user);
- ret = cls_user_add_bucket(obj, new_bucket);
+ ret = cls_user_add_bucket(obj, new_bucket, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: error adding bucket to user: ret=" << ret << dendl;
return ret;
int RGWSI_User_RADOS::remove_bucket(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user,
- const rgw_bucket& _bucket)
+ const rgw_bucket& _bucket,
+ optional_yield y)
{
cls_user_bucket bucket;
bucket.name = _bucket.name;
rgw_raw_obj obj = get_buckets_obj(user);
- int ret = cls_user_remove_bucket(obj, bucket);
+ int ret = cls_user_remove_bucket(obj, bucket, y);
if (ret < 0) {
ldout(cct, 0) << "ERROR: error removing bucket from user: ret=" << ret << dendl;
}
}
int RGWSI_User_RADOS::cls_user_flush_bucket_stats(rgw_raw_obj& user_obj,
- const RGWBucketEnt& ent)
+ const RGWBucketEnt& ent, optional_yield y)
{
cls_user_bucket_entry entry;
ent.convert(&entry);
list<cls_user_bucket_entry> entries;
entries.push_back(entry);
- int r = cls_user_update_buckets(user_obj, entries, false);
+ int r = cls_user_update_buckets(user_obj, entries, false, y);
if (r < 0) {
ldout(cct, 20) << "cls_user_update_buckets() returned " << r << dendl;
return r;
const int max_entries,
list<cls_user_bucket_entry>& entries,
string * const out_marker,
- bool * const truncated)
+ bool * const truncated,
+ optional_yield y)
{
auto rados_obj = svc.rados->obj(obj);
int r = rados_obj.open();
cls_user_bucket_list(op, in_marker, end_marker, max_entries, entries, out_marker, truncated, &rc);
bufferlist ibl;
- r = rados_obj.operate(&op, &ibl, null_yield);
+ r = rados_obj.operate(&op, &ibl, y);
if (r < 0)
return r;
if (rc < 0)
}
int RGWSI_User_RADOS::list_buckets(RGWSI_MetaBackend::Context *ctx,
- const rgw_user& user,
- const string& marker,
- const string& end_marker,
- uint64_t max,
- RGWUserBuckets *buckets,
- bool *is_truncated)
+ const rgw_user& user,
+ const string& marker,
+ const string& end_marker,
+ uint64_t max,
+ RGWUserBuckets *buckets,
+ bool *is_truncated, optional_yield y)
{
int ret;
ldout(cct, 20) << "RGWSI_User_RADOS::list_buckets(): anonymous user" << dendl;
*is_truncated = false;
return 0;
- }
+ }
rgw_raw_obj obj = get_buckets_obj(user);
bool truncated = false;
do {
std::list<cls_user_bucket_entry> entries;
- ret = cls_user_list_buckets(obj, m, end_marker, max - total, entries, &m, &truncated);
+ ret = cls_user_list_buckets(obj, m, end_marker, max - total, entries, &m, &truncated, y);
if (ret == -ENOENT) {
ret = 0;
}
int RGWSI_User_RADOS::flush_bucket_stats(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user,
- const RGWBucketEnt& ent)
+ const RGWBucketEnt& ent,
+ optional_yield y)
{
rgw_raw_obj obj = get_buckets_obj(user);
- return cls_user_flush_bucket_stats(obj, ent);
+ return cls_user_flush_bucket_stats(obj, ent, y);
}
int RGWSI_User_RADOS::reset_bucket_stats(RGWSI_MetaBackend::Context *ctx,
- const rgw_user& user)
+ const rgw_user& user,
+ optional_yield y)
{
- return cls_user_reset_stats(user);
+ return cls_user_reset_stats(user, y);
}
-int RGWSI_User_RADOS::cls_user_reset_stats(const rgw_user& user)
+int RGWSI_User_RADOS::cls_user_reset_stats(const rgw_user& user, optional_yield y)
{
rgw_raw_obj obj = get_buckets_obj(user);
auto rados_obj = svc.rados->obj(obj);
encode(call, in);
op.exec("user", "reset_user_stats2", in, &out, &rval);
- r = rados_obj.operate(&op, null_yield, librados::OPERATION_RETURNVEC);
+ r = rados_obj.operate(&op, y, librados::OPERATION_RETURNVEC);
if (r < 0) {
return r;
}
}
int RGWSI_User_RADOS::complete_flush_stats(RGWSI_MetaBackend::Context *ctx,
- const rgw_user& user)
+ const rgw_user& user, optional_yield y)
{
rgw_raw_obj obj = get_buckets_obj(user);
auto rados_obj = svc.rados->obj(obj);
}
librados::ObjectWriteOperation op;
::cls_user_complete_stats_sync(op);
- return rados_obj.operate(&op, null_yield);
+ return rados_obj.operate(&op, y);
}
-int RGWSI_User_RADOS::cls_user_get_header(const rgw_user& user, cls_user_header *header)
+int RGWSI_User_RADOS::cls_user_get_header(const rgw_user& user, cls_user_header *header,
+ optional_yield y)
{
rgw_raw_obj obj = get_buckets_obj(user);
auto rados_obj = svc.rados->obj(obj);
bufferlist ibl;
librados::ObjectReadOperation op;
::cls_user_get_header(op, header, &rc);
- return rados_obj.operate(&op, &ibl, null_yield);
+ return rados_obj.operate(&op, &ibl, y);
}
int RGWSI_User_RADOS::cls_user_get_header_async(const string& user_str, RGWGetUserHeader_CB *cb)
int RGWSI_User_RADOS::read_stats(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user, RGWStorageStats *stats,
ceph::real_time *last_stats_sync,
- ceph::real_time *last_stats_update)
+ ceph::real_time *last_stats_update,
+ optional_yield y)
{
string user_str = user.to_str();
cls_user_header header;
- int r = cls_user_get_header(rgw_user(user_str), &header);
+ int r = cls_user_get_header(rgw_user(user_str), &header, y);
if (r < 0)
return r;
-
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab ft=cpp
int remove_swift_name_index(RGWSI_MetaBackend::Context *ctx, const string& swift_name, optional_yield y);
/* admin management */
- int cls_user_update_buckets(rgw_raw_obj& obj, list<cls_user_bucket_entry>& entries, bool add);
- int cls_user_add_bucket(rgw_raw_obj& obj, const cls_user_bucket_entry& entry);
- int cls_user_remove_bucket(rgw_raw_obj& obj, const cls_user_bucket& bucket);
+ int cls_user_update_buckets(rgw_raw_obj& obj, list<cls_user_bucket_entry>& entries, bool add, optional_yield y);
+ int cls_user_add_bucket(rgw_raw_obj& obj, const cls_user_bucket_entry& entry, optional_yield y);
+ int cls_user_remove_bucket(rgw_raw_obj& obj, const cls_user_bucket& bucket, optional_yield y);
/* quota stats */
int cls_user_flush_bucket_stats(rgw_raw_obj& user_obj,
- const RGWBucketEnt& ent);
+ const RGWBucketEnt& ent, optional_yield y);
int cls_user_list_buckets(rgw_raw_obj& obj,
const string& in_marker,
const string& end_marker,
const int max_entries,
list<cls_user_bucket_entry>& entries,
string * const out_marker,
- bool * const truncated);
+ bool * const truncated,
+ optional_yield y);
- int cls_user_reset_stats(const rgw_user& user);
- int cls_user_get_header(const rgw_user& user, cls_user_header *header);
+ int cls_user_reset_stats(const rgw_user& user, 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() override;
+ int do_start(optional_yield) override;
public:
struct Svc {
RGWSI_User_RADOS *user{nullptr};
RGWUserInfo *info, /* out */
RGWObjVersionTracker * const objv_tracker,
real_time * const pmtime,
- optional_yield y);
+ optional_yield y) override;
int get_user_info_by_access_key(RGWSI_MetaBackend::Context *ctx,
const std::string& access_key,
RGWUserInfo *info,
int add_bucket(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user,
const rgw_bucket& bucket,
- ceph::real_time creation_time) override;
+ ceph::real_time creation_time,
+ optional_yield y) override;
int remove_bucket(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user,
- const rgw_bucket& _bucket) override;
+ const rgw_bucket& _bucket,
+ optional_yield y) override;
int list_buckets(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user,
const string& marker,
const string& end_marker,
uint64_t max,
RGWUserBuckets *buckets,
- bool *is_truncated) override;
+ bool *is_truncated,
+ optional_yield y) override;
/* quota related */
int flush_bucket_stats(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user,
- const RGWBucketEnt& ent) override;
+ const RGWBucketEnt& ent, optional_yield y) override;
int complete_flush_stats(RGWSI_MetaBackend::Context *ctx,
- const rgw_user& user) override;
+ const rgw_user& user, optional_yield y) override;
int reset_bucket_stats(RGWSI_MetaBackend::Context *ctx,
- const rgw_user& user) override;
+ const rgw_user& user,
+ optional_yield y) override;
int read_stats(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user, RGWStorageStats *stats,
ceph::real_time *last_stats_sync, /* last time a full stats sync completed */
- ceph::real_time *last_stats_update) override; /* last time a stats update was done */
+ ceph::real_time *last_stats_update,
+ optional_yield y) override; /* last time a stats update was done */
int read_stats_async(RGWSI_MetaBackend::Context *ctx,
const rgw_user& user, RGWGetUserStats_CB *cb) override;
sync_modules_svc->get_manager()->supports_data_export(source_zone.tier_type);
}
-int RGWSI_Zone::do_start()
+int RGWSI_Zone::do_start(optional_yield y)
{
- int ret = sysobj_svc->start();
+ int ret = sysobj_svc->start(y);
if (ret < 0) {
return ret;
}
assert(sysobj_svc->is_started()); /* if not then there's ordering issue */
- ret = rados_svc->start();
+ ret = rados_svc->start(y);
if (ret < 0) {
return ret;
}
ldout(cct, 20) << "current period " << current_period->get_id() << dendl;
}
- ret = replace_region_with_zonegroup();
+ ret = replace_region_with_zonegroup(y);
if (ret < 0) {
lderr(cct) << "failed converting region to zonegroup : ret "<< ret << " " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = convert_regionmap();
+ ret = convert_regionmap(y);
if (ret < 0) {
lderr(cct) << "failed converting regionmap: " << cpp_strerror(-ret) << dendl;
return ret;
for (auto ziter : zonegroup->zones) {
auto zone_handler = std::make_shared<RGWBucketSyncPolicyHandler>(this, sync_modules_svc, bucket_sync_svc, ziter.second.id);
- ret = zone_handler->init(null_yield);
+ ret = zone_handler->init(y);
if (ret < 0) {
lderr(cct) << "ERROR: could not initialize zone policy handler for zone=" << ziter.second.name << dendl;
return ret;
&target_zones,
false); /* relaxed: also get all zones that we allow to sync to/from */
- ret = sync_modules_svc->start();
+ ret = sync_modules_svc->start(y);
if (ret < 0) {
return ret;
}
* backward compatability
* Returns 0 on success, -ERR# on failure.
*/
-int RGWSI_Zone::replace_region_with_zonegroup()
+int RGWSI_Zone::replace_region_with_zonegroup(optional_yield y)
{
/* copy default region */
/* convert default region to default zonegroup */
RGWSysObjectCtx obj_ctx = sysobj_svc->init_obj_ctx();
RGWSysObj sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid));
- int ret = sysobj.rop().read(&bl, null_yield);
+ int ret = sysobj.rop().read(&bl, y);
if (ret < 0 && ret != -ENOENT) {
ldout(cct, 0) << __func__ << " failed to read converted: ret "<< ret << " " << cpp_strerror(-ret)
<< dendl;
/* mark as converted */
ret = sysobj.wop()
.set_exclusive(true)
- .write(bl, null_yield);
+ .write(bl, y);
if (ret < 0 ) {
ldout(cct, 0) << __func__ << " failed to mark cluster as converted: ret "<< ret << " " << cpp_strerror(-ret)
<< dendl;
return 0;
}
-int RGWSI_Zone::convert_regionmap()
+int RGWSI_Zone::convert_regionmap(optional_yield y)
{
RGWZoneGroupMap zonegroupmap;
RGWSysObjectCtx obj_ctx = sysobj_svc->init_obj_ctx();
RGWSysObj sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid));
- int ret = sysobj.rop().read(&bl, null_yield);
+ int ret = sysobj.rop().read(&bl, y);
if (ret < 0 && ret != -ENOENT) {
return ret;
} else if (ret == -ENOENT) {
current_period->set_bucket_quota(zonegroupmap.bucket_quota);
// remove the region_map so we don't try to convert again
- ret = sysobj.wop().remove(null_yield);
+ ret = sysobj.wop().remove(y);
if (ret < 0) {
ldout(cct, 0) << "Error could not remove " << sysobj.get_obj()
<< " after upgrading to zonegroup map: " << cpp_strerror(ret) << dendl;
int RGWSI_Zone::select_new_bucket_location(const RGWUserInfo& user_info, const string& zonegroup_id,
- const rgw_placement_rule& request_rule,
- rgw_placement_rule *pselected_rule_name, RGWZonePlacementInfo *rule_info)
+ const rgw_placement_rule& request_rule,
+ rgw_placement_rule *pselected_rule_name, RGWZonePlacementInfo *rule_info,
+ optional_yield y)
{
/* first check that zonegroup exists within current period. */
RGWZoneGroup zonegroup;
*pselected_rule_name = rule;
}
- return select_bucket_location_by_rule(rule, rule_info);
+ return select_bucket_location_by_rule(rule, rule_info, y);
}
-int RGWSI_Zone::select_bucket_location_by_rule(const rgw_placement_rule& location_rule, RGWZonePlacementInfo *rule_info)
+int RGWSI_Zone::select_bucket_location_by_rule(const rgw_placement_rule& location_rule, RGWZonePlacementInfo *rule_info, optional_yield y)
{
if (location_rule.name.empty()) {
/* we can only reach here if we're trying to set a bucket location from a bucket
* created on a different zone, using a legacy / default pool configuration
*/
if (rule_info) {
- return select_legacy_bucket_placement(rule_info);
+ return select_legacy_bucket_placement(rule_info, y);
}
return 0;
int RGWSI_Zone::select_bucket_placement(const RGWUserInfo& user_info, const string& zonegroup_id,
const rgw_placement_rule& placement_rule,
- rgw_placement_rule *pselected_rule, RGWZonePlacementInfo *rule_info)
+ rgw_placement_rule *pselected_rule, RGWZonePlacementInfo *rule_info,
+ optional_yield y)
{
if (!zone_params->placement_pools.empty()) {
return select_new_bucket_location(user_info, zonegroup_id, placement_rule,
- pselected_rule, rule_info);
+ pselected_rule, rule_info, y);
}
if (pselected_rule) {
}
if (rule_info) {
- return select_legacy_bucket_placement(rule_info);
+ return select_legacy_bucket_placement(rule_info, y);
}
return 0;
}
-int RGWSI_Zone::select_legacy_bucket_placement(RGWZonePlacementInfo *rule_info)
+int RGWSI_Zone::select_legacy_bucket_placement(RGWZonePlacementInfo *rule_info,
+ optional_yield y)
{
bufferlist map_bl;
map<string, bufferlist> m;
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = obj_ctx.get_obj(obj);
- int ret = sysobj.rop().read(&map_bl, null_yield);
+ int ret = sysobj.rop().read(&map_bl, y);
if (ret < 0) {
goto read_omap;
}
read_omap:
if (m.empty()) {
- ret = sysobj.omap().get_all(&m, null_yield);
+ ret = sysobj.omap().get_all(&m, y);
write_map = true;
}
ret = rados_svc->pool().create(pools, &retcodes);
if (ret < 0)
return ret;
- ret = sysobj.omap().set(s, bl, null_yield);
+ ret = sysobj.omap().set(s, bl, y);
if (ret < 0)
return ret;
m[s] = bl;
if (write_map) {
bufferlist new_bl;
encode(m, new_bl);
- ret = sysobj.wop().write(new_bl, null_yield);
+ ret = sysobj.wop().write(new_bl, y);
if (ret < 0) {
ldout(cct, 0) << "WARNING: could not save avail pools map info ret=" << ret << dendl;
}
return 0;
}
-int RGWSI_Zone::update_placement_map()
+int RGWSI_Zone::update_placement_map(optional_yield y)
{
bufferlist header;
map<string, bufferlist> m;
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = obj_ctx.get_obj(obj);
- int ret = sysobj.omap().get_all(&m, null_yield);
+ int ret = sysobj.omap().get_all(&m, y);
if (ret < 0)
return ret;
bufferlist new_bl;
encode(m, new_bl);
- ret = sysobj.wop().write(new_bl, null_yield);
+ ret = sysobj.wop().write(new_bl, y);
if (ret < 0) {
ldout(cct, 0) << "WARNING: could not save avail pools map info ret=" << ret << dendl;
}
return ret;
}
-int RGWSI_Zone::add_bucket_placement(const rgw_pool& new_pool)
+int RGWSI_Zone::add_bucket_placement(const rgw_pool& new_pool, optional_yield y)
{
int ret = rados_svc->pool(new_pool).lookup();
if (ret < 0) { // DNE, or something
auto sysobj = obj_ctx.get_obj(obj);
bufferlist empty_bl;
- ret = sysobj.omap().set(new_pool.to_str(), empty_bl, null_yield);
+ ret = sysobj.omap().set(new_pool.to_str(), empty_bl, y);
// don't care about return value
- update_placement_map();
+ update_placement_map(y);
return ret;
}
-int RGWSI_Zone::remove_bucket_placement(const rgw_pool& old_pool)
+int RGWSI_Zone::remove_bucket_placement(const rgw_pool& old_pool, optional_yield y)
{
rgw_raw_obj obj(zone_params->domain_root, avail_pools);
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = obj_ctx.get_obj(obj);
- int ret = sysobj.omap().del(old_pool.to_str(), null_yield);
+ int ret = sysobj.omap().del(old_pool.to_str(), y);
// don't care about return value
- update_placement_map();
+ update_placement_map(y);
return ret;
}
-int RGWSI_Zone::list_placement_set(set<rgw_pool>& names)
+int RGWSI_Zone::list_placement_set(set<rgw_pool>& names, optional_yield y)
{
bufferlist header;
map<string, bufferlist> m;
rgw_raw_obj obj(zone_params->domain_root, avail_pools);
auto obj_ctx = sysobj_svc->init_obj_ctx();
auto sysobj = obj_ctx.get_obj(obj);
- int ret = sysobj.omap().get_all(&m, null_yield);
+ int ret = sysobj.omap().get_all(&m, y);
if (ret < 0)
return ret;
std::unique_ptr<rgw_sync_policy_info> sync_policy;
void init(RGWSI_SysObj *_sysobj_svc,
- RGWSI_RADOS *_rados_svc,
- RGWSI_SyncModules *_sync_modules_svc,
- RGWSI_Bucket_Sync *_bucket_sync_svc);
- int do_start() override;
+ RGWSI_RADOS *_rados_svc,
+ RGWSI_SyncModules *_sync_modules_svc,
+ RGWSI_Bucket_Sync *_bucket_sync_svc);
+ int do_start(optional_yield y) override;
void shutdown() override;
- int replace_region_with_zonegroup();
+ int replace_region_with_zonegroup(optional_yield y);
int init_zg_from_period(bool *initialized);
int init_zg_from_local(bool *creating_defaults);
- int convert_regionmap();
+ int convert_regionmap(optional_yield y);
- int update_placement_map();
+ int update_placement_map(optional_yield y);
public:
RGWSI_Zone(CephContext *cct);
~RGWSI_Zone();
int select_bucket_placement(const RGWUserInfo& user_info, const string& zonegroup_id,
const rgw_placement_rule& rule,
- rgw_placement_rule *pselected_rule, RGWZonePlacementInfo *rule_info);
- int select_legacy_bucket_placement(RGWZonePlacementInfo *rule_info);
+ rgw_placement_rule *pselected_rule, RGWZonePlacementInfo *rule_info, optional_yield y);
+ int select_legacy_bucket_placement(RGWZonePlacementInfo *rule_info, optional_yield y);
int select_new_bucket_location(const RGWUserInfo& user_info, const string& zonegroup_id,
const rgw_placement_rule& rule,
- rgw_placement_rule *pselected_rule_name, RGWZonePlacementInfo *rule_info);
- int select_bucket_location_by_rule(const rgw_placement_rule& location_rule, RGWZonePlacementInfo *rule_info);
+ rgw_placement_rule *pselected_rule_name, RGWZonePlacementInfo *rule_info,
+ optional_yield y);
+ int select_bucket_location_by_rule(const rgw_placement_rule& location_rule, RGWZonePlacementInfo *rule_info, optional_yield y);
- int add_bucket_placement(const rgw_pool& new_pool);
- int remove_bucket_placement(const rgw_pool& old_pool);
- int list_placement_set(set<rgw_pool>& names);
+ int add_bucket_placement(const rgw_pool& new_pool, optional_yield y);
+ int remove_bucket_placement(const rgw_pool& old_pool, optional_yield y);
+ int list_placement_set(set<rgw_pool>& names, optional_yield y);
bool is_meta_master() const;
#include "rgw/rgw_zone.h"
-int RGWSI_ZoneUtils::do_start()
+int RGWSI_ZoneUtils::do_start(optional_yield)
{
init_unique_trans_id_deps();
zone_svc = _zone_svc;
}
- int do_start() override;
+ int do_start(optional_yield) 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&) override {
+ virtual int list_buckets(const string&, const string&, uint64_t, bool, sal::RGWBucketList&, optional_yield y) override {
return 0;
}
void SetUp() override {
rados.emplace(g_ceph_context);
- ASSERT_EQ(0, rados->start());
+ ASSERT_EQ(0, rados->start(null_yield));
int r = rados->pool({poolname}).create();
if (r == -EEXIST)
r = 0;