]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: rgw_rados: set_attrs now sets the same time for BI & object 17400/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Thu, 31 Aug 2017 11:39:13 +0000 (13:39 +0200)
committerAbhishek Lekshmanan <abhishek@suse.com>
Thu, 31 Aug 2017 11:49:14 +0000 (13:49 +0200)
`RGWRados::set_attrs()` used to set slightly different mtimes for the
object and in the bucket dir entry as we do an object write and set the
time at bucket index as the time at that point. Fix this by using the
setting the same mtime for the object as well.

Fixes: http://tracker.ceph.com/issues/21200
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
src/rgw/rgw_rados.cc

index 7d6732306bcc72cf2973a4e4568917ed3b992220..31f493461f5e01a2ad312d771e37f31246840041 100644 (file)
@@ -9709,6 +9709,10 @@ int RGWRados::set_attrs(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& ob
     op.setxattr(RGW_ATTR_ID_TAG,  bl);
   }
 
+
+  real_time mtime = real_clock::now();
+  struct timespec mtime_ts = real_clock::to_timespec(mtime);
+  op.mtime2(&mtime_ts);
   r = ref.ioctx.operate(ref.oid, &op);
   if (state) {
     if (r >= 0) {
@@ -9719,7 +9723,6 @@ int RGWRados::set_attrs(void *ctx, const RGWBucketInfo& bucket_info, rgw_obj& ob
       string content_type(content_type_bl.c_str(), content_type_bl.length());
       uint64_t epoch = ref.ioctx.get_last_version();
       int64_t poolid = ref.ioctx.get_id();
-      real_time mtime = real_clock::now();
       r = index_op.complete(poolid, epoch, state->size, state->accounted_size,
                             mtime, etag, content_type, &acl_bl,
                             RGW_OBJ_CATEGORY_MAIN, NULL);