xetdata / nfsserve Goto Github PK
View Code? Open in Web Editor NEWA Rust NFS Server implementation
License: BSD 3-Clause "New" or "Revised" License
A Rust NFS Server implementation
License: BSD 3-Clause "New" or "Revised" License
I followed the directions on the main page, but it's not working for me:
> git clone https://github.com/xetdata/nfsserve.git
> cd nfsserve/
> cargo build
> ./target/debug/nfsserve
In another shell:
> sudo mkdir /mnt/demo
> sudo mount.nfs -o user,noacl,nolock,vers=3,tcp,wsize=1048576,rsize=131072,actimeo=120,port=11111,mountport=11111 localhost:/ /mnt/demo
> ls -l /mnt/
ls: cannot access '/mnt/demo': Stale file handle
total 47
d????????? ? ? ? ? ? demo
> sudo ls -l /mnt
ls: cannot access '/mnt/demo': Stale file handle
total 47
d????????? ? ? ? ? ? demo
> sudo umount /mnt/demo
Here's the output from nfsserve
during the attempted accesses above:
2023-09-21T06:54:26.578579Z INFO nfsserve::tcp: Listening on "127.0.0.1:11111"
2023-09-21T06:54:31.642605Z INFO nfsserve::tcp: Accepting socket PollEvented { io: Some(TcpStream { addr: 127.0.0.1:11111, peer: 127.0.0.1:762, fd: 7 }) } RPCContext { local_port: 11111, client_addr: "127.0.0.1:762", auth: auth_unix { stamp: 0, machinename: [], uid: 0, gid: 0, gids: [] } }
2023-09-21T06:54:31.643807Z DEBUG nfsserve::mount_handlers: mountproc3_null(2882213060)
2023-09-21T06:54:31.643863Z DEBUG nfsserve::mount_handlers: 2882213060 --> rpc_msg { xid: 2882213060, body: REPLY(MSG_ACCEPTED(accepted_reply { verf: opaque_auth { flavor: AUTH_NULL, body: [] }, reply_data: SUCCESS })) }
2023-09-21T06:54:31.644593Z DEBUG nfsserve::mount_handlers: mountproc3_mnt(2898990276,"/")
2023-09-21T06:54:31.644660Z DEBUG nfsserve::mount_handlers: 2898990276 --> mountres3_ok { fhandle: [220, 206, 132, 182, 138, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], auth_flavors: [0, 1] }
2023-09-21T06:54:31.645528Z INFO nfsserve::tcp: Message loop broken due to early eof
2023-09-21T06:54:31.645807Z INFO nfsserve::tcp: Accepting socket PollEvented { io: Some(TcpStream { addr: 127.0.0.1:11111, peer: 127.0.0.1:908, fd: 7 }) } RPCContext { local_port: 11111, client_addr: "127.0.0.1:908", auth: auth_unix { stamp: 0, machinename: [], uid: 0, gid: 0, gids: [] } }
2023-09-21T06:54:31.646608Z DEBUG nfsserve::nfs_handlers: nfsproc3_null(3965011991)
2023-09-21T06:54:31.646648Z DEBUG nfsserve::nfs_handlers: 3965011991 --> rpc_msg { xid: 3965011991, body: REPLY(MSG_ACCEPTED(accepted_reply { verf: opaque_auth { flavor: AUTH_NULL, body: [] }, reply_data: SUCCESS })) }
2023-09-21T06:54:31.647560Z DEBUG nfsserve::nfs_handlers: nfsproc3_fsinfo(3981789207,nfs_fh3 { data: [220, 206, 132, 182, 138, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0] })
2023-09-21T06:54:31.647689Z DEBUG nfsserve::nfs_handlers: 3981789207 ---> FSINFO3resok { obj_attributes: attributes(fattr3 { ftype: NF3DIR, mode: 511, nlink: 0, uid: 507, gid: 507, size: 0, used: 0, rdev: specdata3 { specdata1: 0, specdata2: 0 }, fsid: 0, fileid: 1, atime: nfstime3 { seconds: 0, nseconds: 0 }, mtime: nfstime3 { seconds: 0, nseconds: 0 }, ctime: nfstime3 { seconds: 0, nseconds: 0 } }), rtmax: 1048576, rtpref: 126976, rtmult: 1048576, wtmax: 1048576, wtpref: 1048576, wtmult: 1048576, dtpref: 1048576, maxfilesize: 137438953472, time_delta: nfstime3 { seconds: 0, nseconds: 1000000 }, properties: 26 }
2023-09-21T06:54:31.648325Z DEBUG nfsserve::nfs_handlers: nfsproc3_pathconf(3998566423,nfs_fh3 { data: [220, 206, 132, 182, 138, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0] })
2023-09-21T06:54:31.648400Z DEBUG nfsserve::nfs_handlers: 3998566423 ---> PATHCONF3resok { obj_attributes: attributes(fattr3 { ftype: NF3DIR, mode: 511, nlink: 0, uid: 507, gid: 507, size: 0, used: 0, rdev: specdata3 { specdata1: 0, specdata2: 0 }, fsid: 0, fileid: 1, atime: nfstime3 { seconds: 0, nseconds: 0 }, mtime: nfstime3 { seconds: 0, nseconds: 0 }, ctime: nfstime3 { seconds: 0, nseconds: 0 } }), linkmax: 0, name_max: 32768, no_trunc: true, chown_restricted: true, case_insensitive: false, case_preserving: true }
2023-09-21T06:54:31.649133Z DEBUG nfsserve::nfs_handlers: nfsproc3_fsinfo(4015343639,nfs_fh3 { data: [220, 206, 132, 182, 138, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0] })
2023-09-21T06:54:31.649231Z DEBUG nfsserve::nfs_handlers: 4015343639 ---> FSINFO3resok { obj_attributes: attributes(fattr3 { ftype: NF3DIR, mode: 511, nlink: 0, uid: 507, gid: 507, size: 0, used: 0, rdev: specdata3 { specdata1: 0, specdata2: 0 }, fsid: 0, fileid: 1, atime: nfstime3 { seconds: 0, nseconds: 0 }, mtime: nfstime3 { seconds: 0, nseconds: 0 }, ctime: nfstime3 { seconds: 0, nseconds: 0 } }), rtmax: 1048576, rtpref: 126976, rtmult: 1048576, wtmax: 1048576, wtpref: 1048576, wtmult: 1048576, dtpref: 1048576, maxfilesize: 137438953472, time_delta: nfstime3 { seconds: 0, nseconds: 1000000 }, properties: 26 }
2023-09-21T06:54:31.651414Z DEBUG nfsserve::nfs_handlers: nfsproc3_getattr(4032120855,nfs_fh3 { data: [220, 206, 132, 182, 138, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0] })
2023-09-21T06:54:31.651473Z DEBUG nfsserve::nfs_handlers: 4032120855 --> fattr3 { ftype: NF3DIR, mode: 511, nlink: 0, uid: 507, gid: 507, size: 0, used: 0, rdev: specdata3 { specdata1: 0, specdata2: 0 }, fsid: 0, fileid: 1, atime: nfstime3 { seconds: 0, nseconds: 0 }, mtime: nfstime3 { seconds: 0, nseconds: 0 }, ctime: nfstime3 { seconds: 0, nseconds: 0 } }
2023-09-21T06:54:34.071138Z DEBUG nfsserve::nfs_handlers: nfsproc3_getattr(4048898071,nfs_fh3 { data: [220, 206, 132, 182, 138, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0] })
2023-09-21T06:54:34.071179Z DEBUG nfsserve::nfs_handlers: 4048898071 --> fattr3 { ftype: NF3DIR, mode: 511, nlink: 0, uid: 507, gid: 507, size: 0, used: 0, rdev: specdata3 { specdata1: 0, specdata2: 0 }, fsid: 0, fileid: 1, atime: nfstime3 { seconds: 0, nseconds: 0 }, mtime: nfstime3 { seconds: 0, nseconds: 0 }, ctime: nfstime3 { seconds: 0, nseconds: 0 } }
2023-09-21T06:54:36.401530Z DEBUG nfsserve::nfs_handlers: nfsproc3_getattr(4065675287,nfs_fh3 { data: [220, 206, 132, 182, 138, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0] })
2023-09-21T06:54:36.401601Z DEBUG nfsserve::nfs_handlers: 4065675287 --> fattr3 { ftype: NF3DIR, mode: 511, nlink: 0, uid: 507, gid: 507, size: 0, used: 0, rdev: specdata3 { specdata1: 0, specdata2: 0 }, fsid: 0, fileid: 1, atime: nfstime3 { seconds: 0, nseconds: 0 }, mtime: nfstime3 { seconds: 0, nseconds: 0 }, ctime: nfstime3 { seconds: 0, nseconds: 0 } }
2023-09-21T06:54:39.577394Z DEBUG nfsserve::nfs_handlers: nfsproc3_getattr(4082452503,nfs_fh3 { data: [220, 206, 132, 182, 138, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0] })
2023-09-21T06:54:39.577521Z DEBUG nfsserve::nfs_handlers: 4082452503 --> fattr3 { ftype: NF3DIR, mode: 511, nlink: 0, uid: 507, gid: 507, size: 0, used: 0, rdev: specdata3 { specdata1: 0, specdata2: 0 }, fsid: 0, fileid: 1, atime: nfstime3 { seconds: 0, nseconds: 0 }, mtime: nfstime3 { seconds: 0, nseconds: 0 }, ctime: nfstime3 { seconds: 0, nseconds: 0 } }
2023-09-21T06:54:39.654821Z INFO nfsserve::tcp: Message loop broken due to early eof
Hi there! I'm a big fan of this crate. It does exactly what I need it to.
I noticed that it uses the async_trait
crate, which is no longer necessary now that Rust has stabilized async function in trait (AFIT).
This will break consumers but they only need to remove the #[async_trait]
attribute to fix their code. Perhaps a new major version signifying this change, accompanied by a MSRV policy, will help.
Hi,
I'm trying to implement an nfs server with a custom storage backend, and need to serialize some of the types defined (such as fattr3
).
Is it possible to re-export the xdr module so its serialization functionality may be used externally?
Many thanks for this crate!
Liran
Hi :)
From what I see, the auth
that's defined in RPCContext
is parsed but not checked, meaning that any user on a client machine has full access to the data, which might be a security issue.
Is it possible to add that functionality?
Alternatively, exposing the auth
(or the context) to the different methods in the NFSFileSystem
so that implementers can be responsible for the checks is also a possibility.
Thanks,
Liran
Hi!
Recently I did many Profile-Guided Optimization (PGO) benchmarks on multiple projects (network-related projects like Envoy, HAProxy, etc.) - the results are available here. I think it could interesting to try to test PGO for optimizing the CPU part of NFSserve.
I can suggest the following things to do:
Here are some examples of how PGO is already integrated into other projects' build scripts:
After PGO, I can suggest evaluating LLVM BOLT as an additional optimization step after PGO.
For the Rust projects, I recommend starting with cargo-pgo.
I understand that the project is in the earliest stages of its lifecycle. So just think about the issue as a possible idea for improvements.
Hi, does the demo work for Windows Server 2019? Tried the Windows Server 2019 version and also the Windows 10 Enterprise version but the mount command always returns
mount.exe -o anon,nolock,mtype=soft,fileaccess=6,casesensitive,lang=ansi,rsize=128,wsize=128,timeout=60,retry=2 \\127.0.0.1\\ X:
Network Error - 53
Type 'NET HELPMSG 53' for more information.
Where the HELPMSG shows "The network path was not found." I can confirm Client for NFS is installed and restarted. This is an amazing lib! Recently tried out ProjFS but it didn't meet the needs so am really anticipating on this (:
Thanks in advance!
Hello team,
You done a great job!And I think there are still something I can do as a new.I check the list in TODO and Seeking Contributors .One of them make me confuse which is Maybe pull in the mount command from [xet-core]...
.Does It mean printing those command after NFSserve start?
I make a issue tring to figure it out avoid do something unnecessory. 👀
Hi, is there any chance we will publish v0.10.2 to crate.io? Right now it's v0.10.1. The old version have some problem for my use case, but the latest v0.10.2 seems fine!
Rust NFSv3 Server 支持在android上使用吗。我想把我的android手机当成nfs服务器用。
As in topic.
Thanks,
vermaden
Hi,
I am trying to implement ReadWrite NFS server on Windows, most of the other operation can be done successfully except for the rename()
operation.
So I tried several different behavior:
Rename-Item
to rename a file, it actually called multiple interface such as lookup(), create() and remove() to achieve the result.Rename-Item
to rename a folder, it always give me access denied, even if I setup all file / folders as 777invalid device
pop up windowFor case 1 is it expected or should the server directly call rename() interface instead? For 2 and 3 could you please confirm rename() should be working on Windows and appreciate if you could provide any insight on what might go wrong? Thanks!
Hello team
What is Ihis? I search it in bing and github but got nothing like nfs or other similar stuff.Did I miss something?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.