Skip to content

Commit 3d0d30a

Browse files
rgw/storage class. Don't inherit storage class for copy object.
When an object is copied, it should only be depending on data in the request to determine the storage class, and if it is not specified, it should default to 'STANDARD'. In radosgw, this means that this is another attribute (similar to encryption) that should not be merged from the source object. Fixes: https://tracker.ceph.com/issues/67787 Signed-off-by: Marcus Watts <[email protected]>
1 parent 7276c30 commit 3d0d30a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/rgw/rgw_op.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5808,6 +5808,7 @@ class RGWCOE_make_filter_pipeline : public rgw::sal::ObjectFilter {
58085808
std::unique_ptr<RGWGetObj_Filter> cb;
58095809
std::map<std::string, ceph::buffer::list> src_attrs;
58105810
std::map<std::string, ceph::buffer::list> enc_attrs;
5811+
bufferlist requested_sc;
58115812
bool skip_decrypt;
58125813
DoutPrefixProvider *dpp;
58135814
boost::optional<RGWGetObj_Decompress> decompress;
@@ -5972,6 +5973,10 @@ ldpp_dout(dpp, 0) << "TEMP: end_x=" << end_x << " obj_size=" << obj_size << dend
59725973
// we need it to be just the requested settings
59735974
clear_encryption_attrs(attrs);
59745975
merge_attrs(enc_attrs, attrs); // request & bucket encryption defaults
5976+
attrs.erase(RGW_ATTR_STORAGE_CLASS); // do not inherit from source
5977+
if (requested_sc.length() > 0) {
5978+
attrs[RGW_ATTR_STORAGE_CLASS] = std::move(requested_sc);
5979+
}
59755980
attrs.erase(RGW_ATTR_COMPRESSION); // only true source: zone data
59765981
op_ret = get_encrypt_filter(&encrypt, filter);
59775982
if (op_ret < 0) {
@@ -6005,6 +6010,10 @@ ldpp_dout(dpp, 0) << "TEMP: end_x=" << end_x << " obj_size=" << obj_size << dend
60056010
void set_src_attrs(std::map<std::string, ceph::buffer::list> &_src) override {
60066011
src_attrs = filter_encryption_compression_attrs(_src, true);
60076012
enc_attrs = filter_encryption_compression_attrs(attrs, false);
6013+
auto iter = attrs.find(RGW_ATTR_STORAGE_CLASS);
6014+
if (iter != attrs.end()) {
6015+
requested_sc.append(iter->second);
6016+
}
60086017
};
60096018
bool need_copy_data() override {
60106019
return rgw_need_copy_data( src_attrs, s );

0 commit comments

Comments
 (0)