NFS (Network File System) allows hosts to mount partitions on a remote system and use them as though they are local file systems. This allows the system administrator to store resources in a central location on the network, providing authorized users continuous access to them.
NFS can be used over any kind of datagram or stream protocols. In most cases UDP or TCP
Many RPC requests in NFS protocol are idempotent ???
NFS (Network File System) NO Create file CREATE NO Remove file REMOVE YES Fix server cache data to the disk COMMIT YES Check access ACCESS YES Read from symbolic link READLINK YES Read file READ YES Write to the file WRITE NO Rename file RENAME YES File name search LOOKUP YES Set file attribute SETATTR YES Get file attribute GETATTR Idempotent Action RCP request
NFS (Network File System) YES Get FS static attribute FSINFO YES Get POSIX information PATHCONF YES Get FS dynamic attribute FSSTAT NO Crate directory MKDIR NO Remove directory RMDIR YES Read directory READDIR YES Extended directory read READDIRPLUS NO Create special node MKNOD NO Create symbolic link SYMLINK NO Create hard link LINK Idempotent Action RCP request
1. This protocol if supported from both sides can give full cache synchronization between server and client by means of short time leases.
2. Lease – it’s like a ticket and it’s ok to use this ticket until ticket time expires.
It means, that when client hold the ticket it knows that server will inform him about any file modification that will happened during this time. If ticket time expires and client want to use data from his cache it needs contact server.
Non-cache lease – define that all file system operations should be take synchronously with server
Read cache lease – let client cache data, not allow to change file.
Write cache lease – let client to cache write operations for lease time. So if client cache write data, then this data will not be written to the server synchronously. When lease time coming to the end client will try to get another lease, but if it’s not possible, then data have to be written to the server.
FreeBSD NFS implementation (read cache lease) Client A Client B Server Read req. + lease Answer Read sys. call Read sys. Call (from cache) Read req. (cache miss) Answer Lease timeout Read sys. call Lease expired Read lease req. Answer with same ctime ctime the same - cache valid Read sys. Call (from cache) Lease timeout Read req. (cache miss) Answer Read cache lease for client A Read req. + lease Read sys. call Read sys. call Lease timeout Answer Client B added to lease Read req. (cache miss) Answer Time
FreeBSD NFS implementation (write cache lease) Server Client B Write system call Write cached lease Write cached lease for client B Answer (write cache lease) Write system call (cached leaved records) Write cached lease req. before previous lease expired. Get record lease Lease update Answer (write cache lease) Lease timeout System call Lease expired record answer record answer Lease expiration Stopped for a moment because of records Write_slack seconds After last records Time
FreeBSD NFS implementation (non-cache lease) Client A Server Client B Time Read sys. call req. Read req. + lease Read cache lease for A client answer Read req. (from cache) Read req. (miss cache) answer Lease timeout Read sys. call req. Lease request Answer (non-cache lease) Read sys. call req. (non-cache lease mode) Read req. Read data Lease expired Write sys. call req. Get write cache lease Answer (non-cache lease) Write sys. call (async write cached) Cleanup req. Write cached data to server record answer answer record Release msg. Write sys. call req. Get write cache lease record answer Synchronous Writes wihout cache