Skip to content

Commit

Permalink
Merge pull request #28349 from smithfarm/wip-39177-luminous
Browse files Browse the repository at this point in the history
luminous: rgw: remove_olh_pending_entries() does not limit the number of xattrs to remove

Reviewed-by: Casey Bodley <cbodley@redhat.com>
  • Loading branch information
yuriw committed Jul 22, 2019
2 parents b776071 + ef703c6 commit cfe39a4
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions src/rgw/rgw_rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11942,31 +11942,34 @@ void RGWRados::check_pending_olh_entries(map<string, bufferlist>& pending_entrie

int RGWRados::remove_olh_pending_entries(const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& olh_obj, map<string, bufferlist>& pending_attrs)
{
ObjectWriteOperation op;

bucket_index_guard_olh_op(state, op);

for (map<string, bufferlist>::iterator iter = pending_attrs.begin(); iter != pending_attrs.end(); ++iter) {
op.rmxattr(iter->first.c_str());
}

rgw_rados_ref ref;
int r = get_obj_head_ref(bucket_info, olh_obj, &ref);
if (r < 0) {
return r;
}

/* update olh object */
r = ref.ioctx.operate(ref.oid, &op);
if (r == -ENOENT || r == -ECANCELED) {
/* raced with some other change, shouldn't sweat about it */
r = 0;
}
if (r < 0) {
ldout(cct, 0) << "ERROR: could not apply olh update, r=" << r << dendl;
return r;
}
// trim no more than 1000 entries per osd op
constexpr int max_entries = 1000;

auto i = pending_attrs.begin();
while (i != pending_attrs.end()) {
ObjectWriteOperation op;
bucket_index_guard_olh_op(state, op);

for (int n = 0; n < max_entries && i != pending_attrs.end(); ++n, ++i) {
op.rmxattr(i->first.c_str());
}

r = ref.ioctx.operate(ref.oid, &op);
if (r == -ENOENT || r == -ECANCELED) {
/* raced with some other change, shouldn't sweat about it */
return 0;
}
if (r < 0) {
ldout(cct, 0) << "ERROR: could not apply olh update, r=" << r << dendl;
return r;
}
}
return 0;
}

Expand Down

0 comments on commit cfe39a4

Please sign in to comment.