From: jiahuizeng Date: Tue, 5 Nov 2019 02:48:51 +0000 (+0800) Subject: rgw: avoid expiration early triggering caused by overflow X-Git-Tag: v15.2.9~73^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=92b1ac9c86cb2e5920f5ec81d59a24b991194299;p=ceph.git rgw: avoid expiration early triggering caused by overflow Fixes: https://tracker.ceph.com/issues/42634 Signed-off-by: jiahuizeng (cherry picked from commit 260df7dfd819a4117ae76aaf699370afda653baf) --- diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 2d6357c83fb..2967ab05b53 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -345,11 +345,11 @@ static bool obj_has_expired(CephContext *cct, ceph::real_time mtime, int days, 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(); } auto tt_mtime = ceph::real_clock::to_time_t(mtime); @@ -2229,7 +2229,7 @@ std::string s3_expiration_header( if (rule_expiration.has_days()) { rule_expiration_date = boost::optional( - mtime + make_timespan(rule_expiration.get_days()*24*60*60 - ceph::real_clock::to_time_t(mtime)%(24*60*60) + 24*60*60)); + mtime + make_timespan((double)rule_expiration.get_days()*24*60*60 - ceph::real_clock::to_time_t(mtime)%(24*60*60) + 24*60*60)); } }