Project

General

Profile

Actions

Bug #15723

closed

client: fstat cap release

Added by Noah Watkins almost 8 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Performance/Resource Usage
Target version:
-
% 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:
Crash signature (v1):
Crash signature (v2):

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 1 (0 open1 closed)

Copied to CephFS - Backport #16152: jewel: fs: client: fstat cap releaseResolvedAbhishek VarshneyActions
Actions #1

Updated by Zheng Yan almost 8 years ago

  • Status changed from New to Fix Under Review
Actions #2

Updated by John Spray almost 8 years ago

  • Status changed from Fix Under Review to Pending Backport
  • Backport set to jewel
Actions #3

Updated by Nathan Cutler almost 8 years ago

Actions #4

Updated by Greg Farnum almost 8 years ago

  • Category set to Performance/Resource Usage
Actions #5

Updated by Loïc Dachary over 7 years ago

  • Status changed from Pending Backport to Resolved
Actions

Also available in: Atom PDF