From: Matt Benjamin Date: Mon, 1 Feb 2016 20:16:46 +0000 (-0500) Subject: librgw: remove slo, dlo, and supplied-md5 logic in RGWWriteRequest X-Git-Tag: v10.1.0~382^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a293c529e6b019ebc869e072ded57331f7e2f7ca;p=ceph.git librgw: remove slo, dlo, and supplied-md5 logic in RGWWriteRequest Signed-off-by: Matt Benjamin --- diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index 24ffbd0a675e..9e1ce6808c9c 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -467,14 +467,15 @@ namespace rgw { int RGWWriteRequest::exec_start() { struct req_state* s = get_state(); - // XXX check this - need_calc_md5 = (dlo_manifest == NULL) && (slo_info == NULL); + /* not obviously supportable */ + assert(! dlo_manifest); + assert(! slo_info); perfcounter->inc(l_rgw_put); op_ret = -EINVAL; - // XXX check this if (s->object.empty()) { + ldout(s->cct, 0) << __func__ << " called on empty object" << dendl; goto done; } @@ -522,7 +523,8 @@ namespace rgw { } op_ret = put_data_and_throttle(processor, data, ofs, - (need_calc_md5 ? &hash : NULL), need_to_wait); + (true /* md5 */ ? &hash : NULL), + need_to_wait); if (op_ret < 0) { if (!need_to_wait || op_ret != -EEXIST) { ldout(s->cct, 20) << "processor->thottle_data() returned ret=" @@ -581,52 +583,15 @@ namespace rgw { goto done; } - if (need_calc_md5) { - processor->complete_hash(&hash); - } + processor->complete_hash(&hash); hash.Final(m); buf_to_hex(m, CEPH_CRYPTO_MD5_DIGESTSIZE, calc_md5); etag = calc_md5; -#if 0 /* XXX only in PostObj currently */ - if (supplied_md5_b64 && strcmp(calc_md5, supplied_md5)) { - op_ret = -ERR_BAD_DIGEST; - goto done; - } -#endif - policy.encode(aclbl); - attrs[RGW_ATTR_ACL] = aclbl; - /* XXX most of the following cases won't currently arise */ - if (unlikely(!! dlo_manifest)) { - op_ret = encode_dlo_manifest_attr(dlo_manifest, attrs); - if (op_ret < 0) { - ldout(s->cct, 0) << "bad user manifest: " << dlo_manifest << dendl; - goto done; - } - complete_etag(hash, &etag); - ldout(s->cct, 10) << __func__ << ": calculated md5 for user manifest: " - << etag << dendl; - } - - if (unlikely(!! slo_info)) { - bufferlist manifest_bl; - ::encode(*slo_info, manifest_bl); - attrs[RGW_ATTR_SLO_MANIFEST] = manifest_bl; - - hash.Update((byte *)slo_info->raw_data, slo_info->raw_data_len); - complete_etag(hash, &etag); - ldout(s->cct, 10) << __func__ << ": calculated md5 for user manifest: " - << etag << dendl; - } - - if (supplied_etag && etag.compare(supplied_etag) != 0) { - op_ret = -ERR_UNPROCESSABLE_ENTITY; - goto done; - } bl.append(etag.c_str(), etag.size() + 1); attrs[RGW_ATTR_ETAG] = bl; diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index 6b1209df9fa3..fe70fa717909 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -1739,7 +1739,6 @@ public: off_t next_off; size_t bytes_written; bool multipart; - bool need_calc_md5; RGWWriteRequest(CephContext* _cct, RGWUserInfo *_user, RGWFileHandle* _fh, const std::string& _bname, const std::string& _oname)