From: lu.shasha Date: Tue, 10 Oct 2017 07:51:04 +0000 (+0800) Subject: rgw: don't change rados object's mtime when update olh X-Git-Tag: v12.2.3~210^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a88e48e7d9cba77db8cb5aeb9512733d62a08382;p=ceph.git rgw: don't change rados object's mtime when update olh null instance and olh share rados object. Null instance using the rados object mtime as its mtime. When olh updated, the rados object mtime will change. Thus the null instance will be incorrect. When list objects in bucket, the mtime is correct, down the null instance the last modified time is incorrect. So when update olh, using the previous mtime, thus the null instance mtime will be correct. Fixes: http://tracker.ceph.com/issues/21743 Signed-off-by: Shasha Lu (cherry picked from commit 3189edc28ea6d3c117c2e2f0664f45c69f67ab50) --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index a44fc01a8503..5f6b467ead8b 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -10804,6 +10804,8 @@ int RGWRados::olh_init_modification_impl(const RGWBucketInfo& bucket_info, RGWOb op.create(true); } else { op.assert_exists(); + struct timespec mtime_ts = real_clock::to_timespec(state.mtime); + op.mtime2(&mtime_ts); } /* @@ -11141,6 +11143,9 @@ 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); + struct timespec mtime_ts = real_clock::to_timespec(state.mtime); + op.mtime2(&mtime_ts); + bool need_to_link = false; cls_rgw_obj_key key; bool delete_marker = false;