From b5b8aa6cf3caa0371892e9db2fe2fba95dbc7a89 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Wed, 7 Mar 2018 14:26:09 +0300 Subject: [PATCH] osd: remove assert on inconsistent total/available values from osd_stat_t encode Signed-off-by: Igor Fedotov --- src/osd/osd_types.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 539689ad10f27..98540542eea0d 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; -- 2.39.5