nfs: properly reply to MNT RPC call

Summary:
Now that we have the list of available mount points, we can properly reply to
the MNT RPC call.

Reviewed By: kmancini

Differential Revision: D26152810

fbshipit-source-id: f364292ead321689fb20f858aee45efdfbd7287d
This commit is contained in:
Xavier Deguillard 2021-02-03 17:52:36 -08:00 committed by Facebook GitHub Bot
parent ab0c780f52
commit 2bb4f7739f
3 changed files with 16 additions and 1 deletions

View File

@ -112,10 +112,23 @@ folly::Future<folly::Unit> MountdServerProcessor::null(
}
folly::Future<folly::Unit> MountdServerProcessor::mount(
folly::io::Cursor /*deser*/,
folly::io::Cursor deser,
folly::io::Appender ser,
uint32_t xid) {
serializeReply(ser, accept_stat::SUCCESS, xid);
AbsolutePath path{XdrTrait<std::string>::deserialize(deser)};
XLOG(DBG7) << "Mounting: " << path;
auto mounts = mountPoints_.rlock();
auto found = mounts->find(path);
if (found != mounts->end()) {
XdrTrait<mountstat3>::serialize(ser, mountstat3::MNT3_OK);
XdrTrait<mountres3_ok>::serialize(
ser, mountres3_ok{found->second, {auth_flavor::AUTH_UNIX}});
} else {
XdrTrait<mountstat3>::serialize(ser, mountstat3::MNT3ERR_NOENT);
}
return folly::unit;
}

View File

@ -42,6 +42,7 @@ int main(int argc, char** argv) {
SignalHandler signal(evb);
Mountd mountd(true);
mountd.registerMount(AbsolutePathPiece("/foo/bar"), InodeNumber(42));
evb->loop();
}

View File

@ -80,6 +80,7 @@ namespace facebook::eden {
enum class auth_flavor {
AUTH_NONE = 0,
AUTH_SYS = 1,
AUTH_UNIX = 1, /* AUTH_UNIX is the same as AUTH_SYS */
AUTH_SHORT = 2,
AUTH_DH = 3,
RPCSEC_GSS = 6