From nobody Sun Oct 22 01:34:56 2023 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 4SCgqP0q5xz4xr9C; Sun, 22 Oct 2023 01:34:57 +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 4SCgqP0GFdz4GKT; Sun, 22 Oct 2023 01:34:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697938497; 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=nXx7t+mkrS+CXVfi7KoSeYKC2rqQhJYPxW5mwdTe5js=; b=vSedZJ6HCum0WbZ258XGnjIrT/Sb4/z6AEyLHgPqClb6xWeToGFrcf2e9Jk/w+EVhkUMZU RQSFsUcJ8YOXgzh2qyYac0d+nr6xoKR6hRsx5+dqWtu13++DeAuxW14DTi2H+EoSBElcDK nyTw3RM7AuB2ovwlUGNFpZqJZYBjqCCDdR0d9gQi7q52MjAAUWyN7osqVmsQHSoGA9rI7e PKAonkeDJhu3qEVB8ou9w5ypjXzNnvF9WQiJKB3Z07k6XQG3AGQsCWlA2/+qIoTJzFJ+n8 3BX2eFvkn6OxVXQnZyuTdOMIjHOVpWbkRp0HwqWTwOhFlfbIvjCKr6Dbmz0f5w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697938497; a=rsa-sha256; cv=none; b=QHGo6hg0HWXOZoIld/5ZQd6lOyHorx1sIEfqf9uED4U8n8ajfO3+2uP3DoRdBRn49dmcdV B/aCgwrQ9Raa8mO1rbZxmRisNwrMSTpJcoeZUaTVtbIdnoZHtHjcuOZb5uu6pBFlQSxZSB HUVLvqglpHTfxgk65AGUmZEysttT1odMS47SGe7aCCND1IHzAMHJ4kHJ5RVtF8CZLLX8t1 IHLUApLTZlBRFnR9wZmJnLx4+bU/7cUQF6tqX3+Hrrrfq9YjxhoH9iUPJLJZyvG40kYQgq 9LA+q6kKS6a1ogukWkzdjTEZHYroeCjFSbMNjb7xs7wt6+wFWKnGc/wuo7DSsg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697938497; 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=nXx7t+mkrS+CXVfi7KoSeYKC2rqQhJYPxW5mwdTe5js=; b=v9FFtGO8PXXlNOVyZl8yyAG//p5BV8sUjr+zGr83AGUxUIRmisl2r44qYk6Y/xLFpD6KEV Otzk3hvwIBg9akpF0/tY5Pm896ksa09s32ExVYHo4uz61rWQSX/TAIRXIVkSVJ1TYy5pap LzvyBBLOsWINlCMb757wQd69vjV3LaIUNfrLO5+RBdsjFH4ziTQjodkOfuNPqO358h3xVv QRPi1tSt6Yg5M9yHAiv+27kIeZScowS8fd7ZZlRzONsICp/ZFGRz72DRxJUTAMiLljlVhC 9by1HIgdD+RM2++UqMES+vYvWVKOw6XJGU1QbJPz8plZ2mbnecUuYC9pTzZjgQ== 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 4SCgqN6Qjhzdpv; Sun, 22 Oct 2023 01:34:56 +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 39M1YuBt083870; Sun, 22 Oct 2023 01:34:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39M1YuIl083867; Sun, 22 Oct 2023 01:34:56 GMT (envelope-from git) Date: Sun, 22 Oct 2023 01:34:56 GMT Message-Id: <202310220134.39M1YuIl083867@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: 14bbf4fe5abb - main - nfscl: Handle a Getattr failure with NFSERR_DELAY following Open 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: 14bbf4fe5abb20f1126168e66b03127ae920f78e Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=14bbf4fe5abb20f1126168e66b03127ae920f78e commit 14bbf4fe5abb20f1126168e66b03127ae920f78e Author: Rick Macklem AuthorDate: 2023-10-22 01:33:33 +0000 Commit: Rick Macklem CommitDate: 2023-10-22 01:33:33 +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). MFC after: 1 month --- 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 2276e09f6e7e..87362f2e744f 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -609,7 +609,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++; @@ -681,16 +682,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,