Compare BOTH the seconds field and the nanoseconds field when checking if
the cached directory structure is valid or not.
Linux knfsd and other modern servers actually do set the nanosecond field
so why not check it.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
We can save one malloc by storing both the rpc_pdu and decoding buffer
in the same memory block.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
The biggest changes in this release are:
- Fix a leak where we leaked one rdpe_cb_data structure on each open_dir()
- Make building the utils optional
- Android: the correct define is __ANDROID__ not ANDROID
- Win32: Use _U_ instead of ATTRIBURE((unused))
- Win32: Fix nfs_stat declaration for Win32
- Various fixes for mingw builds
- Make rpc->connect_cb a one shot callback and improve documentation
- Remove the FUSE module. It now lives in its own repo
- Fix POLLERR/POLLHUP handling to properly handle session failures and to
try to auto-reconnect
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This fixes build with options such as --as-needed that require correct positional argument passing. They also ensure that the right dependency library is used.
POLLERR and POLLHUP handling in rpc_service() could not deal with
session failures or auto reconnect.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
It makes no sense to have socket.c keep invoking this callback over and over.
Just change it to become one-shot.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
The linux kernel does not check the UDP checksum until the application tries
to read if from the socket.
This means that the socket might be readable, but when we try to read
the data, or inspect how much data is available, the packets will be discarded
by the kernel.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
If we are trying to read (part of?) the RM, we can not assume that as long
as recv() returned non-error that we have the full RM.
We must check before we proceed to try to read the actual PDU data.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
We can not have a static rpc->inbuf buffer since that will no longer guarantee
that the received buffer is valid for the duration of callbacks.
One of the problems is that if we issue new (sync) RPCs from within a
callback, that will overwrite and invalidate the receive buffer that
we passed to the callback.
Revert "init: do not leak rpc->inbuf"
This reverts commit f7bc4c8bb1.
Revert "socket: we have to use memmove in rpc_read_from_socket"
This reverts commit 24429e95b8.
Revert "socket: make rpc->inbuf static and simplify receive logic"
This reverts commit 7000a0aa04.
Remove the fuse module from the examples subdirectory.
This module is now a standalone repo :
https://github.com/sahlberg/fuse-nfs
And it comes with proper build rules, documentation etc etc.
It is a useful module and it has now graduated to become its own
repo.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This funciton is called from rpc_service when it has detected that
a socket has errored out during reading/writing.
However, since this fucntion returns 0 (==success) for the case where
autoreconnect is not enabled, this means that for an errored socket we
will return 0 (==success) from rpc_service() back to the application.
Change rpc_reconnect_requeue to return -1 when invoked and autoreconnect
is disabled so that applications will receive an error back from rpc_service.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
There is no guarantee that we get the same fd again when
reestablishing a session. But if the fd changes during a
reconnect we might up with a client application busy polling
on the old fd.
Qemu registers a read handler on the current fd, but is
not realizing fd changes. So we busy poll on the old fd for good.
Things are working (except for the busy polling) until
a drain all is issued. At this point Qemu deadlocks.
Signed-off-by: Peter Lieven <pl@kamp.de>
otherwise we end up eating up all socket errors in rpc_service and then
believe we are connected, but the next call to rpc_read_from_socket
fails because the socket is closed. we then reconnect anyway.
Signed-off-by: Peter Lieven <pl@kamp.de>
The fuse framework allows us to directly expose symlinks from NFS to the user,
just like a real NFS mount would. All we need to do is call lstat rather
than stat and implement a readlink function.
With this patch I can successfully chroot into a rootfs mounted using
fuse_nfs.
Signed-off-by: Alexander Graf <agraf@suse.de>
At least in my version of glibc the members st_mtim, st_ctim and st_atim
are defined as struct timespec rather than struct timeval, thus
containing a tv_nsec field rather than tv_usec.
Use the proper struct fields instead, fixing compilation on Linux.
Signed-off-by: Alexander Graf <agraf@suse.de>