From nobody Thu Jun 09 19:24:18 2022 X-Original-To: dev-commits-src-branches@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 D5FA583818D; Thu, 9 Jun 2022 19:24:18 +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 4LJvD25RfWz3D2n; Thu, 9 Jun 2022 19:24:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654802658; 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=xl3w2uoaIprlG2tEqdEse021/ijfLJ8OsZPcctTECCk=; b=tlh4OkDao5K1QukYAhRbAQiNancnCnGFWtE8Hal+Io9SlHA7rSJE45tgpOsVYtyNakTH53 5g62H86+Y+yvYUr8tCNgId3seFNhiQmU0cemc04KAs8uiFEMe0he3liez14H0XNwoR2U2b dYZjdSNNkBCqy+KqfzIEjwyqEmH9IyyBpdAKxWLZyUGM1Go/M1pznNWnw0D53VTAjIb/yl V8l4admxmwjzerry6w83VRL55pO2PPZgCzxOEx7unNKVJex+HuqdUPL2uuh6dGNei2YgPN wI8aXwYGAIvMzgKnBcYuarZnEnY7TAzOTl7Tw5iHRrp62fBbQcQvXe+Wl6UUOw== 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 9AAB01DF2; Thu, 9 Jun 2022 19:24:18 +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 259JOIhI027923; Thu, 9 Jun 2022 19:24:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 259JOIdT027922; Thu, 9 Jun 2022 19:24:18 GMT (envelope-from git) Date: Thu, 9 Jun 2022 19:24:18 GMT Message-Id: <202206091924.259JOIdT027922@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: 23584132c48c - stable/13 - nfscl: Add support for a NFSv4 AppendWrite RPC List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: 23584132c48c55f171e6b3218bbadc26c141d41d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654802658; 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=xl3w2uoaIprlG2tEqdEse021/ijfLJ8OsZPcctTECCk=; b=VCm4PLYYuLCmJm1GjoKbeyeXXMVIDiEMOb5OzERqq6sm5d3TyZC0As8FJRRv3+UR8cSlPD 5B2JydnWCjlS54GnbAe2LUwsNDhb+yAROlLALJFGgO4HDpv7epNjqWgqSEJXl4QArBuvwH 5KOR4F79e8FawfK8eHnN9Oaa6ZuZtujzbZvvRNG4gfXcGeTv5Fq+an0brdQq21p45jEQhY uKqMNHGPpgOrbAI2cXzjZTwxtj7HeZdkb0kON22GE5sIkeY3EodnxCzut33GsQFrTuCEhE 4DtcEfgdgdXYfc698A6WYisce9hwbMSC5/p45MMgNxdS4TqXJFInxEFVIJ2mlA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654802658; a=rsa-sha256; cv=none; b=N6FpUy32Y577Un9q8o2fDeSwBW3Wgh0a/lEJ5Qs4j/+S5Uwhl/jxnnzf1Sc5/yo/lmKnn3 Xtim2NwxAP5IlPFNZkCuCA/RMA1mWJi8DPb71gVEfELuj+vCbWOs9ihgiSTfdn0mnHb6RD FN5zmeWOy/LNteGLnv74LBbSji2Y9oAmyU8aLsq6vEsK4zjJPbaajjH0PSsGWK76m/MQKC 10A8wErvT7gSMvGRQOFbJ/ToYrDYQKPlozjMWCRgsHnOlYpTYO5YnQ9HO/9G9/brwnHqYt EZEyIFqqlqWRxqxAWFrXFspuTdVVrx2aRFRLywEQzj2inQsyXzQNfzOJsnxCOw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=23584132c48c55f171e6b3218bbadc26c141d41d commit 23584132c48c55f171e6b3218bbadc26c141d41d Author: Rick Macklem AuthorDate: 2022-04-05 15:11:37 +0000 Commit: Rick Macklem CommitDate: 2022-06-09 19:20:03 +0000 nfscl: Add support for a NFSv4 AppendWrite RPC For IO_APPEND VOP_WRITE()s, the code first does a Getattr RPC to acquire the file's size, before it can do the Write RPC. Although NFS does not have an append write operation, an NFSv4 compound can use a Verify operation to check that the client's notion of the file's size is correct before doing the Write operation. This patch prepares the NFSv4 client for such an RPC, which will be added in a future commit. This patch does not cause any semantics change. (cherry picked from commit 330aa8acdec76d00d9e0ca526d421fe25ccf90cf) --- sys/fs/nfs/nfs_commonport.c | 2 +- sys/fs/nfs/nfs_commonsubs.c | 7 ++++--- sys/fs/nfs/nfsport.h | 12 +++++++++--- sys/fs/nfs/nfsproto.h | 5 ++++- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c index 54a7e66a5baf..f91cb3a8cebe 100644 --- a/sys/fs/nfs/nfs_commonport.c +++ b/sys/fs/nfs/nfs_commonport.c @@ -599,7 +599,7 @@ nfssvc_call(struct thread *p, struct nfssvc_args *uap, struct ucred *cred) nfsstatsv1.biocache_readdirs; nfsstatsov1.readdir_bios = nfsstatsv1.readdir_bios; - for (i = 0; i < NFSV42_NPROCS; i++) + for (i = 0; i < NFSV42_OLDNPROCS; i++) nfsstatsov1.rpccnt[i] = nfsstatsv1.rpccnt[i]; nfsstatsov1.rpcretries = diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index eb6746ec3041..8ebb3e31b73a 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -150,7 +150,7 @@ struct nfsv4_opflag nfsv4_opflag[NFSV42_NOPS] = { { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Setattr */ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SetClientID */ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SetClientIDConfirm */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Verify */ + { 0, 2, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Verify (AppWrite) */ { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Write */ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* ReleaseLockOwner */ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Backchannel Ctrl */ @@ -215,7 +215,7 @@ static struct nfsrv_lughash *nfsgroupnamehash; static int nfs_bigreply[NFSV42_NPROCS] = { 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 1, 0, 0, 0, 0 }; + 1, 0, 0, 1, 0, 0, 0, 0, 0 }; /* local functions */ static int nfsrv_skipace(struct nfsrv_descript *nd, int *acesizep); @@ -303,6 +303,7 @@ static struct { { NFSV4OP_LOOKUP, 5, "LookupOpen", 10, }, { NFSV4OP_DEALLOCATE, 2, "Deallocate", 10, }, { NFSV4OP_LAYOUTERROR, 1, "LayoutError", 11, }, + { NFSV4OP_VERIFY, 3, "AppendWrite", 11, }, }; /* @@ -312,7 +313,7 @@ static int nfs_bigrequest[NFSV42_NPROCS] = { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, - 0 + 0, 1 }; /* diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h index 8ac4bc54a5f2..2955ae43de85 100644 --- a/sys/fs/nfs/nfsport.h +++ b/sys/fs/nfs/nfsport.h @@ -424,10 +424,16 @@ /* Do an NFSv4.2 LayoutError. */ #define NFSPROC_LAYOUTERROR 68 +/* Do an NFSv4 Verify+Write. */ +#define NFSPROC_APPENDWRITE 69 + /* * Must be defined as one higher than the last NFSv4.2 Proc# above. */ -#define NFSV42_NPROCS 69 +#define NFSV42_NPROCS 70 + +/* Value of NFSV42_NPROCS for old nfsstats structure. (Always 69) */ +#define NFSV42_OLDNPROCS 69 #endif /* NFS_V3NPROCS */ @@ -456,7 +462,7 @@ struct nfsstatsv1 { uint64_t readlink_bios; uint64_t biocache_readdirs; uint64_t readdir_bios; - uint64_t rpccnt[NFSV42_NPROCS + 11]; + uint64_t rpccnt[NFSV42_NPROCS + 10]; uint64_t rpcretries; uint64_t srvrpccnt[NFSV42_NOPS + NFSV4OP_FAKENOPS + 15]; uint64_t srvlayouts; @@ -521,7 +527,7 @@ struct nfsstatsov1 { uint64_t readlink_bios; uint64_t biocache_readdirs; uint64_t readdir_bios; - uint64_t rpccnt[NFSV42_NPROCS]; + uint64_t rpccnt[NFSV42_OLDNPROCS]; uint64_t rpcretries; uint64_t srvrpccnt[NFSV42_PURENOPS + NFSV4OP_FAKENOPS]; uint64_t reserved_0; diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h index 968cc6a41cc3..2e21a70b5d86 100644 --- a/sys/fs/nfs/nfsproto.h +++ b/sys/fs/nfs/nfsproto.h @@ -405,10 +405,13 @@ /* Do an NFSv4.2 LayoutError. */ #define NFSPROC_LAYOUTERROR 68 +/* Do an NFSv4 Verify+Write. */ +#define NFSPROC_APPENDWRITE 69 + /* * Must be defined as one higher than the last NFSv4.2 Proc# above. */ -#define NFSV42_NPROCS 69 +#define NFSV42_NPROCS 70 #endif /* NFS_V3NPROCS */