]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: avoid expiration early triggering caused by overflow
authorjiahuizeng <jhzeng93@foxmail.com>
Tue, 5 Nov 2019 02:48:51 +0000 (10:48 +0800)
committerNathan Cutler <ncutler@suse.com>
Fri, 8 Jan 2021 17:42:19 +0000 (18:42 +0100)
Fixes: https://tracker.ceph.com/issues/42634
Signed-off-by: jiahuizeng <jhzeng93@foxmail.com>
(cherry picked from commit 260df7dfd819a4117ae76aaf699370afda653baf)

Conflicts:
src/rgw/rgw_lc.cc
- make_timespan() call in s3_expiration_header is different in nautilus

src/rgw/rgw_lc.cc

index 26200f6ce2259e3b255a6f99a881724cb75c273d..6ea4217730dfc8b830cb43eef38922981965703a 100644 (file)
@@ -303,11 +303,11 @@ static bool obj_has_expired(CephContext *cct, ceph::real_time mtime, int days, c
   utime_t base_time;
   if (cct->_conf->rgw_lc_debug_interval <= 0) {
     /* Normal case, run properly */
-    cmp = days*24*60*60;
+    cmp = (double)days*24*60*60;
     base_time = ceph_clock_now().round_to_day();
   } else {
     /* We're in debug mode; Treat each rgw_lc_debug_interval seconds as a day */
-    cmp = days*cct->_conf->rgw_lc_debug_interval;
+    cmp = (double)days*cct->_conf->rgw_lc_debug_interval;
     base_time = ceph_clock_now();
   }
   timediff = base_time - ceph::real_clock::to_time_t(mtime);
@@ -1640,7 +1640,7 @@ std::string s3_expiration_header(
       if (rule_expiration.has_days()) {
        rule_expiration_date =
          boost::optional<ceph::real_time>(
-           mtime + make_timespan(rule_expiration.get_days()*24*60*60));
+           mtime + make_timespan((double)rule_expiration.get_days()*24*60*60));
        rule_id = id;
       }
     }