stop handling opendir and releasedir on kernels with FUSE_NO_OPENDIR_SUPPORT

Summary:
Eden requires no state in its directory handles, so tell the kernel it
doesn't need to send opendir() and releasedir() requests, provided it
has FUSE_NO_OPENDIR_SUPPORT.

Reviewed By: strager

Differential Revision: D13594734

fbshipit-source-id: ebd4b69f4efcd1428a69024c4bdffb1ae455fa40
This commit is contained in:
Chad Austin 2019-03-22 15:53:47 -07:00 committed by Facebook Github Bot
parent a9d9689d3d
commit cc1c841004
2 changed files with 12 additions and 0 deletions

View File

@ -1013,6 +1013,9 @@ void FuseChannel::readInitPacket() {
// File handles are stateless so the kernel does not need to send open() and
// release().
want |= FUSE_NO_OPEN_SUPPORT;
// File handles are stateless so the kernel does not need to send
// open() and release().
want |= FUSE_NO_OPENDIR_SUPPORT;
#endif
// Only return the capabilities the kernel supports.

View File

@ -80,6 +80,15 @@ folly::Future<Dispatcher::Attr> EdenDispatcher::getattr(InodeNumber ino) {
folly::Future<uint64_t> EdenDispatcher::opendir(InodeNumber ino, int flags) {
FB_LOGF(
mount_->getStraceLogger(), DBG7, "opendir({}, flags={:x})", ino, flags);
#ifdef FUSE_NO_OPENDIR_SUPPORT
if (getConnInfo().flags & FUSE_NO_OPENDIR_SUPPORT) {
// If the kernel understands FUSE_NO_OPENDIR_SUPPORT, then returning ENOSYS
// means that no further opendir() nor releasedir() calls will make it into
// Eden.
folly::throwSystemErrorExplicit(
ENOSYS, "Eden opendir() calls are stateless and not required");
}
#endif
return 0;
}