diff options
author | xie xingguo <xie.xingguo@zte.com.cn> | 2016-06-03 03:39:25 +0200 |
---|---|---|
committer | xie xingguo <xie.xingguo@zte.com.cn> | 2016-06-03 03:39:25 +0200 |
commit | 8ce5132ac284d15eb8ed873981b9c5080b6d5e5d (patch) | |
tree | cf1f8fd92743c9f0cfc4be9e26c98ecb41095af7 /src/mds | |
parent | Merge pull request #9349 from Adirl/fix_compiltaion_entity_addr_t4 (diff) | |
download | ceph-8ce5132ac284d15eb8ed873981b9c5080b6d5e5d.tar.xz ceph-8ce5132ac284d15eb8ed873981b9c5080b6d5e5d.zip |
mds: fix potential division-by-zero error
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
Diffstat (limited to 'src/mds')
-rw-r--r-- | src/mds/MDCache.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index c2473d8cfc3..da1ad902e43 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -7223,8 +7223,9 @@ void MDCache::check_memory_usage() // check client caps int num_inodes = inode_map.size(); - float caps_per_inode = (float)num_caps / (float)num_inodes; - //float cap_rate = (float)num_inodes_with_caps / (float)inode_map.size(); + float caps_per_inode = 0.0; + if (num_inodes) + caps_per_inode = (float)num_caps / (float)num_inodes; dout(2) << "check_memory_usage" << " total " << last.get_total() |