Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RGW: Multipart upload may double the quota #17959

Merged
merged 1 commit into from
Oct 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/rgw/rgw_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5522,6 +5522,7 @@ void RGWCompleteMultipart::execute()
obj_op.meta.owner = s->owner.get_id();
obj_op.meta.flags = PUT_OBJ_CREATE;
obj_op.meta.modify_tail = true;
obj_op.meta.completeMultipart = true;
op_ret = obj_op.write_meta(ofs, accounted_size, attrs);
if (op_ret < 0)
return;
Expand Down
10 changes: 8 additions & 2 deletions src/rgw/rgw_rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6972,8 +6972,14 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si
meta.canceled = false;

/* update quota cache */
store->quota_handler->update_stats(meta.owner, obj.bucket, (orig_exists ? 0 : 1),
accounted_size, orig_size);
if (meta.completeMultipart){
store->quota_handler->update_stats(meta.owner, obj.bucket, (orig_exists ? 0 : 1),
0, orig_size);
}
else {
store->quota_handler->update_stats(meta.owner, obj.bucket, (orig_exists ? 0 : 1),
accounted_size, orig_size);
}
return 0;

done_cancel:
Expand Down
3 changes: 2 additions & 1 deletion src/rgw/rgw_rados.h
Original file line number Diff line number Diff line change
Expand Up @@ -2815,11 +2815,12 @@ class RGWRados
const string *user_data;
rgw_zone_set *zones_trace;
bool modify_tail;
bool completeMultipart;

MetaParams() : mtime(NULL), rmattrs(NULL), data(NULL), manifest(NULL), ptag(NULL),
remove_objs(NULL), category(RGW_OBJ_CATEGORY_MAIN), flags(0),
if_match(NULL), if_nomatch(NULL), olh_epoch(0), canceled(false), user_data(nullptr), zones_trace(nullptr),
modify_tail(false) {}
modify_tail(false), completeMultipart(false) {}
} meta;

explicit Write(RGWRados::Object *_target) : target(_target) {}
Expand Down