diff options
author | Rick Macklem <rmacklem@FreeBSD.org> | 2022-07-10 20:56:38 +0000 |
---|---|---|
committer | Rick Macklem <rmacklem@FreeBSD.org> | 2022-07-10 20:56:38 +0000 |
commit | 8f4a5fc6bc6c4e9e0739326199d73ee4401ebd58 (patch) | |
tree | e5f53a919957e4c767360a1dd8b4063f490ec8b6 | |
parent | 981ef32230b2fe46969c90b53864bdca4f1c3ae5 (diff) | |
download | src-8f4a5fc6bc6c4e9e0739326199d73ee4401ebd58.tar.gz src-8f4a5fc6bc6c4e9e0739326199d73ee4401ebd58.zip |
nfscl: Do not call nfscl_hasexpired() for NFSv4.1/4.2
Commit 981ef32230b2 enabled marking of potentially bad
session slots when an RPC is interrupted if the "intr"
mount option is used. As such, it no longer makes
sense to call nfscl_hasexpired() for I/O operations that
reply NFSERR_BADSTATEID for NFSv4.1/4.2, which does a full
recovery of NFSv4 open state, destroying all byte range locks.
Recovery of open state should not be usually needed, since
the session slot has been marked potentially bad and,
although opens for the process that has been terminated via
a signal may be broken, locks for other processes will still
be valid.
This patch disables calls to nfscl_hasexpired for NFSv4.1/4.2
mounts, when I/O RPCs receive NFSERR_BADSTATEID replies.
It does not affect the behaviour of NFSv4.0 mounts nor
hard (non "intr") mounts.
PR: 260011
MFC after: 2 weeks
-rw-r--r-- | sys/fs/nfsclient/nfs_clrpcops.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index ffb81b699017..187136746e3a 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -1333,8 +1333,12 @@ nfsrpc_setattr(vnode_t vp, struct vattr *vap, NFSACL_T *aclp, error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) { (void) nfs_catnap(PZERO, error, "nfs_setattr"); } else if ((error == NFSERR_EXPIRED || - error == NFSERR_BADSTATEID) && clidrev != 0) { + ((!NFSHASINT(nmp) || !NFSHASNFSV4N(nmp)) && + error == NFSERR_BADSTATEID)) && clidrev != 0) { expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p); + } else if (error == NFSERR_BADSTATEID && NFSHASINT(nmp) && + NFSHASNFSV4N(nmp)) { + error = EIO; } retrycnt++; } while (error == NFSERR_GRACE || error == NFSERR_STALESTATEID || @@ -1732,8 +1736,12 @@ nfsrpc_read(vnode_t vp, struct uio *uiop, struct ucred *cred, error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) { (void) nfs_catnap(PZERO, error, "nfs_read"); } else if ((error == NFSERR_EXPIRED || - error == NFSERR_BADSTATEID) && clidrev != 0) { + ((!NFSHASINT(nmp) || !NFSHASNFSV4N(nmp)) && + error == NFSERR_BADSTATEID)) && clidrev != 0) { expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p); + } else if (error == NFSERR_BADSTATEID && NFSHASINT(nmp) && + NFSHASNFSV4N(nmp)) { + error = EIO; } retrycnt++; } while (error == NFSERR_GRACE || error == NFSERR_STALESTATEID || @@ -1904,8 +1912,12 @@ nfsrpc_write(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) { (void) nfs_catnap(PZERO, error, "nfs_write"); } else if ((error == NFSERR_EXPIRED || - error == NFSERR_BADSTATEID) && clidrev != 0) { + ((!NFSHASINT(nmp) || !NFSHASNFSV4N(nmp)) && + error == NFSERR_BADSTATEID)) && clidrev != 0) { expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p); + } else if (error == NFSERR_BADSTATEID && NFSHASINT(nmp) && + NFSHASNFSV4N(nmp)) { + error = EIO; } retrycnt++; } while (error == NFSERR_GRACE || error == NFSERR_DELAY || @@ -2196,9 +2208,11 @@ nfsrpc_deallocate(vnode_t vp, off_t offs, off_t len, struct nfsvattr *nap, error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY || error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) { (void) nfs_catnap(PZERO, error, "nfs_deallocate"); - } else if ((error == NFSERR_EXPIRED || - error == NFSERR_BADSTATEID) && clidrev != 0) { + } else if ((error == NFSERR_EXPIRED || (!NFSHASINT(nmp) && + error == NFSERR_BADSTATEID)) && clidrev != 0) { expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p); + } else if (error == NFSERR_BADSTATEID && NFSHASINT(nmp)) { + error = EIO; } retrycnt++; } while (error == NFSERR_GRACE || error == NFSERR_STALESTATEID || @@ -7415,9 +7429,11 @@ nfsrpc_allocate(vnode_t vp, off_t off, off_t len, struct nfsvattr *nap, error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY || error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) { (void) nfs_catnap(PZERO, error, "nfs_allocate"); - } else if ((error == NFSERR_EXPIRED || - error == NFSERR_BADSTATEID) && clidrev != 0) { + } else if ((error == NFSERR_EXPIRED || (!NFSHASINT(nmp) && + error == NFSERR_BADSTATEID)) && clidrev != 0) { expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p); + } else if (error == NFSERR_BADSTATEID && NFSHASINT(nmp)) { + error = EIO; } retrycnt++; } while (error == NFSERR_GRACE || error == NFSERR_DELAY || @@ -8515,10 +8531,12 @@ nfsrpc_copy_file_range(vnode_t invp, off_t *inoffp, vnode_t outvp, error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY || error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) { (void) nfs_catnap(PZERO, error, "nfs_cfr"); - } else if ((error == NFSERR_EXPIRED || - error == NFSERR_BADSTATEID) && clidrev != 0) { + } else if ((error == NFSERR_EXPIRED || (!NFSHASINT(nmp) && + error == NFSERR_BADSTATEID)) && clidrev != 0) { expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, curthread); + } else if (error == NFSERR_BADSTATEID && NFSHASINT(nmp)) { + error = EIO; } retrycnt++; } while (error == NFSERR_GRACE || error == NFSERR_DELAY || @@ -8692,10 +8710,12 @@ nfsrpc_seek(vnode_t vp, off_t *offp, bool *eofp, int content, error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY || error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) { (void) nfs_catnap(PZERO, error, "nfs_seek"); - } else if ((error == NFSERR_EXPIRED || - error == NFSERR_BADSTATEID) && clidrev != 0) { + } else if ((error == NFSERR_EXPIRED || (!NFSHASINT(nmp) && + error == NFSERR_BADSTATEID)) && clidrev != 0) { expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, curthread); + } else if (error == NFSERR_BADSTATEID && NFSHASINT(nmp)) { + error = EIO; } retrycnt++; } while (error == NFSERR_GRACE || error == NFSERR_STALESTATEID || |