Commit Graph

1194 Commits (master)

Author SHA1 Message Date
Ronnie Sahlberg 8f12f7f0a0 NFSv4: Add lseek() support.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-26 08:05:12 +10:00
Ronnie Sahlberg d39017a43a NFSv4: Add tests for truncate()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-26 01:47:07 +10:00
Ronnie Sahlberg 73b81297e7 NFSv4: Add support for ftruncate()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-26 01:31:25 +10:00
Ronnie Sahlberg 80d3f48199 NFSv4: Add support for fsync()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-26 01:07:22 +10:00
Ronnie Sahlberg ebc2f0a6c2 NFSv3: Add support for open(O_CREAT)
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-25 18:55:25 +10:00
Ronnie Sahlberg 8e1baa9d83 NFSv4: more nfs_op_* helpers to marshall compound command components
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-25 17:48:31 +10:00
Ronnie Sahlberg 81361d3aa3 NFSv4: re-work the nfs4_op_*() functions a bit and make them less overloaded
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-25 11:41:59 +10:00
Ronnie Sahlberg 2b6216dd6f NFSv4: add nfs_truncate() support
Rework the open() flow so we can append a extra callback to be invoked
once the open has completed.
Use this new feature to implement both nfs_truncate() as well as simplify
open(O_TRUNC) support.

Later this can be used for other commands too that need to open a path
and do something.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-25 10:37:07 +10:00
Ronnie Sahlberg 3928dac482 NFSv4: Update the way we increment seqid
RFC3530 8.1.5 decribes when we hould bump eqid
and when not to.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-21 10:53:29 +10:00
Ronnie Sahlberg cea99f8ed5 NFSv4: Add support for opendir()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-20 09:08:46 +10:00
Ronnie Sahlberg f1c7b96610 NFSv4: We only need 18 events to stat a file in v4. Update the timeout test.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-15 20:15:43 +10:00
Ronnie Sahlberg bd95371005 NFSv4: Add support for mknod()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-15 20:05:47 +10:00
Ronnie Sahlberg de9da5689d NFSv4: Add rename() support.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-14 09:20:08 +10:00
Ronnie Sahlberg 840c9b7367 NFSv4: Standardize how we create cb data for split path lookups.
Split path lookups is where we have a path '/this/is/the/path'
and we split it up into doing a lookup on '/this/is/the'
and append a different operation on 'path'.

Create a dedicated function that performs this initialization
and remove a lot of code duplication.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-11 06:24:53 +10:00
Ronnie Sahlberg a72dbc248d NFSv4: change populate_getattr to populate_getfh
The two functions are identical but in this case it is the fh we are
interested in and not the attributes.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-09 19:17:16 +10:00
Ronnie Sahlberg ffafa5fd9c NFSv4: add nfs_link() support.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-08 20:47:22 +10:00
Ronnie Sahlberg 352325169c NFSv4: Add support for nfs_unlink()
This function is identical to nfs_rmdir() so create a common
function that we call from both unlink and rmdir.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-06 19:24:05 +10:00
Ronnie Sahlberg 9854c0d574 NFSv4: Add support for open_create() by plumbing it into open(O_CREAT)
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-06 19:15:04 +10:00
Ronnie Sahlberg efb21535ab NFSv4: Use nfs->mask when create the default mode for open(O_CREAT)
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-06 18:57:55 +10:00
Ronnie Sahlberg 65a0110476 NFSv4: Add support for open(O_CREAT)
Add support for O_CREAT for NFSv4. Note, it is not implemented for NFSv3.
While it creates files we still need to add plumbing to get umask
implemented or else all files created will have mode 0.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-06 18:43:28 +10:00
Ronnie Sahlberg 0ce4917afd nfs_open2(): Add a new nfs_open2() function that takes a mode argument.
Pass mode all the way down to nfs*_open_async() but we do not yet have any
plumbing to actually use it. That will come later as we implement O_CREAT
support.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-06 16:02:39 +10:00
Ronnie Sahlberg 8c59fe7f24 NFSv4: Create a nice free-er function for the lookup blob
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-06 15:50:26 +10:00
Ronnie Sahlberg 17cf8d39fa NFSv4: Document how to run the tests for NFSv4
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-06 09:11:58 +10:00
Ronnie Sahlberg 65de83140a NFSv4: Add support (and tests) for open(O_APPEND)
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-03 20:25:59 +10:00
Ronnie Sahlberg 2ce8890458 NFSv4: Add open(O_SYNC) support
Also update close() so we only send a COMMIT if there is still
unstaged data written.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-30 09:44:31 +10:00
Ronnie Sahlberg 42d14779b7 NFSv4: Add support for open(O_TRUNC)
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-30 08:36:18 +10:00
Ronnie Sahlberg 61e071d448 NFSv4: Add support for nfs_[p]write()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-29 19:52:41 +10:00
Ronnie Sahlberg 5c73d788b1 NFSv4: Populate functions should return how many operations they did append.
The populate functions will soon start appending varying number of operations.
For examle the case of open(O_TRUNC) where we would append an extra
SETATTR(size=0) at the end of the compound chain.

