From: chuanhong-wang Date: Wed, 9 Dec 2015 10:07:15 +0000 (+0800) Subject: fix OSD utilization is abnormal after data disk lost X-Git-Tag: v10.0.4~157^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=51e956bfc01c68c0b8c444cffa5f7906c0f13bf9;p=ceph.git fix OSD utilization is abnormal after data disk lost 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 7425cc7e6b6..315a2912650 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -668,7 +668,11 @@ void OSDService::update_osd_stat(vector& 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;