From nobody Wed Nov 22 00:04:32 2023 X-Original-To: dev-commits-src-all@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 4SZhLm4mWBz51M15; Wed, 22 Nov 2023 00:04:32 +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 4SZhLm4D14z4Y6n; Wed, 22 Nov 2023 00:04:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700611472; 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=2RP++nWCGgw95fvvNigYMTScWbmXSQ5qpvjnfSG9rWQ=; b=KVAAC3fnJKYOYuS7tbBmBGkTh988LhYjPt09Pj6ZLhytJYFkUioo+/+OUJo2xJbRmNgGv4 ZM2xVr1K2m+Hxj/5XrKNIfT04lZGayPdNJdekrX3jFP9xZFszu8O9yv+4/y//LYC5OrkIi bbg4Iw6AUsk+wgJnw3DQN+vzIU2wj52pfTSEyv37kIAg4ykL/Z3uaiHbwSLIjVKRW0RUXG qtc0SjMqZ6QYqqoRG4nJ2gQS82/QScI0w1VVpHJTvzGsZw+0NnWo78EnPfs/64SWxN6F8b LvsUZUSNYFinojndM3masbVXjOxugkkSJCMwiRil6gANmYYliXynW4DzgLAx4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700611472; 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=2RP++nWCGgw95fvvNigYMTScWbmXSQ5qpvjnfSG9rWQ=; b=TUchdfxjM3+1lATNJMcQXzivrKPBAr0m/8sBRjYM529R/+pJ/r4qe4DYA0C/yndVofMB0N GUqCe5sliBwylODfX2I0fBGd96KXqCRGhRZpADjcTo9kk360WM666WlWDZok5F2TxgjeBS n5fQt95/ROd6rxX03I7egb3GU5RE98yG4Lbt+XlVF5CTbLNQ/iCewuYaL9jE2UEsknG3bC AJ/c0aHpt29Nh/T8Ng1eYCispYrqxCZZotuyK5Ws54URxFYY4btCwlj6PPaHUZBxW1LZMV k70RDep5AVb7AP+kX4Bk2xR/oqBCAgwOgz6MPeU7ip501Eva4+Zrdf4AC4PVZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700611472; a=rsa-sha256; cv=none; b=Y5FPQYeGJqkyK94pGSv30uFUT8ieeLFeyZVSQrQtpZJ8LxHBLVQAkplZ8yuWI1g8oPmXkR QUQgnGouRStBVg1nTpPJ49LXtbQEzFX7AM0mWaj+xq54tVvfij3SSSW6d0FHvCRfJztBdT c8dlCJR9RjqzP27DblUVnloz6xY9xSZIWuSm7areMlDq6WzdLIgrLW1kAvxn9IBMFT6WEg Air71itJ5OWFz+OKS4LKY8IdIKYx7PXVwEYd9ODs7m02tXFgRrqTfMoCC1A6aU5MOn1vNJ RmpW1+kwK/ARPeZEB3YIRqA+cN9Wy4So1SZitrD1TIwYy0KAhNZoahMeXbYJDA== 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 4SZhLm3H5wzwrS; Wed, 22 Nov 2023 00:04:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3AM04WYT098053; Wed, 22 Nov 2023 00:04:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AM04Wm4098050; Wed, 22 Nov 2023 00:04:32 GMT (envelope-from git) Date: Wed, 22 Nov 2023 00:04:32 GMT Message-Id: <202311220004.3AM04Wm4098050@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 3ab7f15d9116 - stable/13 - nfscl: Handle a Getattr failure with NFSERR_DELAY following Open List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3ab7f15d91160b4ac3369f6c3bc696ba9bf88afc Auto-Submitted: auto-generated The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=3ab7f15d91160b4ac3369f6c3bc696ba9bf88afc commit 3ab7f15d91160b4ac3369f6c3bc696ba9bf88afc Author: Rick Macklem AuthorDate: 2023-10-22 01:33:33 +0000 Commit: Rick Macklem CommitDate: 2023-11-22 00:03:11 +0000 nfscl: Handle a Getattr failure with NFSERR_DELAY following Open During testing at a recent IETF NFSv4 Bakeathon, a non-FreeBSD server was rebooted. After the reboot, the FreeBSD client sent an Open/Claim_previous with a Getattr after the Open in the same compound. The Open/Claim_previous was done to recover the Open and a Delegation for for a file. The Open succeeded, but the Getattr after the Open failed with NFSERR_DELAY. This resulted in the FreeBSD client retrying the entire RPC over and over again, until the server's recovery grace period ended. Since the Open succeeded, there was no need to retry the entire RPC. This patch modifies the NFSv4 client side recovery Open/Claim_previous RPC reply handling to deal with this case. With this patch, the Getattr reply of NFSERR_DELAY is ignored and the successful Open reply is processed. This bug will not normally affect users, since this non-FreeBSD server is not widely used (it may not even have shipped to any customers). (cherry picked from commit 14bbf4fe5abb20f1126168e66b03127ae920f78e) --- sys/fs/nfsclient/nfs_clrpcops.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index be702e703c91..569132aee43c 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -569,7 +569,8 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int8_t *nfhp, int fhlen, if (error) return (error); NFSCL_INCRSEQID(op->nfso_own->nfsow_seqid, nd); - if (!nd->nd_repstat) { + if (nd->nd_repstat == 0 || (nd->nd_repstat == NFSERR_DELAY && + reclaim != 0 && (nd->nd_flag & ND_NOMOREDATA) == 0)) { NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID + 6 * NFSX_UNSIGNED); op->nfso_stateid.seqid = *tl++; @@ -641,16 +642,29 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int8_t *nfhp, int fhlen, goto nfsmout; } NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - error = nfsv4_loadattr(nd, NULL, &nfsva, NULL, - NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, - NULL, NULL, NULL, p, cred); - if (error) - goto nfsmout; + /* If the 2nd element == NFS_OK, the Getattr succeeded. */ + if (*++tl == 0) { + KASSERT(nd->nd_repstat == 0, + ("nfsrpc_openrpc: Getattr repstat")); + error = nfsv4_loadattr(nd, NULL, &nfsva, NULL, + NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, + NULL, NULL, NULL, p, cred); + if (error) + goto nfsmout; + } if (ndp != NULL) { - ndp->nfsdl_change = nfsva.na_filerev; - ndp->nfsdl_modtime = nfsva.na_mtime; - ndp->nfsdl_flags |= NFSCLDL_MODTIMESET; + if (reclaim != 0 && dp != NULL) { + ndp->nfsdl_change = dp->nfsdl_change; + ndp->nfsdl_modtime = dp->nfsdl_modtime; + ndp->nfsdl_flags |= NFSCLDL_MODTIMESET; + } else if (nd->nd_repstat == 0) { + ndp->nfsdl_change = nfsva.na_filerev; + ndp->nfsdl_modtime = nfsva.na_mtime; + ndp->nfsdl_flags |= NFSCLDL_MODTIMESET; + } else + ndp->nfsdl_flags |= NFSCLDL_RECALL; } + nd->nd_repstat = 0; if (!reclaim && (rflags & NFSV4OPEN_RESULTCONFIRM)) { do { ret = nfsrpc_openconfirm(vp, newfhp, newfhlen, op,