]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: set f_files to the total number of files in the filesystem 24376/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:24:04 +0000 (21:24 +0200)
Fixes: http://tracker.ceph.com/issues/24849
Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit 39467a2c95815a495d75a9ced119975bfe62616c)

Conflicts:
src/client/Client.cc

src/client/Client.cc

index 92426d5521b377825da5562e76f0f70ebbcfd105..063d755a06b6ce4becf4b625c558278a604a1b25 100644 (file)
@@ -9711,6 +9711,7 @@ int Client::statfs(const char *path, struct statvfs *stbuf,
 {
   Mutex::Locker l(client_lock);
   tout(cct) << "statfs" << std::endl;
+  unsigned long int total_files_on_fs;
 
   if (unmounting)
     return -ENOTCONN;
@@ -9727,6 +9728,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) {
@@ -9748,8 +9751,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;        // ??