From 8e37edb51619043f454f96642bcdf71d6a147d2c Mon Sep 17 00:00:00 2001 From: wanghao72 Date: Wed, 30 Jan 2019 15:18:06 +0800 Subject: [PATCH] rgw: bug in versioning concurrent, list and get have consistency issue Fixes: https://tracker.ceph.com/issues/38060 Signed-off-by: Wang Hao (cherry picked from commit cc2a96a47fd71dc8399e31f1a9e87d8a13ea3419) --- src/rgw/rgw_rados.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 8b1141eeff47..72591aa4ae45 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -11489,6 +11489,11 @@ int RGWRados::apply_olh_log(RGWObjectCtx& obj_ctx, RGWObjState& state, const RGW op.cmpxattr(RGW_ATTR_OLH_ID_TAG, CEPH_OSD_CMPXATTR_OP_EQ, olh_tag); op.cmpxattr(RGW_ATTR_OLH_VER, CEPH_OSD_CMPXATTR_OP_GT, last_ver); + bufferlist ver_bl; + string last_ver_s = to_string(last_ver); + ver_bl.append(last_ver_s.c_str(), last_ver_s.size()); + op.setxattr(RGW_ATTR_OLH_VER, ver_bl); + struct timespec mtime_ts = real_clock::to_timespec(state.mtime); op.mtime2(&mtime_ts); @@ -11580,7 +11585,7 @@ int RGWRados::apply_olh_log(RGWObjectCtx& obj_ctx, RGWObjState& state, const RGW ObjectWriteOperation rm_op; rm_op.cmpxattr(RGW_ATTR_OLH_ID_TAG, CEPH_OSD_CMPXATTR_OP_EQ, olh_tag); - rm_op.cmpxattr(RGW_ATTR_OLH_VER, CEPH_OSD_CMPXATTR_OP_GT, last_ver); + rm_op.cmpxattr(RGW_ATTR_OLH_VER, CEPH_OSD_CMPXATTR_OP_EQ, last_ver); cls_obj_check_prefix_exist(rm_op, RGW_ATTR_OLH_PENDING_PREFIX, true); /* fail if found one of these, pending modification */ rm_op.remove(); -- 2.47.3