]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: fix race condition during get_fs_usage()
authorxie xingguo <xie.xingguo@zte.com.cn>
Fri, 19 Aug 2016 02:30:49 +0000 (10:30 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Fri, 19 Aug 2016 05:49:57 +0000 (13:49 +0800)
file_map should be accessed under the protection
of the global lock.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueFS.cc

index 9976b4ed21932a9a2af7ec31d2a0f95532b651ef..61670a418b2ea53fd0baa45c16ea452fbe54a008 100644 (file)
@@ -183,6 +183,7 @@ int BlueFS::reclaim_blocks(unsigned id, uint64_t want,
 
 uint64_t BlueFS::get_fs_usage()
 {
+  std::lock_guard<std::mutex> l(lock);
   uint64_t total_bytes = 0;
   for (auto& p : file_map) {
     total_bytes += p.second->fnode.get_allocated();