read_op.params.attrs = &attrs;
read_op.params.obj_size = &obj_size;
- int ret = read_op.prepare();
+ int ret = read_op.prepare(null_yield);
if (ret < 0) {
lderr(store->ctx()) << "ERROR: failed to stat object, returned error: " << cpp_strerror(-ret) << dendl;
return ret;
RGWRados::Object op_target(store, bucket_info, obj_ctx, obj);
RGWRados::Object::Read read_op(&op_target);
- int ret = read_op.prepare();
+ int ret = read_op.prepare(null_yield);
bool needs_fixing = (ret == -ENOENT);
f->dump_bool("needs_fixing", needs_fixing);
bool needs_fixing;
string status;
- int ret = store->fix_tail_obj_locator(bucket_info, key, fix, &needs_fixing);
+ int ret = store->fix_tail_obj_locator(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);
+ ret = list_op.list_objects(max_entries - count, &result, &common_prefixes, &truncated, null_yield);
if (ret < 0) {
cerr << "ERROR: store->list_objects(): " << cpp_strerror(-ret) << std::endl;
return -ret;
}
break;
case OPT_USER_RM:
- ret = user.remove(user_op, &err_msg);
+ ret = user.remove(user_op, null_yield, &err_msg);
if (ret < 0) {
cerr << "could not remove user: " << err_msg << std::endl;
return -ret;
list_op.params.allow_unordered = bool(allow_unordered);
do {
- ret = list_op.list_objects(max_entries - count, &result, &common_prefixes, &truncated);
+ ret = list_op.list_objects(max_entries - count, &result, &common_prefixes, &truncated, null_yield);
if (ret < 0) {
cerr << "ERROR: store->list_objects(): " << cpp_strerror(-ret) << std::endl;
return -ret;
RGWObjState *state;
- ret = store->get_obj_state(&rctx, bucket_info, obj, &state, false); /* don't follow olh */
+ ret = store->get_obj_state(&rctx, bucket_info, obj, &state, false, null_yield); /* don't follow olh */
if (ret < 0) {
return -ret;
}
store->cls_bucket_list_ordered(bucket_info, RGW_NO_SHARD, marker,
prefix, 1000, true,
result, &is_truncated, &marker,
+ null_yield,
bucket_object_check_filter);
if (r < 0 && r != -ENOENT) {
read_op.params.attrs = &attrs;
read_op.params.obj_size = &obj_size;
- ret = read_op.prepare();
+ ret = read_op.prepare(null_yield);
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);
} else {
- RGWBucketAdminOp::check_index(store, bucket_op, f);
+ RGWBucketAdminOp::check_index(store, bucket_op, f, null_yield);
}
}
if (opt_cmd == OPT_BUCKET_RM) {
if (!inconsistent_index) {
- RGWBucketAdminOp::remove_bucket(store, bucket_op, bypass_gc, true);
+ RGWBucketAdminOp::remove_bucket(store, bucket_op, null_yield, 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, bypass_gc, false);
+ RGWBucketAdminOp::remove_bucket(store, bucket_op, null_yield, bypass_gc, false);
}
}
return store->delete_obj(rctx, bucket_info, obj, bucket_info.versioning_status());
}
-int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children)
+int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children, optional_yield y)
{
int ret;
map<RGWObjCategory, RGWStorageStats> stats;
do {
objs.clear();
- ret = list_op.list_objects(max, &objs, &common_prefixes, &is_truncated);
+ ret = list_op.list_objects(max, &objs, &common_prefixes, &is_truncated, null_yield);
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->delete_bucket(info, objv_tracker, !delete_children);
+ ret = store->delete_bucket(info, objv_tracker, null_yield, !delete_children);
if (ret < 0) {
lderr(store->ctx()) << "ERROR: could not remove bucket " <<
bucket.name << dendl;
}
int rgw_remove_bucket_bypass_gc(RGWRados *store, rgw_bucket& bucket,
- int concurrent_max, bool keep_index_consistent)
+ int concurrent_max, bool keep_index_consistent,
+ optional_yield y)
{
int ret;
map<RGWObjCategory, RGWStorageStats> stats;
while (is_truncated) {
objs.clear();
- ret = list_op.list_objects(max, &objs, &common_prefixes, &is_truncated);
+ ret = list_op.list_objects(max, &objs, &common_prefixes, &is_truncated, null_yield);
if (ret < 0)
return ret;
RGWObjState *astate = NULL;
rgw_obj obj(bucket, (*it).key);
- ret = store->get_obj_state(&obj_ctx, info, obj, &astate, false);
+ ret = store->get_obj_state(&obj_ctx, info, obj, &astate, false, y);
if (ret == -ENOENT) {
dout(1) << "WARNING: cannot find obj state for obj " << obj.get_oid() << dendl;
continue;
// 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->delete_bucket(info, objv_tracker, false);
+ ret = store->delete_bucket(info, objv_tracker, y, false);
if (ret < 0) {
lderr(store->ctx()) << "ERROR: could not remove bucket " << bucket.name << dendl;
return ret;
return r;
}
-int RGWBucket::remove(RGWBucketAdminOpState& op_state, bool bypass_gc,
+int RGWBucket::remove(RGWBucketAdminOpState& op_state, optional_yield y, bool bypass_gc,
bool keep_index_consistent, std::string *err_msg)
{
bool delete_children = op_state.will_delete_children();
if (bypass_gc) {
if (delete_children) {
- ret = rgw_remove_bucket_bypass_gc(store, bucket, op_state.get_max_aio(), keep_index_consistent);
+ ret = rgw_remove_bucket_bypass_gc(store, bucket, op_state.get_max_aio(), keep_index_consistent, y);
} else {
set_err_msg(err_msg, "purge objects should be set for gc to be bypassed");
return -EINVAL;
}
} else {
- ret = rgw_remove_bucket(store, bucket, delete_children);
+ ret = rgw_remove_bucket(store, bucket, delete_children, y);
}
if (ret < 0) {
do {
vector<rgw_bucket_dir_entry> result;
- int r = list_op.list_objects(max, &result, &common_prefixes, &is_truncated);
+ int r = list_op.list_objects(max, &result, &common_prefixes, &is_truncated, null_yield);
if (r < 0) {
set_err_msg(err_msg, "failed to list objects in bucket=" + bucket.name +
" err=" + cpp_strerror(-r));
int RGWBucket::check_object_index(RGWBucketAdminOpState& op_state,
RGWFormatterFlusher& flusher,
+ optional_yield y,
std::string *err_msg)
{
int r = store->cls_bucket_list_ordered(bucket_info, RGW_NO_SHARD,
marker, prefix, 1000, true,
result, &is_truncated, &marker,
+ y,
bucket_object_check_filter);
if (r == -ENOENT) {
break;
int rgw_object_get_attr(RGWRados* store, const RGWBucketInfo& bucket_info,
const rgw_obj& obj, const char* attr_name,
- bufferlist& out_bl)
+ bufferlist& out_bl, optional_yield y)
{
RGWObjectCtx obj_ctx(store);
RGWRados::Object op_target(store, bucket_info, obj_ctx, obj);
RGWRados::Object::Read rop(&op_target);
- return rop.get_attr(attr_name, out_bl);
+ return rop.get_attr(attr_name, out_bl, y);
}
-int RGWBucket::get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolicy& policy)
+int RGWBucket::get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolicy& policy, optional_yield y)
{
std::string object_name = op_state.get_object_name();
rgw_bucket bucket = op_state.get_bucket();
bufferlist bl;
rgw_obj obj(bucket, object_name);
- ret = rgw_object_get_attr(store, bucket_info, obj, RGW_ATTR_ACL, bl);
+ ret = rgw_object_get_attr(store, bucket_info, obj, RGW_ATTR_ACL, bl, y);
if (ret < 0){
return ret;
}
if (ret < 0)
return ret;
- ret = bucket.get_policy(op_state, policy);
+ ret = bucket.get_policy(op_state, policy, null_yield);
if (ret < 0)
return ret;
}
int RGWBucketAdminOp::check_index(RGWRados *store, RGWBucketAdminOpState& op_state,
- RGWFormatterFlusher& flusher)
+ RGWFormatterFlusher& flusher, optional_yield y)
{
int ret;
map<RGWObjCategory, RGWStorageStats> existing_stats;
if (ret < 0)
return ret;
- ret = bucket.check_object_index(op_state, flusher);
+ ret = bucket.check_object_index(op_state, flusher, y);
if (ret < 0)
return ret;
}
int RGWBucketAdminOp::remove_bucket(RGWRados *store, RGWBucketAdminOpState& op_state,
- bool bypass_gc, bool keep_index_consistent)
+ optional_yield y, bool bypass_gc, bool keep_index_consistent)
{
RGWBucket bucket;
return ret;
std::string err_msg;
- ret = bucket.remove(op_state, bypass_gc, keep_index_consistent, &err_msg);
+ ret = bucket.remove(op_state, y, bypass_gc, keep_index_consistent, &err_msg);
if (!err_msg.empty()) {
lderr(store->ctx()) << "ERROR: " << err_msg << dendl;
}
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);
+ int ret = rgw_object_get_attr(store, bucket_info, obj, RGW_ATTR_DELETE_AT, delete_at_bl, null_yield);
if (ret < 0) {
return false; // no delete at attr, proceed
}
do {
std::vector<rgw_bucket_dir_entry> objs;
- int ret = list_op.list_objects(max_objects, &objs, nullptr, &is_truncated);
+ int ret = list_op.list_objects(max_objects, &objs, nullptr, &is_truncated, null_yield);
if (ret < 0) {
lderr(store->ctx()) << "ERROR failed to list objects in the bucket" << dendl;
return ret;
const string& tenant_name, const string& bucket_name, bool update_entrypoint = true);
extern int rgw_remove_object(RGWRados *store, const RGWBucketInfo& bucket_info, const rgw_bucket& bucket, rgw_obj_key& key);
-extern int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children);
-extern int rgw_remove_bucket_bypass_gc(RGWRados *store, rgw_bucket& bucket, int concurrent_max);
+extern int rgw_remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children, optional_yield y);
+extern int rgw_remove_bucket_bypass_gc(RGWRados *store, rgw_bucket& bucket, int concurrent_max, optional_yield y);
extern int rgw_bucket_set_attrs(RGWRados *store, RGWBucketInfo& bucket_info,
map<string, bufferlist>& attrs,
RGWObjVersionTracker *objv_tracker);
extern int rgw_object_get_attr(RGWRados* store, const RGWBucketInfo& bucket_info,
const rgw_obj& obj, const char* attr_name,
- bufferlist& out_bl);
+ bufferlist& out_bl, optional_yield y);
extern void check_bad_user_bucket_mapping(RGWRados *store, const rgw_user& user_id, bool fix);
int check_object_index(RGWBucketAdminOpState& op_state,
RGWFormatterFlusher& flusher,
+ optional_yield y,
std::string *err_msg = NULL);
int check_index(RGWBucketAdminOpState& op_state,
map<RGWObjCategory, RGWStorageStats>& calculated_stats,
std::string *err_msg = NULL);
- int remove(RGWBucketAdminOpState& op_state, bool bypass_gc = false, bool keep_index_consistent = true, std::string *err_msg = NULL);
+ int remove(RGWBucketAdminOpState& op_state, optional_yield y, bool bypass_gc = false, bool keep_index_consistent = true, std::string *err_msg = NULL);
int link(RGWBucketAdminOpState& op_state, std::string *err_msg = NULL);
int unlink(RGWBucketAdminOpState& op_state, std::string *err_msg = NULL);
int set_quota(RGWBucketAdminOpState& op_state, std::string *err_msg = NULL);
int remove_object(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);
+ int get_policy(RGWBucketAdminOpState& op_state, RGWAccessControlPolicy& policy, optional_yield y);
void clear_failure() { failure = false; }
static int link(RGWRados *store, RGWBucketAdminOpState& op_state, string *err_msg = NULL);
static int check_index(RGWRados *store, RGWBucketAdminOpState& op_state,
- RGWFormatterFlusher& flusher);
+ RGWFormatterFlusher& flusher, optional_yield y);
- static int remove_bucket(RGWRados *store, RGWBucketAdminOpState& op_state, bool bypass_gc = false, bool keep_index_consistent = true);
+ static int remove_bucket(RGWRados *store, RGWBucketAdminOpState& op_state, optional_yield y, bool bypass_gc = false, bool keep_index_consistent = true);
static int remove_object(RGWRados *store, RGWBucketAdminOpState& op_state);
static int info(RGWRados *store, RGWBucketAdminOpState& op_state, RGWFormatterFlusher& flusher);
static int limit_check(RGWRados *store, RGWBucketAdminOpState& op_state,
RGWObjState *state;
- int ret = store->get_obj_state(&obj_ctx, bucket_info, obj, &state);
+ int ret = store->get_obj_state(&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;
rgw_raw_obj raw_obj;
store->obj_to_raw(bucket_info.placement_rule, obj, &raw_obj);
return store->raw_obj_stat(raw_obj, psize, pmtime, pepoch,
- nullptr, nullptr, objv_tracker);
+ nullptr, nullptr, objv_tracker, null_yield);
}
RGWStatObjCR::RGWStatObjCR(RGWAsyncRadosProcessor *async_rados, RGWRados *store,
*static_cast<RGWObjectCtx *>(s->obj_ctx),
obj, olh_epoch, s->req_id, this, s->yield);
- op_ret = processor->prepare();
+ op_ret = processor->prepare(s->yield);
if (op_ret < 0) {
ldout(s->cct, 20) << "processor->prepare() returned ret=" << op_ret
<< dendl;
RGWRados::Object::Read read_op(&op_target);
map<string, bufferlist> attrs;
read_op.params.attrs = &attrs;
- int ret = read_op.prepare();
+ int ret = read_op.prepare(null_yield);
if (ret < 0) {
if (ret == -ENOENT) {
return true;
do {
objs.clear();
list_op.params.marker = list_op.get_next_marker();
- ret = list_op.list_objects(1000, &objs, NULL, &is_truncated);
+ ret = list_op.list_objects(1000, &objs, NULL, &is_truncated, null_yield);
if (ret < 0) {
if (ret == (-ENOENT))
return 0;
RGWRados::Object op_target(store, bucket_info, ctx, obj);
RGWRados::Object::Read read_op(&op_target);
- return read_op.get_attr(RGW_ATTR_TAGS, tags_bl);
+ return read_op.get_attr(RGW_ATTR_TAGS, tags_bl, null_yield);
}
static bool is_valid_op(const lc_op& op)
}
int fetch() {
- int ret = list_op.list_objects(1000, &objs, NULL, &is_truncated);
+ int ret = list_op.list_objects(1000, &objs, NULL, &is_truncated, null_yield);
if (ret < 0) {
return ret;
}
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));
+ return(list_op.list_objects(max_uploads, objs, common_prefixes, is_truncated, null_yield));
}
int abort_bucket_multiparts(RGWRados *store, CephContext *cct, RGWBucketInfo& bucket_info,
map<string, bufferlist>& bucket_attrs,
RGWAccessControlPolicy *policy,
string *storage_class,
- rgw_obj& obj)
+ rgw_obj& obj,
+ optional_yield y)
{
bufferlist bl;
int ret = 0;
RGWRados::Object op_target(store, bucket_info, obj_ctx, obj);
RGWRados::Object::Read rop(&op_target);
- ret = rop.get_attr(RGW_ATTR_ACL, bl);
+ ret = rop.get_attr(RGW_ATTR_ACL, bl, null_yield);
if (ret >= 0) {
ret = decode_policy(cct, bl, policy);
if (ret < 0)
if (storage_class) {
bufferlist scbl;
- int r = rop.get_attr(RGW_ATTR_STORAGE_CLASS, scbl);
+ int r = rop.get_attr(RGW_ATTR_STORAGE_CLASS, scbl, y);
if (r >= 0) {
*storage_class = scbl.to_str();
} else {
read_op.params.attrs = &attrs;
- return read_op.prepare();
+ return read_op.prepare(s->yield);
}
static int get_obj_head(RGWRados *store, struct req_state *s,
read_op.params.attrs = attrs;
- int ret = read_op.prepare();
+ int ret = read_op.prepare(s->yield);
if (ret < 0) {
return ret;
}
return 0;
}
- ret = read_op.read(0, s->cct->_conf->rgw_max_chunk_size, *pbl);
+ ret = read_op.read(0, s->cct->_conf->rgw_max_chunk_size, *pbl, s->yield);
return 0;
}
read_op.params.attrs = &attrs;
- int r = read_op.prepare();
+ int r = read_op.prepare(s->yield);
if (r < 0) {
return r;
}
RGWObjectCtx *obj_ctx = static_cast<RGWObjectCtx *>(s->obj_ctx);
int ret = get_obj_policy_from_attr(s->cct, store, *obj_ctx,
- bucket_info, bucket_attrs, acl, storage_class, obj);
+ bucket_info, bucket_attrs, acl, storage_class, obj, s->yield);
if (ret == -ENOENT) {
/* object does not exist checking the bucket's ACL to make sure
that we send a proper error code */
read_op.params.attrs = &attrs;
read_op.params.obj_size = &obj_size;
- op_ret = read_op.prepare();
+ op_ret = read_op.prepare(s->yield);
if (op_ret < 0)
return op_ret;
op_ret = read_op.range_to_ofs(ent.meta.accounted_size, cur_ofs, cur_end);
MD5 etag_sum;
do {
#define MAX_LIST_OBJS 100
- int r = list_op.list_objects(MAX_LIST_OBJS, &objs, NULL, &is_truncated);
+ int r = list_op.list_objects(MAX_LIST_OBJS, &objs, NULL, &is_truncated, null_yield);
if (r < 0) {
return r;
}
/* garbage collection related handling */
utime_t start_time = ceph_clock_now();
if (start_time > gc_invalidate_time) {
- int r = store->defer_gc(s->obj_ctx, s->bucket_info, obj);
+ int r = store->defer_gc(s->obj_ctx, s->bucket_info, obj, s->yield);
if (r < 0) {
ldpp_dout(this, 0) << "WARNING: could not defer gc entry for obj" << dendl;
}
read_op.params.lastmod = &lastmod;
read_op.params.obj_size = &s->obj_size;
- op_ret = read_op.prepare();
+ op_ret = read_op.prepare(s->yield);
if (op_ret < 0)
goto done_err;
version_id = read_op.state.obj.key.instance;
list_op.params.list_versions = list_versions;
list_op.params.allow_unordered = allow_unordered;
- op_ret = list_op.list_objects(max, &objs, &common_prefixes, &is_truncated);
+ op_ret = list_op.list_objects(max, &objs, &common_prefixes, &is_truncated, s->yield);
if (op_ret >= 0) {
next_marker = list_op.get_next_marker();
}
ldpp_dout(this, 1) << "WARNING: failed to sync user stats before bucket delete: op_ret= " << op_ret << dendl;
}
- op_ret = store->check_bucket_empty(s->bucket_info);
+ op_ret = store->check_bucket_empty(s->bucket_info, s->yield);
if (op_ret < 0) {
return;
}
return;
}
- op_ret = store->delete_bucket(s->bucket_info, ot, false);
+ op_ret = store->delete_bucket(s->bucket_info, ot, s->yield, false);
if (op_ret == -ECANCELED) {
// lost a race, either with mdlog sync or another delete bucket operation.
read_op.params.obj_size = &obj_size;
read_op.params.attrs = &attrs;
- ret = read_op.prepare();
+ ret = read_op.prepare(s->yield);
if (ret < 0)
return ret;
s->bucket_owner.get_id(),
s->bucket_info,
obj,
- this);
+ this,
+ s->yield);
if (op_ret < 0) {
return;
}
s->req_id, this, s->yield);
}
- op_ret = processor->prepare();
+ op_ret = processor->prepare(s->yield);
if (op_ret < 0) {
ldpp_dout(this, 20) << "processor->prepare() returned ret=" << op_ret
<< dendl;
RGWObjState *astate;
op_ret = store->get_obj_state(&obj_ctx, copy_source_bucket_info, obj,
- &astate, true, false);
+ &astate, true, s->yield, false);
if (op_ret < 0) {
ldpp_dout(this, 0) << "ERROR: get copy source obj state returned with error" << op_ret << dendl;
return;
s->bucket_owner.get_id(),
*static_cast<RGWObjectCtx*>(s->obj_ctx),
obj, 0, s->req_id, this, s->yield);
- op_ret = processor.prepare();
+ op_ret = processor.prepare(s->yield);
if (op_ret < 0) {
return;
}
dest_bucket_info.owner,
dest_bucket_info,
dst_obj,
- this);
+ this,
+ s->yield);
if (op_ret < 0) {
return;
}
RGWObjVersionTracker ot;
ot.read_version = binfo.ep_objv;
- ret = store->delete_bucket(binfo, ot);
+ ret = store->delete_bucket(binfo, ot, s->yield);
if (0 == ret) {
ret = rgw_unlink_bucket(store, binfo.owner, binfo.bucket.tenant,
binfo.bucket.name, false);
AtomicObjectProcessor processor(&*aio, store, binfo, &s->dest_placement, bowner.get_id(),
obj_ctx, obj, 0, s->req_id, this, s->yield);
- op_ret = processor.prepare();
+ op_ret = processor.prepare(s->yield);
if (op_ret < 0) {
ldpp_dout(this, 20) << "cannot prepare processor due to ret=" << op_ret << dendl;
return op_ret;
rgw_obj(s->bucket, s->object));
RGWRados::Object::Read stat_op(&target);
- op_ret = stat_op.prepare();
+ op_ret = stat_op.prepare(s->yield);
if (op_ret < 0) {
return;
}
head_obj = stat_op.state.head_obj;
- op_ret = target.get_manifest(&manifest);
+ op_ret = target.get_manifest(&manifest, s->yield);
}
vector<rgw_bucket_dir_entry> result;
ret = list_op.list_objects(max_list_bucket_entries,
- &result, nullptr, &truncated);
+ &result, nullptr, &truncated, null_yield);
if (ret < 0) {
cerr << "ERROR: store->list_objects(): " << cpp_strerror(-ret) << std::endl;
return -ret;
std::vector<rgw_bucket_dir_entry> objs;
- ret = list_op.list_objects(max_events, &objs, nullptr, &list.is_truncated);
+ ret = list_op.list_objects(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;
return 0;
}
-int AtomicObjectProcessor::prepare()
+int AtomicObjectProcessor::prepare(optional_yield y)
{
uint64_t max_head_chunk_size;
uint64_t head_max_size;
return 0;
}
-int MultipartObjectProcessor::prepare()
+int MultipartObjectProcessor::prepare(optional_yield y)
{
manifest.set_prefix(target_obj.key.name + "." + upload_id);
return 0;
}
-int AppendObjectProcessor::prepare()
+int AppendObjectProcessor::prepare(optional_yield y)
{
RGWObjState *astate;
- int r = store->get_obj_state(&obj_ctx, bucket_info, head_obj, &astate);
+ int r = store->get_obj_state(&obj_ctx, bucket_info, head_obj, &astate, y);
if (r < 0) {
return r;
}
class ObjectProcessor : public DataProcessor {
public:
// prepare to start processing object data
- virtual int prepare() = 0;
+ virtual int prepare(optional_yield y) = 0;
// complete the operation and make its result visible to clients
virtual int complete(size_t accounted_size, const std::string& etag,
{}
// prepare a trivial manifest
- int prepare() override;
+ int prepare(optional_yield y) override;
// write the head object atomically in a bucket index transaction
int complete(size_t accounted_size, const std::string& etag,
ceph::real_time *mtime, ceph::real_time set_mtime,
{}
// prepare a multipart manifest
- int prepare() override;
+ int prepare(optional_yield y) override;
// write the head object attributes in a bucket index transaction, then
// register the completed part with the multipart meta object
int complete(size_t accounted_size, const std::string& etag,
position(position), cur_size(0), cur_accounted_size(cur_accounted_size),
unique_tag(unique_tag), cur_manifest(nullptr)
{}
- int prepare() override;
+ int prepare(optional_yield y) override;
int complete(size_t accounted_size, const string& etag,
ceph::real_time *mtime, ceph::real_time set_mtime,
map<string, bufferlist>& attrs, ceph::real_time delete_at,
int64_t max,
vector<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
- bool *is_truncated)
+ bool *is_truncated,
+ optional_yield y)
{
RGWRados *store = target->get_store();
CephContext *cct = store->ctx();
params.list_versions,
ent_map,
&truncated,
- &cur_marker);
+ &cur_marker,
+ y);
if (r < 0)
return r;
int RGWRados::Bucket::List::list_objects_unordered(int64_t max,
vector<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
- bool *is_truncated)
+ bool *is_truncated,
+ optional_yield y)
{
RGWRados *store = target->get_store();
CephContext *cct = store->ctx();
params.list_versions,
ent_list,
&truncated,
- &cur_marker);
+ &cur_marker,
+ y);
if (r < 0)
return r;
* 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)
+int RGWRados::fix_tail_obj_locator(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);
- r = get_obj_state(&rctx, bucket_info, obj, &astate, false);
+ r = get_obj_state(&rctx, bucket_info, obj, &astate, false, y);
if (r < 0)
return r;
std::vector<rgw_bucket_dir_entry> entries(MAX_LIST_OBJS);
int ret = list_op.list_objects(MAX_LIST_OBJS, &entries, nullptr,
- &is_truncated);
+ &is_truncated, null_yield);
if (ret < 0) {
return ret;
} else if (!entries.empty()) {
const rgw_user& user,
RGWBucketInfo& bucket_info,
rgw_obj& obj,
- const DoutPrefixProvider *dpp)
+ const DoutPrefixProvider *dpp,
+ optional_yield y)
{
if (! swift_versioning_enabled(bucket_info)) {
return 0;
obj_ctx.set_atomic(obj);
RGWObjState * state = nullptr;
- int r = get_obj_state(&obj_ctx, bucket_info, obj, &state, false);
+ int r = get_obj_state(&obj_ctx, bucket_info, obj, &state, false, y);
if (r < 0) {
return r;
}
#endif
RGWObjState *state;
- int r = target->get_state(&state, false, assume_noent);
+ int r = target->get_state(&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);
+ r = target->prepare_atomic_modification(op, reset_obj, ptag, meta.if_match, meta.if_nomatch, false, modify_tail, y);
if (r < 0)
return r;
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, meta.zones_trace);
+ r = store->set_olh(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;
}
read_op.params.lastmod = &mtime;
read_op.params.obj_size = &obj_size;
- int ret = read_op.prepare();
+ int ret = read_op.prepare(y);
if (ret < 0)
return ret;
}
}
- int ret = processor.prepare();
+ int ret = processor.prepare(null_yield);
if (ret < 0) {
return ret;
}
if (copy_if_newer) {
/* need to get mtime for destination */
- ret = get_obj_state(&obj_ctx, dest_bucket_info, dest_obj, &dest_state, false);
+ ret = get_obj_state(&obj_ctx, dest_bucket_info, dest_obj, &dest_state, false, null_yield);
if (ret < 0)
goto set_err_state;
if (copy_if_newer && canceled) {
ldout(cct, 20) << "raced with another write of obj: " << dest_obj << dendl;
obj_ctx.invalidate(dest_obj); /* object was overwritten */
- ret = get_obj_state(&obj_ctx, dest_bucket_info, dest_obj, &dest_state, false);
+ ret = get_obj_state(&obj_ctx, dest_bucket_info, dest_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;
if (olh_epoch && *olh_epoch > 0) {
constexpr bool log_data_change = true;
ret = set_olh(obj_ctx, dest_bucket_info, dest_obj, false, nullptr,
- *olh_epoch, real_time(), false, zones_trace, log_data_change);
+ *olh_epoch, real_time(), false, null_yield, zones_trace, log_data_change);
} else {
// we already have the latest copy
ret = 0;
read_op.params.lastmod = src_mtime;
read_op.params.obj_size = &obj_size;
- ret = read_op.prepare();
+ ret = read_op.prepare(y);
if (ret < 0) {
return ret;
}
RGWObjManifest manifest;
RGWObjState *astate = NULL;
- ret = get_obj_state(&obj_ctx, src_bucket_info, src_obj, &astate);
+ ret = get_obj_state(&obj_ctx, src_bucket_info, src_obj, &astate, y);
if (ret < 0) {
return ret;
}
}
if (copy_first) {
- ret = read_op.read(0, max_chunk_size, first_chunk);
+ ret = read_op.read(0, max_chunk_size, first_chunk, y);
if (ret < 0) {
goto done_ret;
}
AtomicObjectProcessor processor(&aio, this, dest_bucket_info, &dest_placement,
dest_bucket_info.owner, obj_ctx,
dest_obj, olh_epoch, tag, dpp, y);
- int ret = processor.prepare();
+ int ret = processor.prepare(y);
if (ret < 0)
return ret;
do {
bufferlist bl;
- ret = read_op.read(ofs, end, bl);
+ ret = read_op.read(ofs, end, bl, y);
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();
+ int ret = read_op.prepare(y);
if (ret < 0) {
return ret;
}
return 0;
}
-int RGWRados::check_bucket_empty(RGWBucketInfo& bucket_info)
+int RGWRados::check_bucket_empty(RGWBucketInfo& bucket_info, optional_yield y)
{
std::vector<rgw_bucket_dir_entry> ent_list;
rgw_obj_index_key marker;
true,
ent_list,
&is_truncated,
- &marker);
+ &marker,
+ y);
if (r < 0)
return r;
* bucket: the name of the bucket to delete
* Returns 0 on success, -ERR# otherwise.
*/
-int RGWRados::delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& objv_tracker, bool check_empty)
+int RGWRados::delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& objv_tracker, optional_yield y, bool check_empty)
{
const rgw_bucket& bucket = bucket_info.bucket;
librados::IoCtx index_ctx;
return r;
if (check_empty) {
- r = check_bucket_empty(bucket_info);
+ r = check_bucket_empty(bucket_info, y);
if (r < 0) {
return r;
}
return CLSRGWIssueSetBucketResharding(index_ctx, bucket_objs, entry, cct->_conf->rgw_bucket_index_max_aio)();
}
-int RGWRados::defer_gc(void *ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj)
+int RGWRados::defer_gc(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);
+ int r = get_obj_state(rctx, bucket_info, obj, &state, false, y);
if (r < 0)
return r;
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, params.zones_trace);
+ 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);
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, params.zones_trace);
+ r = store->unlink_obj_instance(target->get_ctx(), target->get_bucket_info(), obj, params.olh_epoch, y, params.zones_trace);
if (r < 0) {
return r;
}
}
RGWObjState *state;
- r = target->get_state(&state, false);
+ r = target->get_state(&state, false, y);
if (r < 0)
return r;
return -ENOENT;
}
- r = target->prepare_atomic_modification(op, false, NULL, NULL, NULL, true, false);
+ r = target->prepare_atomic_modification(op, false, NULL, NULL, NULL, true, false, y);
if (r < 0)
return r;
}
int RGWRados::get_olh_target_state(RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
- RGWObjState *olh_state, RGWObjState **target_state)
+ RGWObjState *olh_state, RGWObjState **target_state, optional_yield y)
{
ceph_assert(olh_state->is_olh);
if (r < 0) {
return r;
}
- r = get_obj_state(&obj_ctx, bucket_info, target, target_state, false);
+ r = get_obj_state(&obj_ctx, bucket_info, target, target_state, false, y);
if (r < 0) {
return r;
}
}
int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
- RGWObjState **state, bool follow_olh, bool assume_noent)
+ RGWObjState **state, bool follow_olh, optional_yield y, bool assume_noent)
{
if (obj.empty()) {
return -EINVAL;
*state = s;
if (s->has_attrs) {
if (s->is_olh && need_follow_olh) {
- return get_olh_target_state(*rctx, bucket_info, obj, s, state);
+ return get_olh_target_state(*rctx, bucket_info, obj, s, state, y);
}
return 0;
}
int r = -ENOENT;
if (!assume_noent) {
- r = RGWRados::raw_obj_stat(raw_obj, &s->size, &s->mtime, &s->epoch, &s->attrset, (s->prefetch_data ? &s->data : NULL), NULL);
+ r = RGWRados::raw_obj_stat(raw_obj, &s->size, &s->mtime, &s->epoch, &s->attrset, (s->prefetch_data ? &s->data : NULL), NULL, y);
}
if (r == -ENOENT) {
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);
+ return get_olh_target_state(*rctx, bucket_info, obj, s, state, y);
} else if (obj.key.have_null_instance() && !s->has_manifest) {
// read null version, and the head object only have olh info
s->exists = false;
}
int RGWRados::get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state,
- bool follow_olh, bool assume_noent)
+ bool follow_olh, optional_yield y, bool assume_noent)
{
int ret;
do {
- ret = get_obj_state_impl(rctx, bucket_info, obj, state, follow_olh, assume_noent);
+ ret = get_obj_state_impl(rctx, bucket_info, obj, state, follow_olh, y, assume_noent);
} while (ret == -EAGAIN);
return ret;
}
-int RGWRados::Object::get_manifest(RGWObjManifest **pmanifest)
+int RGWRados::Object::get_manifest(RGWObjManifest **pmanifest, optional_yield y)
{
RGWObjState *astate;
- int r = get_state(&astate, true);
+ int r = get_state(&astate, true, y);
if (r < 0) {
return r;
}
return 0;
}
-int RGWRados::Object::Read::get_attr(const char *name, bufferlist& dest)
+int RGWRados::Object::Read::get_attr(const char *name, bufferlist& dest, optional_yield y)
{
RGWObjState *state;
- int r = source->get_state(&state, true);
+ int r = source->get_state(&state, true, y);
if (r < 0)
return r;
if (!state->exists)
int RGWRados::append_atomic_test(RGWObjectCtx *rctx,
const RGWBucketInfo& bucket_info, const rgw_obj& obj,
- ObjectOperation& op, RGWObjState **pstate)
+ ObjectOperation& op, RGWObjState **pstate, optional_yield y)
{
if (!rctx)
return 0;
- int r = get_obj_state(rctx, bucket_info, obj, pstate, false);
+ int r = get_obj_state(rctx, bucket_info, obj, pstate, false, y);
if (r < 0)
return r;
return 0;
}
-int RGWRados::Object::get_state(RGWObjState **pstate, bool follow_olh, bool assume_noent)
+int RGWRados::Object::get_state(RGWObjState **pstate, bool follow_olh, optional_yield y, bool assume_noent)
{
- return store->get_obj_state(&ctx, bucket_info, obj, pstate, follow_olh, assume_noent);
+ return store->get_obj_state(&ctx, bucket_info, obj, pstate, follow_olh, y, assume_noent);
}
void RGWRados::Object::invalidate_state()
int RGWRados::Object::prepare_atomic_modification(ObjectWriteOperation& op, bool reset_obj, const string *ptag,
const char *if_match, const char *if_nomatch, bool removal_op,
- bool modify_tail)
+ bool modify_tail, optional_yield y)
{
- int r = get_state(&state, false);
+ int r = get_state(&state, false, y);
if (r < 0)
return r;
ObjectWriteOperation op;
RGWObjState *state = NULL;
- r = append_atomic_test(rctx, bucket_info, obj, op, &state);
+ r = append_atomic_test(rctx, bucket_info, obj, op, &state, y);
if (r < 0)
return r;
return 0;
}
-int RGWRados::Object::Read::prepare()
+int RGWRados::Object::Read::prepare(optional_yield y)
{
RGWRados *store = source->get_store();
CephContext *cct = store->ctx();
map<string, bufferlist>::iterator iter;
RGWObjState *astate;
- int r = source->get_state(&astate, true);
+ int r = source->get_state(&astate, true, y);
if (r < 0)
return r;
}
}
if (conds.if_match || conds.if_nomatch) {
- r = get_attr(RGW_ATTR_ETAG, etag);
+ r = get_attr(RGW_ATTR_ETAG, etag, y);
if (r < 0)
return r;
return ret;
}
-int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl)
+int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y)
{
RGWRados *store = source->get_store();
CephContext *cct = store->ctx();
uint64_t max_chunk_size;
RGWObjState *astate;
- int r = source->get_state(&astate, true);
+ int r = source->get_state(&astate, true, y);
if (r < 0)
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);
+ r = store->append_atomic_test(&source->get_ctx(), source->get_bucket_info(), state.obj, op, &astate, y);
if (r < 0)
return r;
get_obj_data data(store, cb, &*aio, ofs, y);
int r = store->iterate_obj(obj_ctx, source->get_bucket_info(), state.obj,
- ofs, end, chunk_size, _get_obj_iterate_cb, &data);
+ ofs, end, chunk_size, _get_obj_iterate_cb, &data, y);
if (r < 0) {
ldout(cct, 0) << "iterate_obj() failed with " << r << dendl;
data.cancel(); // drain completions without writing back to client
int RGWRados::iterate_obj(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)
+ iterate_obj_cb cb, void *arg, optional_yield y)
{
rgw_raw_obj head_obj;
rgw_raw_obj read_obj;
obj_to_raw(bucket_info.placement_rule, obj, &head_obj);
- int r = get_obj_state(&obj_ctx, bucket_info, obj, &astate, false);
+ int r = get_obj_state(&obj_ctx, bucket_info, obj, &astate, false, y);
if (r < 0) {
return r;
}
int RGWRados::set_olh(RGWObjectCtx& obj_ctx, 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,
- rgw_zone_set *zones_trace, bool log_data_change)
+ optional_yield y, rgw_zone_set *zones_trace, bool log_data_change)
{
string op_tag;
obj_ctx.invalidate(olh_obj);
}
- ret = get_obj_state(&obj_ctx, bucket_info, olh_obj, &state, false); /* don't follow olh */
+ ret = get_obj_state(&obj_ctx, bucket_info, olh_obj, &state, false, y); /* don't follow olh */
if (ret < 0) {
return ret;
}
}
int RGWRados::unlink_obj_instance(RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj,
- uint64_t olh_epoch, rgw_zone_set *zones_trace)
+ 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); /* don't follow olh */
+ ret = get_obj_state(&obj_ctx, bucket_info, olh_obj, &state, false, y); /* don't follow olh */
if (ret < 0)
return ret;
int RGWRados::raw_obj_stat(rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *epoch,
map<string, bufferlist> *attrs, bufferlist *first_chunk,
- RGWObjVersionTracker *objv_tracker)
+ RGWObjVersionTracker *objv_tracker, optional_yield y)
{
rgw_rados_ref ref;
int r = get_raw_obj_ref(obj, &ref);
op.read(0, cct->_conf->rgw_max_chunk_size, first_chunk, NULL);
}
bufferlist outbl;
- r = ref.ioctx.operate(ref.obj.oid, &op, &outbl);
+
+ r = rgw_rados_operate(ref.ioctx, ref.obj.oid, &op, &outbl, y);
if (epoch) {
*epoch = ref.ioctx.get_last_version();
map<string, rgw_bucket_dir_entry>& m,
bool *is_truncated,
rgw_obj_index_key *last_entry,
+ optional_yield y,
bool (*force_check_filter)(const string& name))
{
ldout(cct, 10) << "cls_bucket_list_ordered " << bucket_info.bucket <<
librados::IoCtx sub_ctx;
sub_ctx.dup(index_ctx);
r = check_disk_state(sub_ctx, bucket_info, dirent, dirent,
- updates[vnames[pos]]);
+ updates[vnames[pos]], y);
if (r < 0 && r != -ENOENT) {
return r;
}
std::vector<rgw_bucket_dir_entry>& ent_list,
bool *is_truncated,
rgw_obj_index_key *last_entry,
+ optional_yield y,
bool (*force_check_filter)(const string& name)) {
ldout(cct, 10) << "cls_bucket_list_unordered " << bucket_info.bucket <<
" start " << start.name << "[" << start.instance <<
* and if the tags are old we need to do cleanup as well. */
librados::IoCtx sub_ctx;
sub_ctx.dup(index_ctx);
- r = check_disk_state(sub_ctx, bucket_info, dirent, dirent, updates[oid]);
+ r = check_disk_state(sub_ctx, bucket_info, dirent, dirent, updates[oid]
+ , null_yield);
if (r < 0 && r != -ENOENT) {
return r;
}
const RGWBucketInfo& bucket_info,
rgw_bucket_dir_entry& list_state,
rgw_bucket_dir_entry& object,
- bufferlist& suggested_updates)
+ bufferlist& suggested_updates,
+ optional_yield y)
{
const rgw_bucket& bucket = bucket_info.bucket;
uint8_t suggest_flag = (svc.zone->get_zone().log_data ? CEPH_RGW_DIR_SUGGEST_LOG_OP : 0);
RGWObjState *astate = NULL;
RGWObjectCtx rctx(this);
- int r = get_obj_state(&rctx, bucket_info, obj, &astate, false);
+ int r = get_obj_state(&rctx, bucket_info, obj, &astate, false, y);
if (r < 0)
return r;
uint64_t max_bucket_id;
int get_olh_target_state(RGWObjectCtx& rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
- RGWObjState *olh_state, RGWObjState **target_state);
+ 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,
- bool follow_olh, bool assume_noent = false);
+ bool follow_olh, optional_yield y, bool assume_noent = false);
int append_atomic_test(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj,
- librados::ObjectOperation& op, RGWObjState **state);
+ librados::ObjectOperation& op, RGWObjState **state, optional_yield y);
int append_atomic_test(const RGWObjState* astate, librados::ObjectOperation& op);
int update_placement_map();
bool bs_initialized;
protected:
- int get_state(RGWObjState **pstate, bool follow_olh, bool assume_noent = false);
+ int get_state(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,
- const char *ifmatch, const char *ifnomatch, bool removal_op, bool modify_tail);
+ const char *ifmatch, const char *ifnomatch, bool removal_op, bool modify_tail, optional_yield y);
int complete_atomic_modification();
public:
rgw_obj& get_obj() { return obj; }
RGWObjectCtx& get_ctx() { return ctx; }
RGWBucketInfo& get_bucket_info() { return bucket_info; }
- int get_manifest(RGWObjManifest **pmanifest);
+ int get_manifest(RGWObjManifest **pmanifest, optional_yield y);
int get_bucket_shard(BucketShard **pbs) {
if (!bs_initialized) {
explicit Read(RGWRados::Object *_source) : source(_source) {}
- int prepare();
+ int prepare(optional_yield y);
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);
+ 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);
+ int get_attr(const char *name, bufferlist& dest, optional_yield y);
};
struct Write {
int list_objects_ordered(int64_t max,
vector<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
- bool *is_truncated);
+ bool *is_truncated,
+ optional_yield y);
int list_objects_unordered(int64_t max,
vector<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
- bool *is_truncated);
+ bool *is_truncated,
+ optional_yield y);
public:
int list_objects(int64_t max,
vector<rgw_bucket_dir_entry> *result,
map<string, bool> *common_prefixes,
- bool *is_truncated) {
+ bool *is_truncated,
+ optional_yield y) {
if (params.allow_unordered) {
return list_objects_unordered(max, result, common_prefixes,
- is_truncated);
+ is_truncated, y);
} else {
return list_objects_ordered(max, result, common_prefixes,
- is_truncated);
+ is_truncated, y);
}
}
rgw_obj_key& get_next_marker() {
const rgw_user& user, /* in */
RGWBucketInfo& bucket_info, /* in */
rgw_obj& obj, /* in */
- const DoutPrefixProvider *dpp); /* in/out */
+ const DoutPrefixProvider *dpp, /* in/out */
+ optional_yield y); /* in */
int swift_versioning_restore(RGWSysObjectCtx& sysobj_ctx,
RGWObjectCtx& obj_ctx, /* in/out */
const rgw_user& user, /* in */
const DoutPrefixProvider *dpp,
optional_yield y);
- int check_bucket_empty(RGWBucketInfo& bucket_info);
+ int check_bucket_empty(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, bool check_empty = true);
+ int delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& objv_tracker, optional_yield y, bool check_empty = true);
void wakeup_meta_sync_shards(set<int>& shard_ids);
void wakeup_data_sync_shards(const string& source_zone, map<int, set<string> >& shard_ids);
optional_yield y);
int get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state,
- bool follow_olh, bool assume_noent = false);
- int get_obj_state(RGWObjectCtx *rctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, RGWObjState **state) {
- return get_obj_state(rctx, bucket_info, obj, state, true);
+ 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);
}
using iterate_obj_cb = int (*)(const rgw_raw_obj&, off_t, off_t,
int iterate_obj(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);
+ uint64_t max_chunk_size, iterate_obj_cb cb, void *arg,
+ optional_yield y);
int flush_read_list(struct get_obj_data *d);
int raw_obj_stat(rgw_raw_obj& obj, uint64_t *psize, ceph::real_time *pmtime, uint64_t *epoch,
map<string, bufferlist> *attrs, bufferlist *first_chunk,
- RGWObjVersionTracker *objv_tracker);
+ RGWObjVersionTracker *objv_tracker, 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 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, 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,
- rgw_zone_set *zones_trace = nullptr, bool log_data_change = false);
+ 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,
- uint64_t olh_epoch, rgw_zone_set *zones_trace = nullptr);
+ 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);
map<string, rgw_bucket_dir_entry>& m,
bool *is_truncated,
rgw_obj_index_key *last_entry,
+ optional_yield y,
bool (*force_check_filter)(const string& name) = nullptr);
int cls_bucket_list_unordered(RGWBucketInfo& bucket_info, int shard_id,
const rgw_obj_index_key& start,
uint32_t num_entries, bool list_versions,
vector<rgw_bucket_dir_entry>& ent_list,
bool *is_truncated, rgw_obj_index_key *last_entry,
+ optional_yield y,
bool (*force_check_filter)(const string& name) = nullptr);
int cls_bucket_head(const RGWBucketInfo& bucket_info, int shard_id, vector<rgw_bucket_dir_header>& headers, map<int, string> *bucket_instance_ids = NULL);
int cls_bucket_head_async(const RGWBucketInfo& bucket_info, int shard_id, RGWGetDirHeader_CB *ctx, int *num_aio);
int list_gc_objs(int *index, string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool *truncated);
int process_gc(bool expired_only);
bool process_expire_objects();
- int defer_gc(void *ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj);
+ int defer_gc(void *ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, optional_yield y);
int process_lc();
int list_lc_progress(const string& marker, uint32_t max_entries, map<string, int> *progress_map);
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);
+ int fix_tail_obj_locator(const RGWBucketInfo& bucket_info, rgw_obj_key& key, bool fix, bool *need_fix, optional_yield y);
int cls_user_get_header(const string& user_id, cls_user_header *header);
int cls_user_reset_stats(const string& user_id);
const RGWBucketInfo& bucket_info,
rgw_bucket_dir_entry& list_state,
rgw_bucket_dir_entry& object,
- bufferlist& suggested_updates);
+ bufferlist& suggested_updates,
+ optional_yield y);
/**
* Init pool iteration
op_state.set_fix_index(fix_index);
op_state.set_check_objects(check_objects);
- http_ret = RGWBucketAdminOp::check_index(store, op_state, flusher);
+ http_ret = RGWBucketAdminOp::check_index(store, op_state, flusher, s->yield);
}
class RGWOp_Bucket_Link : public RGWRESTOp {
op_state.set_bucket_name(bucket);
op_state.set_delete_children(delete_children);
- http_ret = RGWBucketAdminOp::remove_bucket(store, op_state);
+ http_ret = RGWBucketAdminOp::remove_bucket(store, op_state, s->yield);
}
class RGWOp_Set_Bucket_Quota : public RGWRESTOp {
read_op.params.attrs = &attrs;
- return read_op.prepare();
+ return read_op.prepare(s->yield);
}
static inline void set_attr(map<string, bufferlist>& attrs, const char* key, const std::string& value)
obj_ctx.set_prefetch_data(obj);
RGWObjState* state = nullptr;
- if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false) < 0) {
+ if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false, s->yield) < 0) {
return false;
}
if (! state->exists) {
read_op.params.attrs = &attrs;
read_op.params.obj_size = &size_bytes;
- r = read_op.prepare();
+ r = read_op.prepare(s->yield);
if (r < 0) {
return r;
}
obj_ctx.set_prefetch_data(obj);
RGWObjState* state = nullptr;
- if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false) < 0) {
+ if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false, s->yield) < 0) {
return false;
}
obj_ctx.set_prefetch_data(obj);
RGWObjState* state = nullptr;
- if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false) < 0) {
+ if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false, s->yield) < 0) {
return false;
}
op_state.set_purge_data(purge_data);
- http_ret = RGWUserAdminOp_User::remove(store, op_state, flusher);
+ http_ret = RGWUserAdminOp_User::remove(store, op_state, flusher, s->yield);
}
class RGWOp_Subuser_Create : public RGWRESTOp {
owner.get_id(), obj_ctx, obj, olh_epoch,
req_id, dpp, y);
- int ret = processor.prepare();
+ int ret = processor.prepare(y);
if (ret < 0)
return ret;
return 0;
}
-int RGWUser::execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg)
+int RGWUser::execute_remove(RGWUserAdminOpState& op_state, std::string *err_msg, optional_yield y)
{
int ret;
std::map<std::string, RGWBucketEnt>::iterator it;
for (it = m.begin(); it != m.end(); ++it) {
- ret = rgw_remove_bucket(store, ((*it).second).bucket, true);
+ ret = rgw_remove_bucket(store, ((*it).second).bucket, true, y);
if (ret < 0) {
set_err_msg(err_msg, "unable to delete user data");
return ret;
return 0;
}
-int RGWUser::remove(RGWUserAdminOpState& op_state, std::string *err_msg)
+int RGWUser::remove(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);
+ ret = execute_remove(op_state, &subprocess_msg, y);
if (ret < 0) {
set_err_msg(err_msg, "unable to remove user, " + subprocess_msg);
return ret;
}
int RGWUserAdminOp_User::remove(RGWRados *store, RGWUserAdminOpState& op_state,
- RGWFormatterFlusher& flusher)
+ RGWFormatterFlusher& flusher, optional_yield y)
{
RGWUserInfo info;
RGWUser user;
return ret;
- ret = user.remove(op_state, NULL);
+ ret = user.remove(op_state, y, NULL);
if (ret == -ENOENT)
ret = -ERR_NO_SUCH_USER;
/* API Contract Fulfillment */
int execute_add(RGWUserAdminOpState& op_state, std::string *err_msg);
- int execute_remove(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);
public:
/* API Contracted Methods */
int add(RGWUserAdminOpState& op_state, std::string *err_msg = NULL);
- int remove(RGWUserAdminOpState& op_state, std::string *err_msg = NULL);
+ int remove(RGWUserAdminOpState& op_state, optional_yield y, std::string *err_msg = NULL);
/* remove an already populated RGWUser */
int remove(std::string *err_msg = NULL);
RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher);
static int remove(RGWRados *store,
- RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher);
+ RGWUserAdminOpState& op_state, RGWFormatterFlusher& flusher, optional_yield y);
};
class RGWUserAdminOp_Subuser