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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>