From nobody Sun Jul 10 20:59:38 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4CBC117FD3D9; Sun, 10 Jul 2022 20:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Lgzsl1gzsz3tNC; Sun, 10 Jul 2022 20:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657486779; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MpsO5PUpC7tt7lZr/lphL5PIpMtdrt8gToXIVJJpaEw=; b=jAnqLsBus36BlojkXizoYmi3BuYfdeRAdEVLuZiHbcOmWJeVm/d5FDb3sqYZCgupysu0aj 17L/jIYvTsbth2OKTMUJy4c0eLfkENMDxscT5PwZNrJU2nMD+Q4ySq/bPsq225/QJ9X44y Wtea5XytCiitfXnzriVyH3vlJjKdAR6ga9sb3lmRca7glMR+Va50nY5TOXeJurTO9pk4QR oKtYqgGBt+RuJEGWI+ppnLPjrSuApolB62bPudikPayzANTYPm4P7JzS79pF6UUKZXpNE7 bi+vhW0P/Axvvu1egvwrJT3XpcP9xhiD5Q85MFo9fctoey8ZfVTvMtuE2gaDCQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Lgzsl0jcqzdpl; Sun, 10 Jul 2022 20:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26AKxdKl031269; Sun, 10 Jul 2022 20:59:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26AKxcfi031268; Sun, 10 Jul 2022 20:59:38 GMT (envelope-from git) Date: Sun, 10 Jul 2022 20:59:38 GMT Message-Id: <202207102059.26AKxcfi031268@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 8f4a5fc6bc6c - main - nfscl: Do not call nfscl_hasexpired() for NFSv4.1/4.2 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8f4a5fc6bc6c4e9e0739326199d73ee4401ebd58 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657486779; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MpsO5PUpC7tt7lZr/lphL5PIpMtdrt8gToXIVJJpaEw=; b=iMCFcWl9AlIzdHii5M0hQR2f8MkHoFvn11oWaAp2P+TuEI5P6A7MhG4UkXftQsSIIQIEvy M0DjjK3pgBScNRjUK1xbnG7p9CLeD5SmMtYw/c0AJutNohoFexoeEX14qwgW1d9CyCahCW PWOF/kZBkPjSqwwxClvsHpc9bIjbVbuYuy/b3qKEgqQ+dZPmEKMmWIdABxu5rfnYVh06Hy RWTa2K7VKOm4mX48gb4d/4Qr325pxQbkLLWns2q2vDwUYVzv2tgxRgyZGY08m7YI7VY2S0 kPgYcPUUtO+YNdFILhTESdtD/v1wSewAz61f9wCm9a4SqTuWevfsgBgOblBWsQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657486779; a=rsa-sha256; cv=none; b=Ro9II5sJK/yi8tMpzZ4qgZQNgeLTngwGgepka3tGVbscK61ur6ttbifj9aYOY04sO18EsR e1b/AIjfyHCtvUHfxdWKAjq82L0OyHeAYEafcspz0UziTgU2bAgDKuNJk1PFU1I1mMSq+6 E8RPNigvjYmG0Pa2X5EGQHqAkPD0saxJ6h8hF0ZOwva2sp9yDIMQGhC2UxXmkZlxXypCNu Pv/zrTmjZqfJui64ct35oSTW+ej4JXrYI1Rc3m4YC5RMA3OfMwKT4IS78TLYsaTfRgpWxJ wSVWyYPS4p9D3v/0DziovorcgTFh86WAYfeCZN7yaK96o77p9PTEp6EmZYL4yA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=8f4a5fc6bc6c4e9e0739326199d73ee4401ebd58 commit 8f4a5fc6bc6c4e9e0739326199d73ee4401ebd58 Author: Rick Macklem AuthorDate: 2022-07-10 20:56:38 +0000 Commit: Rick Macklem CommitDate: 2022-07-10 20:56:38 +0000 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 --- sys/fs/nfsclient/nfs_clrpcops.c | 42 ++++++++++++++++++++++++++++++----------- 1 file 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 ||