From 87e8e89fe11fa805739a2b85d1b009424641fa4e Mon Sep 17 00:00:00 2001 From: Abhishek Lekshmanan Date: Thu, 31 Aug 2017 13:39:13 +0200 Subject: [PATCH] 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 --- src/rgw/rgw_rados.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- 2.47.3