Commit Graph

493 Commits (aec45c6274bffc92fc1595a95d043e8aae292451)

Author SHA1 Message Date
Mark Hills aec45c6274 Optimisations to the pdu queues
When making many concurrent requests (as is likely in any performance
criticial application), the use of SLIST_REMOVE and SLIST_ADD_END are
a severe bottleneck because of their linear search.

I considered using a double-linked list but it was unnecessary to
allocate the additional memory for each list entry.

Instead, continue to use a single-linked list but retain:

* a pointer to the end of the list; and
* a pointer to the previous entry during a linear search.

The former would makes append operations O(1) time, and the latter
does the same for removal. We can do this because removal only happens
within the linear search, and there is no random access to the queue.
2014-04-03 17:51:04 -07:00
Ronnie Sahlberg 2c0f57fa33 RPM: Fix the specfile 2014-03-23 09:54:21 -07:00
Ronnie Sahlberg 54bafab240 INCLUDES: Don't install libnfs-provate.h or slist.h 2014-03-23 09:54:05 -07:00
Ronnie Sahlberg d3b289284a AUTOTOOLS: Add Makefile.am to utils 2014-03-23 09:18:31 -07:00
Ronnie Sahlberg 7440522d8a SPECFILE: Fix syntax error in the spec file 2014-03-23 09:18:13 -07:00
Ronnie Sahlberg c7ddf2e5cb NFS-LS: Build nfs-ls as utils and make it install under bin 2014-03-21 18:31:05 -07:00
Ronnie Sahlberg ca3bb55c65 DOC: Add manpage for nfs-ls 2014-03-21 18:15:40 -07:00
Ronnie Sahlberg a562a7f5fb examples/Makefile.am Remove stuff we do not need 2014-03-21 17:33:14 -07:00
Ronnie Sahlberg f3684c0857 PORTMAP: Add some comments about the origin of definitions 2014-03-20 17:32:19 -07:00
Arne Redlich d5f7880641 nfs_normalize_path: don't strip trailing slash from "/"
Otherwise end up with a null string which is not permitted (RFC 1813, 3.2;
the code checks for it right after the now fixed nullification of "/").

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-03-20 16:58:32 -07:00
Arne Redlich b644665077 nfs_opendir2_cb: plug potential memory leak
Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-03-20 16:52:53 -07:00
Ronnie Sahlberg 1f8134ebe4 PORTMAP client: Pass length as sockaddr_storage, not sockaddr_in6 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg ea20b4ec24 PORTMAP client: Parse and print the actual sockaddr that UADDR2TADDR returned 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg b3525a9439 IPV6: Update the README and specify ipv6 is supported 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 75ec99d519 PORTMAP client: Add commands to send v3 SET/UNSET 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 24f45c5452 PORTMAP: Rename pmap3_getaddr_result to pmap3_string_result 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 29258a73c0 PORTMAP: Add support for v3 TADDR2UADDR 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 729266a796 PORTMAP: Add PMAP v3 UADDR2TADDR support 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg b71f7e8291 PORTMAP: Add support for PORTMAP v3 CALLIT 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 5245608a65 PORTMAP: Add v3 GETTIME support 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 6c60e2822f IPv6: If we use IPv6 then we need to use PMAP v3 GETADDR 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg d731e94cfa PORTMAP: Add support for SET UNSET procedures 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 7fbedfdefd PORTMAP: Add support for PORTMAP v3 GETADDR 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 4edd78302d PORTMAPv3: Add NULL and DUMP commands. Also add portmap example client. 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 2a32a899ca GETEXPORT: Use rpc_connect_program_async() flow during list exports
and get rid of several now redundant callbacks.
2014-03-19 18:25:50 -07:00
Ronnie Sahlberg f694a287ae RPC_CONNECT: Use the rpc_connect_program_async() flow during nfs_mount() 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 0f0e352f49 PORTMAP: Rename the functions in PMAP to PMAP2 to desribe the version of PMAP we use.
Future patches will add PMAP3 which we will need for IPv6 support.
2014-03-19 18:25:49 -07:00
Ronnie Sahlberg 1c1e09ad51 IPV6: Add basic IPv6 support
This adds basic IPv6 support to libnfs.
Since libnfs currently only support PORTMAPPER protocol up to version 2
the IPv6 support only works if the server runs Both MOUNT and NFS protocols
on the same ports for IPv6 as for IPv4.

To get full IPv6 support we need to add support for PORTMAPPER version 3
and use it for discovery when using IPv6
2014-03-19 18:25:49 -07:00
Ronnie Sahlberg 7058971155 New version: 1.9.3
Wed Mar 19 2014: Version 1.9.3
 - Add O_TRUNC support to nfs_open()
 - Add a simple but incomplete LD_PRELOAD tool
 - Fixes for some memory leaks and C++ compile support
 - Make ANDROID default uid/gid to 65534
 - Allow the READDIRPLUS emulation to still work if some objects
   in the direcotry can not be lookedup (NFSv4 ACL denying READ-ATTRIBUTES)
 - Have libnfs retry any read/write operations where the server responds
   with a short read/write. Some servers do this when they are overloaded?
