]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't change rados object's mtime when update olh 20262/head
authorlu.shasha <lu.shasha@eisoo.com>
Tue, 10 Oct 2017 07:51:04 +0000 (15:51 +0800)
committerNathan Cutler <ncutler@suse.com>
Fri, 2 Feb 2018 11:09:36 +0000 (12:09 +0100)
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 401955a3e647572c00ebbac039947d7be701cb77..c32138df3d3eeb676a154e86f42aa6c2e8a42113 100644 (file)
@@ -9827,6 +9827,8 @@ int RGWRados::olh_init_modification_impl(RGWObjState& state, rgw_obj& olh_obj, s
     op.create(true);
   } else {
     op.assert_exists();
+    struct timespec mtime_ts = real_clock::to_timespec(state.mtime);
+    op.mtime2(&mtime_ts);
   }
 
   /*
@@ -10097,6 +10099,9 @@ int RGWRados::apply_olh_log(RGWObjectCtx& obj_ctx, RGWObjState& state, RGWBucket
   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;