summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2017-04-26 22:11:44 +0000
committerrmacklem <rmacklem@FreeBSD.org>2017-04-26 22:11:44 +0000
commitf3bdd48d1c3c2f2cda15fd4801f8f8c9dabdae26 (patch)
tree6ccf8a378c5d1d8f66af1fb807ed5f2197680059 /sys/fs
parent5240eda1f022379168b993714c314ab8fb78ea56 (diff)
downloadFreeBSD-src-f3bdd48d1c3c2f2cda15fd4801f8f8c9dabdae26.zip
FreeBSD-src-f3bdd48d1c3c2f2cda15fd4801f8f8c9dabdae26.tar.gz
MFC: r316717
During a server crash recovery, fix the NFSv4.1 client for a NFSERR_BADSESSION during recovery. If the NFSv4.1 client gets a NFSv4.1 NFSERR_BADSESSION reply to an Open/Lock operation while recovering from the server crash/reboot, allow the opens to be retained for a subsequent recovery attempt. Since NFSv4.1 servers should only reply NFSERR_BADSESSION after a crash/reboot that has lost state, this case should almost never happen. However, for the AmazonEFS file service, this has been observed when the client does a fresh TCP connection for RPCs.
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/nfsclient/nfs_clstate.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index 4ec42b9..e2c070a 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -1981,7 +1981,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *cred, NFSPROC_T *p)
op = LIST_FIRST(&owp->nfsow_open);
while (op != NULL) {
nop = LIST_NEXT(op, nfso_list);
- if (error != NFSERR_NOGRACE) {
+ if (error != NFSERR_NOGRACE && error != NFSERR_BADSESSION) {
/* Search for a delegation to reclaim with the open */
TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) {
if (!(dp->nfsdl_flags & NFSCLDL_NEEDRECLAIM))
@@ -2050,11 +2050,10 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *cred, NFSPROC_T *p)
len = NFS64BITSSET;
else
len = lop->nfslo_end - lop->nfslo_first;
- if (error != NFSERR_NOGRACE)
- error = nfscl_trylock(nmp, NULL,
- op->nfso_fh, op->nfso_fhlen, lp,
- firstlock, 1, lop->nfslo_first, len,
- lop->nfslo_type, tcred, p);
+ error = nfscl_trylock(nmp, NULL,
+ op->nfso_fh, op->nfso_fhlen, lp,
+ firstlock, 1, lop->nfslo_first, len,
+ lop->nfslo_type, tcred, p);
if (error != 0)
nfscl_freelock(lop, 0);
else
@@ -2066,10 +2065,10 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *cred, NFSPROC_T *p)
nfscl_freelockowner(lp, 0);
lp = nlp;
}
- } else {
- nfscl_freeopen(op, 0);
}
}
+ if (error != 0 && error != NFSERR_BADSESSION)
+ nfscl_freeopen(op, 0);
op = nop;
}
owp = nowp;
@@ -2100,7 +2099,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *cred, NFSPROC_T *p)
nfscl_lockinit(&nowp->nfsow_rwlock);
}
nop = NULL;
- if (error != NFSERR_NOGRACE) {
+ if (error != NFSERR_NOGRACE && error != NFSERR_BADSESSION) {
MALLOC(nop, struct nfsclopen *, sizeof (struct nfsclopen) +
dp->nfsdl_fhlen - 1, M_NFSCLOPEN, M_WAITOK);
nop->nfso_own = nowp;
OpenPOWER on IntegriCloud