Project

General

Profile

Bug #15723

client: fstat cap release

Added by Noah Watkins over 2 years ago. Updated over 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Performance/Resource Usage
Target version:
-
Start date:
05/04/2016
Due date:
% Done:

0%

Source:
other
Tags:
Backport:
jewel
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(FS):
Labels (FS):
Pull request ID:

Description

From mailing list. The patch below lets fstat take cap. Seems to work just fine with a single client (it gets the cap, doesn't do round trips to mds). With multiple clients, I see unexpected results. Running the following on one client yields very high iops. When another concurrent client starts it blocks. Expected behavior is that they both make round trips to MDS, but otherwise make progress.

fd = cephfs.open('file-1', 'w', 0755)
count = 0
start = time.time()
while True:
    stat = cephfs.fstat(fd)
    count += 1
    if time.time() > (start + 1):
        print(count)
        count = 0
        start = time.time()

Patch:

709840b - fsclient: fstat can take inode all cap (10 minutes ago) <Noah Watkins>
diff --git a/src/client/Client.cc b/src/client/Client.cc
index 7fcd907..94e4db5 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -8668,16 +8668,16 @@ int Client::_fsync(Fh *f, bool syncdataonly)
   return _fsync(f->inode.get(), syncdataonly);
 }

-int Client::fstat(int fd, struct stat *stbuf)
+int Client::fstat(int fd, struct stat *stbuf, int mask)
 {
   Mutex::Locker lock(client_lock);
-  tout(cct) << "fstat" << std::endl;
+  tout(cct) << "fstat" << " mask " << mask << std::endl;
   tout(cct) << fd << std::endl;

   Fh *f = get_filehandle(fd);
   if (!f)
     return -EBADF;
-  int r = _getattr(f->inode, -1);
+  int r = _getattr(f->inode, mask);
   if (r < 0)
     return r;
   fill_stat(f->inode, stbuf, NULL);
diff --git a/src/client/Client.h b/src/client/Client.h
index d912db0..860f28b 100644
--- a/src/client/Client.h
+++ b/src/client/Client.h
@@ -981,7 +981,7 @@ public:
   int fake_write_size(int fd, loff_t size);
   int ftruncate(int fd, loff_t size);
   int fsync(int fd, bool syncdataonly);
-  int fstat(int fd, struct stat *stbuf);
+  int fstat(int fd, struct stat *stbuf, int mask=CEPH_STAT_CAP_INODE_ALL);
   int fallocate(int fd, int mode, loff_t offset, loff_t length);

Related issues

Copied to fs - Backport #16152: jewel: fs: client: fstat cap release Resolved

History

#1 Updated by Zheng Yan over 2 years ago

  • Status changed from New to Need Review

#2 Updated by John Spray over 2 years ago

  • Status changed from Need Review to Pending Backport
  • Backport set to jewel

#3 Updated by Nathan Cutler over 2 years ago

#4 Updated by Greg Farnum over 2 years ago

  • Category set to Performance/Resource Usage

#5 Updated by Loic Dachary over 2 years ago

  • Status changed from Pending Backport to Resolved

Also available in: Atom PDF