Commit 77c595ce authored by Rick Macklem's avatar Rick Macklem
Browse files

nfscl: Add an argument to nfscl_tryclose()

This patch adds a new argument to nfscl_tryclose() to indicate
whether or not it should loop when a NFSERR_DELAY reply is received
from the NFSv4 server.  Since this new argument is always passed in
as "true" at this time, no semantics change should occur.

This is being done to prepare the code for a future patch that fixes
the case where an NFSv4.1/4.2 server replies NFSERR_DELAY to a Close
operation.

MFC after:	2 week
parent 2e85df65
......@@ -631,7 +631,7 @@ void nfscl_deleggetmodtime(vnode_t, struct timespec *);
int nfscl_trydelegreturn(struct nfscldeleg *, struct ucred *,
struct nfsmount *, NFSPROC_T *);
int nfscl_tryclose(struct nfsclopen *, struct ucred *,
struct nfsmount *, NFSPROC_T *);
struct nfsmount *, NFSPROC_T *, bool);
void nfscl_cleanup(NFSPROC_T *);
int nfscl_layout(struct nfsmount *, vnode_t, u_int8_t *, int, nfsv4stateid_t *,
int, int, struct nfsclflayouthead *, struct nfscllayout **, struct ucred *,
......
......@@ -841,7 +841,7 @@ nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p)
nfscl_lockexcl(&op->nfso_own->nfsow_rwlock, NFSCLSTATEMUTEXPTR);
NFSUNLOCKCLSTATE();
do {
error = nfscl_tryclose(op, tcred, nmp, p);
error = nfscl_tryclose(op, tcred, nmp, p, true);
if (error == NFSERR_GRACE)
(void) nfs_catnap(PZERO, error, "nfs_close");
} while (error == NFSERR_GRACE);
......
......@@ -2399,7 +2399,7 @@ nfscl_recover(struct nfsclclient *clp, bool *retokp, struct ucred *cred,
LIST_FOREACH_SAFE(op, &extra_open, nfso_list, nop) {
do {
newnfs_copycred(&op->nfso_cred, tcred);
error = nfscl_tryclose(op, tcred, nmp, p);
error = nfscl_tryclose(op, tcred, nmp, p, true);
if (error == NFSERR_GRACE)
(void) nfs_catnap(PZERO, error, "nfsexcls");
} while (error == NFSERR_GRACE);
......@@ -4506,24 +4506,24 @@ nfscl_trydelegreturn(struct nfscldeleg *dp, struct ucred *cred,
*/
int
nfscl_tryclose(struct nfsclopen *op, struct ucred *cred,
struct nfsmount *nmp, NFSPROC_T *p)
struct nfsmount *nmp, NFSPROC_T *p, bool loop_on_delayed)
{
struct nfsrv_descript nfsd, *nd = &nfsd;
int error;
do {
error = nfsrpc_closerpc(nd, nmp, op, cred, p, 0);
if (error == NFSERR_DELAY)
if (loop_on_delayed && error == NFSERR_DELAY)
(void) nfs_catnap(PZERO, error, "nfstrycl");
} while (error == NFSERR_DELAY);
} while (loop_on_delayed && error == NFSERR_DELAY);
if (error == EAUTH || error == EACCES) {
/* Try again using system credentials */
newnfs_setroot(cred);
do {
error = nfsrpc_closerpc(nd, nmp, op, cred, p, 1);
if (error == NFSERR_DELAY)
if (loop_on_delayed && error == NFSERR_DELAY)
(void) nfs_catnap(PZERO, error, "nfstrycl");
} while (error == NFSERR_DELAY);
} while (loop_on_delayed && error == NFSERR_DELAY);
}
return (error);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment