Commit Graph

1194 Commits (master)

Author SHA1 Message Date
Ronnie Sahlberg 53f87ada10 Handle TIMEOUT errors for the rpc layer errors in libnfs.c
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-06-15 14:44:26 -07:00
Ronnie Sahlberg 3ba14aabc2 Add timeout support in wait_for_nfs_reply
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-06-15 13:16:23 -07:00
Ronnie Sahlberg 128ac2f725 Update the event-loop for sync NFS commands to handle timeouts better.
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>
2017-05-31 21:23:03 -07:00
Ronnie Sahlberg b7fd060bc6 Do not fail the session just because the reply we got can not be matched to a pdu
The command might have simply timed out and this will not match anything in our
wait queue.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-31 21:06:36 -07:00
Ronnie Sahlberg 173ad2b1f3 Change how auto-reconnect works
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>
2017-05-31 19:46:18 -07:00
MilhouseVH eee1b4f7f2 use-after-free: quick hack 2017-05-14 16:18:05 -07:00
Ronnie Sahlberg 165e51a81b Merge pull request #217 from earlchew/issues-215
Only process pdus once when propagating cancellations or errors
2017-05-11 18:51:21 -07:00
Ronnie Sahlberg 6afd405587 Merge branch 'master' into issues-215 2017-05-11 18:51:13 -07:00
Ronnie Sahlberg a25e050172 Merge pull request #219 from earlchew/issues-216
Deliver poll(2) errors to callbacks when running the sync event loop
2017-05-11 18:32:22 -07:00
Ronnie Sahlberg f8ce80d454 Merge branch 'master' into issues-216 2017-05-11 18:30:30 -07:00
Ronnie Sahlberg f6895705c4 Merge pull request #220 from kevin-vigor/master
Fix crash on timed out mount-nfs calls.
2017-05-11 18:26:01 -07:00
Kevin Vigor 4cd723fb7a Fix crash on timed out mount-nfs calls.
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.
2017-05-11 15:19:01 -06:00
Earl Chew 5a2afb8872 Deliver poll(2) errors to callbacks when running the sync event loop
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-11 07:00:49 -07:00
Ronnie Sahlberg 79d1dc5ad7 Merge branch 'issues-212' of https://github.com/earlchew/libnfs into earlchew-issues-212
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-10 21:26:57 -07:00
Earl Chew ef8c67e81e Provide documentation for autoreconnect option
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-10 20:29:00 -07:00
Earl Chew f986a53835 Only process pdus once when propagating cancellations or errors
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-10 19:20:34 -07:00
Ronnie Sahlberg 0e37be0339 Document the new url argument to disable autoreconnect
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-10 18:28:51 -07:00
Ronnie Sahlberg 367ef3b189 Merge pull request #213 from earlchew/issues-212
Allow autoreconnect to be disabled
2017-05-10 18:13:56 -07:00
Ronnie Sahlberg 2db0878396 Use clock_gettime(CLOCK_MONOTONIC_COARSE) if/when available
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-10 18:11:00 -07:00
Ronnie Sahlberg 14adfbfc4b Merge pull request #211 from earlchew/issues-210
Check result of FSINFO before using result in nfs_mount_10_cb()
2017-05-09 22:26:23 -07:00
Ronnie Sahlberg d8d9e5556b Merge pull request #214 from earlchew/issues-206-01
Return an error if either readmax or writemax are less than NFSMAXDATA2
2017-05-09 22:07:18 -07:00
Earl Chew 2f041424d5 Return an error if either readmax or writemax are less than NFSMAXDATA2
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-09 21:55:03 -07:00
Earl Chew 5e43d0a92f Allow autoreconnect to be disabled
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-09 21:43:31 -07:00
Earl Chew 63d6679132 Check result of FSINFO before using result in nfs_mount_10_cb()
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-09 21:35:30 -07:00
Ronnie Sahlberg bf7d983812 Merge pull request #208 from earlchew/issues-200
Latch error return from nfs_mount_8_cb()
2017-05-09 21:29:22 -07:00
Earl Chew 6e99d36587 Latch error return from nfs_mount_8_cb()
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-09 21:22:46 -07:00
Earl Chew c7995b4fec Revert "Provide error return from nfs_mount_8_cb()"
This reverts commit a4de2ec926.

Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-09 21:22:06 -07:00
Ronnie Sahlberg 13c253673b We do not need an async version of readlink2
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-09 14:56:44 -07:00
Ronnie Sahlberg 973d368867 Merge pull request #194 from earlchew/issues-187
nfs_readlink2: Return symlink without incurring ENAMETOOLONG
2017-05-09 14:55:27 -07:00
Ronnie Sahlberg 519686356c Export the nfs_readlink2[_async] symbols from the win32/64 DLL
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-09 14:53:12 -07:00
Ronnie Sahlberg 0d955176de Changelog updates
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-09 14:51:37 -07:00
Ronnie Sahlberg ba44a82bc9 Merge branch 'master' of github.com:sahlberg/libnfs 2017-05-09 14:50:22 -07:00
Ronnie Sahlberg 0fcb574710 Merge pull request #203 from earlchew/issues-199
Free inbuf in rpc_destroy_context()
2017-05-09 14:50:12 -07:00
Ronnie Sahlberg ebd98bf966 Merge branch 'master' into issues-199 2017-05-09 14:49:58 -07:00
Ronnie Sahlberg a646519d68 Changelog updates
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-09 14:47:44 -07:00
Ronnie Sahlberg 36d5cf8a1c Merge pull request #204 from earlchew/issues-200
Provide error return from nfs_mount_8_cb()
2017-05-09 14:33:03 -07:00
Ronnie Sahlberg 5b28ab5d53 Include sys/sysmacros.h on platforms that have it
This addresses issue 202

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-09 14:30:14 -07:00
Earl Chew a4de2ec926 Provide error return from nfs_mount_8_cb()
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-09 07:15:11 -07:00
Earl Chew be6fd2b098 Free inbuf in rpc_destroy_context()
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-09 07:10:23 -07:00
Ronnie Sahlberg 43346ffd02 Make O_NONBLOCK and O_SYNC conditional if they have not yet been defined
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-08 22:33:45 -07:00
Earl Chew e74846219a nfs_readlink2: Return symlink without incurring ENAMETOOLONG
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-08 21:56:50 -07:00
Earl Chew e788078e20 Revert "nfs_readlink2: Return symlink without incurring ENAMETOOLONG"
This reverts commit 1af36b4c77.

