From: Igor Fedotov Date: Wed, 7 Mar 2018 11:26:09 +0000 (+0300) Subject: osd: remove assert on inconsistent total/available values from osd_stat_t encode X-Git-Tag: v14.1.0~692^2~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b5b8aa6cf3caa0371892e9db2fe2fba95dbc7a89;p=ceph.git osd: remove assert on inconsistent total/available values from osd_stat_t encode Signed-off-by: Igor Fedotov --- diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 539689ad10f..98540542eea 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -436,8 +436,11 @@ void osd_stat_t::decode(bufferlist::const_iterator &bl) statfs.reset(); statfs.total = kb << 10; statfs.available = kb_avail << 10; - assert(statfs.total >= statfs.available); - statfs.internally_reserved = statfs.total - statfs.available; + // actually it's totally unexpected to have ststfs.total < statfs.available + // here but unfortunately legacy generate_test_instances produced such a + // case hence inserting some handling rather than assert + statfs.internally_reserved = + statfs.total > statfs.available ? statfs.total - statfs.available : 0; kb_used <<= 10; if ((int64_t)statfs.internally_reserved > kb_used) { statfs.internally_reserved -= kb_used;