aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2022-04-05 15:11:37 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2022-04-05 15:11:37 +0000
commit330aa8acdec76d00d9e0ca526d421fe25ccf90cf (patch)
tree51f9d240d844c833bbbe21fefd0ab2756997bb7d /sys/fs
parent79c4c4be9618470711480f46ef2cd3a15c00cdd2 (diff)
downloadsrc-330aa8acdec76d00d9e0ca526d421fe25ccf90cf.tar.gz
src-330aa8acdec76d00d9e0ca526d421fe25ccf90cf.zip
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.
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/nfs/nfs_commonport.c2
-rw-r--r--sys/fs/nfs/nfs_commonsubs.c7
-rw-r--r--sys/fs/nfs/nfsport.h12
-rw-r--r--sys/fs/nfs/nfsproto.h5
4 files changed, 18 insertions, 8 deletions
diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c
index 4719e7abf8cf..cb47922a34e0 100644
--- a/sys/fs/nfs/nfs_commonport.c
+++ b/sys/fs/nfs/nfs_commonport.c
@@ -598,7 +598,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 4be1c415bf67..d3c329a3abc7 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 */