From c3fcd832710fadff630ba1afebb3070ab5559bd3 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 24 Mar 2016 15:07:27 -0700 Subject: [PATCH] rgw: fetch_remote_obj() fix handling of ERR_NOT_MODIFIED got broken when disabled opstate Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_rados.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 16d451c2f634..448263be08a1 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -6571,11 +6571,15 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx, return 0; set_err_state: + if (copy_if_newer && ret == -ERR_NOT_MODIFIED) { + ret = 0; + } if (opstate) { - RGWOpState::OpState state = RGWOpState::OPSTATE_ERROR; - if (copy_if_newer && ret == -ERR_NOT_MODIFIED) { + RGWOpState::OpState state; + if (ret < 0) { + state = RGWOpState::OPSTATE_ERROR; + } else { state = RGWOpState::OPSTATE_COMPLETE; - ret = 0; } int r = opstate->set_state(state); if (r < 0) { -- 2.47.3