2014-03-19 18:12:45 -07:00
Ronnie Sahlberg c44c3ff364 Merge pull request #69 from plieven/for-1.9.3
nfs_{pread,pwrite}_async: fix oom handling and comments
2014-03-18 12:30:40 -07:00
Peter Lieven 40a4373ab8 nfs_{pread,pwrite}_async: fix oom handling and comments
Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-18 20:08:33 +01:00
Ronnie Sahlberg 55125e894a Merge pull request #68 from plieven/for-1.9.3
examples/nfs-ls: fix summary output
2014-03-17 10:29:43 -07:00
Peter Lieven 9ecd7868a6 examples/nfs-ls: fix summary output
Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-17 18:06:21 +01:00
Ronnie Sahlberg 8ae943f608 PORTMAP: Add support for V3 DUMP command
This implements the missing procedure from Issue #65
2014-03-16 14:17:06 -07:00
Ronnie Sahlberg 2aec85d132 Merge pull request #67 from plieven/for-1.9.3
For 1.9.3
2014-03-16 13:43:04 -07:00
Peter Lieven ae8168b3eb {pread,pwrite}_async: fix potential segfault in out of memory condition
if there are already requests in flight we cannot return with an error immediately
from the functions since the caller will likely tidy up his data structures directly
and later on we call his callback with private_data that has likely already
been freed.

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-16 20:16:07 +01:00
Peter Lieven 1eb4be3150 nfs_pread_async: handle short reads
the RFC allows the server to read less bytes than requested even
if not at the EOF.
this patch implements a reissue logic for the reminder of the
read request(s).

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-16 20:15:48 +01:00
Peter Lieven 027a767eca nfs_pwrite_async: handle short writes
the RFC allows the server to write less bytes than requested.
this patch implements a reissue logic for the reminder of the
write request(s).

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-16 20:07:59 +01:00
Peter Lieven d485997ad3 fix possible wrong cast to 32-bit unsigned
when calculation the max_offset the (unsigned) leads to a cast
to a 32-bit unsigned integer depending on the platform. as a result
we update the max_offset everytime when it grows beyond 2^32.
this leads to a wrong return max_offset value if the callbacks
are received out of order.

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-16 20:07:52 +01:00
Peter Lieven 2449d3f787 introduce nfs_fill_{READ,WRITE}3args
Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-16 20:07:44 +01:00
Peter Lieven 4d2f9f1132 fix potential overflow in nfs_pread_mcb
Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-16 20:07:39 +01:00
Ronnie Sahlberg 9a9566a3ee Improve error messages when READDIRPLUS emulation fails.
This addresses issue #62
2014-03-13 06:30:31 -07:00
Ronnie Sahlberg f66ff9931d Dont check for NFS errors in the LOOKUP during READDIRPLUS emulation
On servers with extended attributes, a server copuld be set up to
deny READ-ATTRIBUTES for the libnfs user.
This means that READDIRPLUS will no longer work since it will need to
stat() and thus READ-ATTRIBUTE in order to prepare the response.

Libnfs has READDIRPLUS emulation for the cases where this command fails
by switching to old READDIR to scan all the file names and then a LOOKUP loop for getting the file attributes.

Most of the time the purpose for this emulation is to handle the case where the server simply does not support READDIRPLUS at all, which sometimes is the case for embedded systems with userspace nfs servers.
In this case, where files just have READ-ATTRIBUTE deny for the libnfs user,
this will also fail and trigger the fallback to READDIR + LOOKUP-loop.

If the LOOKUP fails for this loop, then just ignore trying to update the attributes we have for this object, but do not fail the actual READDIRPLUS emulation.

This addresses a permissions issue reported by a XBMC user in issue #60
2014-03-12 21:00:08 -07:00
Ronnie Sahlberg 3af0c02237 Set default uid/gid to 65534/nobody for ANDROID 2014-03-12 19:31:20 -07:00
Ronnie Sahlberg b25c3aedde We only need to spend CPU computing a new error string IFF there was an error
when unmarshalling the reply.
2014-03-12 05:54:38 -07:00
Ronnie Sahlberg f0cb804219 Improve error reporting when unmarshalling of message headers fail. 2014-03-11 18:52:48 -07:00
Ronnie Sahlberg 479302f729 Add a new nfs_stat64() function that operates on a always-64-bit stat structure 2014-03-04 19:40:05 -08:00
Arne Redlich c8f0bac1bb nfs_pread_async: plug potential memleaks
Spotted by clang analyzer.

This also introduces asserts to help clang analyzer avoid reporting
false positives.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 19:00:47 -08:00
Arne Redlich 63d4a0583d nfs_write_async: plug potential memory leaks
Spotted by clang analyzer.

This also introduces asserts to help clang analyzer avoid
reporting false positives.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 19:00:19 -08:00
Arne Redlich 60af7e19d1 rpc_read_from_socket: fix use-after-free due to missing return
Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:59:44 -08:00