]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_file: pre-assign times 11181/head
authorMatt Benjamin <mbenjamin@redhat.com>
Wed, 21 Sep 2016 21:18:20 +0000 (17:18 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Thu, 22 Sep 2016 14:11:31 +0000 (10:11 -0400)
Set unix timestamps based on RGW values for creation, modification
time for buckets, objects in stat requests.  Regard any saved
value of these in unix attributes as an overlay.

Fixes: http://tracker.ceph.com/issues/17367
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_file.cc
src/rgw/rgw_file.h

index b24060b39c8448e39cd3e6590671fc8b66a83d9d..f9e4fdbee0ab4d110c088892ffc1b85979f955b9 100644 (file)
@@ -59,6 +59,7 @@ namespace rgw {
                      RGWFileHandle::FLAG_BUCKET);
       if (get<0>(fhr)) {
        RGWFileHandle* rgw_fh = get<0>(fhr);
+       rgw_fh->set_times(req.get_ctime());
        /* restore attributes */
        auto ux_key = req.get_attr(RGW_ATTR_UNIX_KEY1);
        auto ux_attrs = req.get_attr(RGW_ATTR_UNIX1);
@@ -122,7 +123,7 @@ namespace rgw {
          if (get<0>(fhr)) {
            RGWFileHandle* rgw_fh = get<0>(fhr);
            rgw_fh->set_size(req.get_size());
-           rgw_fh->set_mtime(real_clock::to_timespec(req.get_mtime()));
+           rgw_fh->set_times(req.get_mtime());
            /* restore attributes */
            auto ux_key = req.get_attr(RGW_ATTR_UNIX_KEY1);
            auto ux_attrs = req.get_attr(RGW_ATTR_UNIX1);
@@ -148,7 +149,7 @@ namespace rgw {
          if (get<0>(fhr)) {
            RGWFileHandle* rgw_fh = get<0>(fhr);
            rgw_fh->set_size(req.get_size());
-           rgw_fh->set_mtime(real_clock::to_timespec(req.get_mtime()));
+           rgw_fh->set_times(req.get_mtime());
            /* restore attributes */
            auto ux_key = req.get_attr(RGW_ATTR_UNIX_KEY1);
            auto ux_attrs = req.get_attr(RGW_ATTR_UNIX1);
index 43c27553ab81bc824aaedb2ac501454a89fcb100..4cec6e7d5e9576d4087fd2b3ea065d747e023aaf 100644 (file)
@@ -1812,6 +1812,10 @@ public:
     return (iter != attrs.end()) ? &(iter->second) : nullptr;
   }
 
+  real_time get_ctime() const {
+    return bucket.creation_time;
+  }
+
   virtual bool only_bucket() { return false; }
 
   virtual int op_init() {
@@ -1844,10 +1848,6 @@ public:
     return 0;
   }
 
-  real_time get_ctime() const {
-    return bucket.creation_time;
-  }
-
   virtual int get_params() {
     return 0;
   }