]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: make the root member under the client_lock
authorXiubo Li <xiubli@redhat.com>
Mon, 3 Aug 2020 04:01:14 +0000 (12:01 +0800)
committerXiubo Li <xiubli@redhat.com>
Thu, 6 Aug 2020 08:23:35 +0000 (16:23 +0800)
Fixes: https://tracker.ceph.com/issues/46649
Signed-off-by: Xiubo Li <xiubli@redhat.com>
src/client/Client.cc

index a4e1ee59838f60741d7c0af4dca96e1ca8cce719..f20b20bfc11b0f59d0b764bebe8707b476572c3a 100755 (executable)
@@ -10306,7 +10306,7 @@ int Client::statfs(const char *path, struct statvfs *stbuf,
   ceph_statfs stats;
   C_SaferCond cond;
 
-  std::scoped_lock lock(client_lock);
+  std::unique_lock lock(client_lock);
   const vector<int64_t> &data_pools = mdsmap->get_data_pools();
   if (data_pools.size() == 1) {
     objecter->get_fs_stats(stats, data_pools[0], &cond);
@@ -10314,11 +10314,12 @@ int Client::statfs(const char *path, struct statvfs *stbuf,
     objecter->get_fs_stats(stats, boost::optional<int64_t>(), &cond);
   }
 
-  client_lock.unlock();
+  lock.unlock();
   int rval = cond.wait();
+  lock.lock();
+
   assert(root);
   total_files_on_fs = root->rstat.rfiles + root->rstat.rsubdirs;
-  client_lock.lock();
 
   if (rval < 0) {
     ldout(cct, 1) << "underlying call to statfs returned error: "