]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't change rados object's mtime when update olh 18870/head
authorlu.shasha <lu.shasha@eisoo.com>
Tue, 10 Oct 2017 07:51:04 +0000 (15:51 +0800)
committerShinobu Kinjo <shinobu@redhat.com>
Fri, 10 Nov 2017 07:18:15 +0000 (02:18 -0500)
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 <lu.shasha@eisoo.com>
(cherry picked from commit 3189edc28ea6d3c117c2e2f0664f45c69f67ab50)

src/rgw/rgw_rados.cc

index a44fc01a850342f51fa5064a7f556f6e7270d125..5f6b467ead8b6bae15701b8bf02df7bc1cd6de28 100644 (file)
@@ -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;