]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: set f_files to the total number of files in the filesystem 24377/head
authorRishabh Dave <ridave@redhat.com>
Mon, 30 Jul 2018 05:15:08 +0000 (05:15 +0000)
committerNathan Cutler <ncutler@suse.com>
Tue, 2 Oct 2018 19:26:01 +0000 (21:26 +0200)
Fixes: http://tracker.ceph.com/issues/24849
Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit 39467a2c95815a495d75a9ced119975bfe62616c)

src/client/Client.cc

index 910e44d32e1888f12a74639baf944f1de5220fa7..b7e03c8ca57943dfec0a416d63c1f043b237fc61 100644 (file)
@@ -9661,6 +9661,7 @@ int Client::statfs(const char *path, struct statvfs *stbuf,
 {
   Mutex::Locker l(client_lock);
   tout(cct) << __func__ << std::endl;
+  unsigned long int total_files_on_fs;
 
   if (unmounting)
     return -ENOTCONN;
@@ -9677,6 +9678,8 @@ int Client::statfs(const char *path, struct statvfs *stbuf,
 
   client_lock.Unlock();
   int rval = cond.wait();
+  assert(root);
+  total_files_on_fs = root->rstat.rfiles + root->rstat.rsubdirs;
   client_lock.Lock();
 
   if (rval < 0) {
@@ -9698,8 +9701,8 @@ int Client::statfs(const char *path, struct statvfs *stbuf,
   const int CEPH_BLOCK_SHIFT = 22;
   stbuf->f_frsize = 1 << CEPH_BLOCK_SHIFT;
   stbuf->f_bsize = 1 << CEPH_BLOCK_SHIFT;
-  stbuf->f_files = stats.num_objects;
-  stbuf->f_ffree = -1;
+  stbuf->f_files = total_files_on_fs;
+  stbuf->f_ffree = 0;
   stbuf->f_favail = -1;
   stbuf->f_fsid = -1;       // ??
   stbuf->f_flag = 0;        // ??