rgw: for the create_bucket api, if the input creation_time is zero, we should set...
authorweiqiaomiao <wei.qiaomiao@zte.com.cn>
Sun, 30 Jul 2017 09:48:17 +0000 (10:48 +0100)
committerPeter Michael Green <plugwash@raspbian.org>
Sun, 30 Jul 2017 09:48:17 +0000 (10:48 +0100)
Fixes: http://tracker.ceph.com/issues/16597
Signed-off-by: weiqiaomiao <wei.qiaomiao@zte.com.cn>
Gbp-Pq: Name rgw_rados-creation_time.patch

src/rgw/rgw_rados.cc

index 3f348502d127b50dd3ff7ff990daa99fb920473f..539a564a2b8cf6aa3140d2adf351f7c6cd779410 100644 (file)
@@ -5153,10 +5153,11 @@ int RGWRados::create_bucket(RGWUserInfo& owner, rgw_bucket& bucket,
     info.num_shards = bucket_index_max_shards;
     info.bucket_index_shard_hash_type = RGWBucketInfo::MOD;
     info.requester_pays = false;
-    if (real_clock::is_zero(creation_time))
-      creation_time = ceph::real_clock::now(cct);
-    else
+    if (real_clock::is_zero(creation_time)) {
+      info.creation_time = ceph::real_clock::now(cct);
+    } else {
       info.creation_time = creation_time;
+    }
     ret = put_linked_bucket_info(info, exclusive, ceph::real_time(), pep_objv, &attrs, true);
     if (ret == -EEXIST) {
        /* we need to reread the info and return it, caller will have a use for it */