Thus use the number of ops that the populate function retured for when
we compute the length of the compound chain instead of assuming it is always
a constant.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-29 09:27:35 +10:00
Ronnie Sahlberg 5a78bd5a7a NFSv4: Update nfs_open() to support symlinks
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-28 19:39:27 +10:00
Ronnie Sahlberg 9f44b157f0 NFSv4: fix compiler warnings
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-27 07:28:23 +10:00
Ronnie Sahlberg 4fa3b4b258 NFSv4: Always send a GETATTR as part of the path lookup
Send a GETATTR for the final component in the path lookup so that
we can detect and act on it being a symlink.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-27 07:16:18 +10:00
Ronnie Sahlberg 5c2d989887 NFSv4: Add support for readlink()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-26 14:26:29 +10:00
Ronnie Sahlberg f3211e9be5 NFSv4 Add support for symlink()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-26 14:26:29 +10:00
Ronnie Sahlberg dce044ab53 NFSv4: Add support for read() and pread()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-26 14:26:29 +10:00
Ronnie Sahlberg 0d9dd0ee44 NFSv4 Add support for nfs_open() nfs_fstat64() nfs_close()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-26 14:26:29 +10:00
Ronnie Sahlberg 93fbecd7c1 NFSv4 Add support for nfs_rmdir()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-14 07:04:28 +10:00
Ronnie Sahlberg 8a9fceb725 NFSv4: Add support for nfs_mkdir2()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-13 23:04:35 +10:00
Ronnie Sahlberg 3ced39f567 Rework the NFSv4 path lookup framework so it handles symlinks properly.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-13 18:22:27 +10:00
Ronnie Sahlberg df94ae931a pdu->timeout needs to be uint64_t
pdu->timeout is the timeout for for the pdu using the unix epoch but
expressed in ms, not seconds.
As such it must be 64 bit as on 32 bit we would have already wrapped the
timer.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-08 17:08:17 +10:00
Ronnie Sahlberg 419e196979 rpc->timeout does not need to be 64 bit
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-08 16:46:24 +10:00
Ronnie Sahlberg dc9669abd5 Fix compiler warnings about cast from char* -> uint32_t*
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-08 16:33:55 +10:00
Ronnie Sahlberg 8df917633d TESTS: Tweak timeout test settings
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-08 15:00:23 +10:00
Ronnie Sahlberg 5a6865c7ab Change the paths for the nfs includes from libnfs-private.h
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-08 14:34:29 +10:00
Ronnie Sahlberg 5159b76e00 NFSv4: add support for nfs_lstat64()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-08 13:46:28 +10:00
Ronnie Sahlberg 0d95058e4e TESTS: Add tests for nfs_lstat64()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-08 13:38:32 +10:00
Ronnie Sahlberg 546c9455c7 Don't use random()/srandom()
We can create a initial verifier that is good enough by just using
the current time and the pid.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-08 12:58:31 +10:00
Ronnie Sahlberg 825d8c2aa3 WIN32: Update the project file with nfs_v4.c (and the renamed nfs_v3.c)
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-08 10:04:22 +10:00
Ronnie Sahlberg 4cb34e2c9a Merge branch 'nfsv4' 2017-07-08 09:58:11 +10:00
Ronnie Sahlberg fc677be6a3 Bump the pdu timeout by 1000ms when we do not have clock_gettime()
If we fallback to time() we have 1 second granularity of our timestamps.
Thus we need to bump the pdu timestamp we set by this granularity or
the timeout will trigger too early.

For a 1s timeout, this means that we now will trigger the timeout between
1.0 - 2.0 seconds instead of the previous  0.0 - 1.0 seconds.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-07-08 09:55:14 +10:00
Chris Richards fb1efbe51c Increased resolution of PDU timeout from seconds to milliseconds 2017-07-08 09:47:51 +10:00