Signed-off-by: Earl Chew <earl_chew@yahoo.com>
2017-05-08 21:55:54 -07:00
Ronnie Sahlberg 987638a384 Win32/64 does not have O_NOFOLLOW
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-08 21:11:00 -07:00
Ronnie Sahlberg ea3ee73e23 Merge pull request #192 from earlchew/issue-191
nfs_open: Support O_NOFOLLOW
2017-05-08 21:00:55 -07:00
Ronnie Sahlberg 15c7b4c33a Add mkdir2() to the symbols we export for win32/64
and will at some point restrict export to for .so libraries as well.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-08 20:54:36 -07:00
Ronnie Sahlberg 2589086ce5 Merge pull request #193 from earlchew/issues-189
nfs_mkdir2: Include permissions when creating a new directory
2017-05-08 20:52:55 -07:00
Ronnie Sahlberg 3ad4ac1b1e Merge branch 'master' of github.com:sahlberg/libnfs 2017-05-08 18:40:10 -07:00
Ronnie Sahlberg 10b102fef2 Update changelog
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-08 18:39:58 -07:00
Ronnie Sahlberg b5c5d5901e Add support for rpc timeouts to the async interface
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-08 18:38:42 -07:00
Ronnie Sahlberg 58ee12fcc7 Merge pull request #198 from earlchew/issues-197
Release callback data on nfs_create_2_cb() failure
2017-05-08 15:55:01 -07:00