Fix a bug in hte symlink code that required that linkname contained at least one
path component and thus prevented us from creating symlinks in the current
directory.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Change all public posix like functions to switch on the protocol version
and call out to the existing functions when NFS v3 is selected.
Rename all internal functions that are v3 specific to have a nfs3_ prefix.
We do not yet have any v4 support but we now have the framework to start plugging it in.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This only allow selecting the version for the context.
There is still no real v4 support and all I/O is still using v3.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
The main changes since 1.11.0:
BUGS
====
Fix NULL pointer crash in nfs_link().
Clamp read/write size for servers (Ganesha) that offer very large io sizes
instead of failing to connect to the export.
Tell the server to commit all data to stable storage when we close files.
Double free fix: don't call rpc_free_pdu() after rpc_queue_pdu() failure.
Fix for memory leak in rpc_allocate_*().
Fixes to build nfs-ls and nfs-cp on win32.
Abort the mount process correctly if MOUNT/MNT returns error or is cancelled.
Fix memory leak in error path in nfs_create_2_cb().
Fix leak of rpc->inbuf if we destroy the context while we still have PDUs
in flight.
FEATURES
========
Add O_NOFOLLOW support for nfs_open()
Add a new mkdir2 command that also takes a mode argument.
Add a new readlink2 command that avoids having to preallocate the buffer.
Add support for RPC timeouts for both the sync and async interfaces.
Build fixes for Mingw and Cygwin
Update README to document two new Windows builds
Use SOCK_CLOEXEC for the sockets
Make rpc_set{g|u}id() public
Performance optimization: socket: Batch pdu read in rpc_read_from_socket
Low level support for NFSv4 and some examples
Support for building RPC servers
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Change the loop so poll will timeout after 100ms so that we get 100ms
granularity on the timer that drives the timeouts.
Secondly, stop treating poll returning 0 as an error as this will be normal
if an application use sync NOF commands set to >>100ms for the timeout.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
For NFS sessions, change the autoreconnect options to be :
-1: (default) retry connectiong back to the server forever. Just like
normal NFS clients do.
0: Do not attempt reconnecting at all. Immediately fail and return an
error back to the application on session loss.
>=1: Retry connecting to the server this many times before giving up.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
If wait_for_nfs_reply() times out, nfs_mount can return with RPCs
still pending. In that case when the RPCs complete (perhaps because
someone calls destroy_context()), the callbacks run, and private_data
is pointing at what was the stack-allocated cb_data structure. Stack
smashing and segfaulty fun ensue.
Fix by ensuring no RPCs are pending before returning from nfs_mount()
by disconnecting on errors.