]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: object mtime the same for both object and bucket index
authorYehuda Sadeh <yehuda@inktank.com>
Tue, 18 Jun 2013 00:41:41 +0000 (17:41 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Tue, 18 Jun 2013 00:41:41 +0000 (17:41 -0700)
Make sure object mtime that's passed to bucket index is the
same as the one set on the object.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_rados.cc

index 1b3db4b2ccef55a66494ec76c52cfe38452ea490..e65f8831c99ef055d097add5e981ebcefc48afd3 100644 (file)
@@ -2004,8 +2004,13 @@ int RGWRados::put_obj_meta_impl(void *ctx, rgw_obj& obj,  uint64_t size,
     objv_tracker->prepare_op_for_write(&op);
   }
 
-  if (!set_mtime)
-    time(&set_mtime);
+  utime_t ut;
+  if (set_mtime) {
+    ut = utime_t(set_mtime, 0);
+  } else {
+    ut = ceph_clock_now(0);
+    set_mtime = ut.sec();
+  }
 
   op.mtime(&set_mtime);
 
@@ -2062,7 +2067,6 @@ int RGWRados::put_obj_meta_impl(void *ctx, rgw_obj& obj,  uint64_t size,
   string index_tag;
   uint64_t epoch;
   int64_t poolid;
-  utime_t ut;
 
   if (state) {
     index_tag = state->write_tag;
@@ -2088,7 +2092,6 @@ int RGWRados::put_obj_meta_impl(void *ctx, rgw_obj& obj,  uint64_t size,
     ldout(cct, 0) << "ERROR: complete_atomic_overwrite returned r=" << r << dendl;
   }
 
-  ut = ceph_clock_now(cct);
   r = complete_update_index(bucket, obj.object, index_tag, poolid, epoch, size,
                             ut, etag, content_type, &acl_bl, category, remove_objs);
   if (r < 0)