From d0ee1c9bd893a682112a24d35f8cc35f0221627e Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 15 Jan 2019 19:30:14 -0800 Subject: [PATCH] rgw: RGWRadosPutObj() fix need_to_process_attrs handling Set need_to_process_attrs anyway, and not only if have extra_data. This can be triggered also in cases where we get error response, in which case there's no extra data. Make sure it's only getting called once. Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_rados.cc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 43bd8aa2307..a283a9efb5a 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -3828,7 +3828,7 @@ class RGWRadosPutObj : public RGWHTTPStreamRWRequest::ReceiveCB void *progress_data; bufferlist extra_data_bl; uint64_t extra_data_left{0}; - bool need_to_process_attrs{false}; + bool need_to_process_attrs{true}; uint64_t data_len{0}; map src_attrs; uint64_t ofs{0}; @@ -3881,6 +3881,8 @@ public: filter = &*buffering; } + need_to_process_attrs = false; + return 0; } @@ -3907,17 +3909,15 @@ public: if (bl.length() == 0) { return 0; } - } else if (need_to_process_attrs) { + } + if (need_to_process_attrs) { /* need to call process_attrs() even if we don't get any attrs, - * need it to call attrs_handler(). At the moment this - * will never happenas all callers will have extra_data_len > 0, but need - * to have it for sake of completeness. + * need it to call attrs_handler(). */ int res = process_attrs(); if (res < 0) { return res; } - need_to_process_attrs = false; } ceph_assert(uint64_t(ofs) >= extra_data_len); @@ -3941,9 +3941,6 @@ public: void set_extra_data_len(uint64_t len) override { extra_data_left = len; - if (len == 0) { - need_to_process_attrs = true; - } RGWHTTPStreamRWRequest::ReceiveCB::set_extra_data_len(len); } -- 2.47.3