From: Abhishek Lekshmanan Date: Thu, 31 Aug 2017 11:39:13 +0000 (+0200) Subject: rgw: rgw_rados: set_attrs now sets the same time for BI & object X-Git-Tag: v13.0.1~962^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=87e8e89fe11fa805739a2b85d1b009424641fa4e;p=ceph.git rgw: rgw_rados: set_attrs now sets the same time for BI & object `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 --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 7d6732306bcc..31f493461f5e 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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);