]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: remove assert on inconsistent total/available values from osd_stat_t encode
authorIgor Fedotov <ifedotov@suse.com>
Wed, 7 Mar 2018 11:26:09 +0000 (14:26 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Thu, 6 Dec 2018 15:54:21 +0000 (18:54 +0300)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/osd/osd_types.cc

index 539689ad10f27a9635b205823e964ada8f206593..98540542eea0dfe09271ba9fe459e67379224d27 100644 (file)
@@ -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;