]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
fix OSD utilization is abnormal after data disk lost 6869/head
authorchuanhong-wang <chuanhong.wang@163.com>
Wed, 9 Dec 2015 10:07:15 +0000 (18:07 +0800)
committerwang chuanhong <wang.chuanhong@zte.com.cn>
Wed, 16 Dec 2015 06:31:20 +0000 (14:31 +0800)
in function "OSDService::update_osd_stat", local variable "stbuf"" isn't initialized and it's still used to
update the utilization of OSD.

http://tracker.ceph.com/issues/14026

Fixes: #14026
Signed-off-by: Chuanhong Wang <wang.chuanhong@zte.com.cn>
src/osd/OSD.cc

index 7425cc7e6b6e284aa6c6d66af8b4625d3181b7f4..315a291265085fec0a7de847eaaf7564dc7638e1 100644 (file)
@@ -668,7 +668,11 @@ void OSDService::update_osd_stat(vector<int>& hb_peers)
 
   // fill in osd stats too
   struct statfs stbuf;
-  osd->store->statfs(&stbuf);
+  int r = osd->store->statfs(&stbuf);
+  if (r < 0) {
+    derr << "statfs() failed: " << cpp_strerror(r) << dendl; 
+    return;
+  }
 
   uint64_t bytes = stbuf.f_blocks * stbuf.f_bsize;
   uint64_t used = (stbuf.f_blocks - stbuf.f_bfree) * stbuf.f_bsize;