From: wanghao72 Date: Wed, 30 Jan 2019 07:18:06 +0000 (+0800) Subject: rgw: bug in versioning concurrent, list and get have consistency issue X-Git-Tag: v13.2.6~114^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8e37edb51619043f454f96642bcdf71d6a147d2c;p=ceph.git 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) --- 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();