svn commit: r351645 - projects/nfsv42/sys/fs/nfs

Rick Macklem rmacklem at FreeBSD.org
Sat Aug 31 15:17:23 UTC 2019


Author: rmacklem
Date: Sat Aug 31 15:17:22 2019
New Revision: 351645
URL: https://svnweb.freebsd.org/changeset/base/351645

Log:
  Update the NFS common files for the optional Extended attribute support
  defined in RFC-8276.
  
  Updates to the rest of the files for get extended attributes coming soon.

Modified:
  projects/nfsv42/sys/fs/nfs/nfs_commonsubs.c
  projects/nfsv42/sys/fs/nfs/nfs_var.h
  projects/nfsv42/sys/fs/nfs/nfsport.h
  projects/nfsv42/sys/fs/nfs/nfsproto.h

Modified: projects/nfsv42/sys/fs/nfs/nfs_commonsubs.c
==============================================================================
--- projects/nfsv42/sys/fs/nfs/nfs_commonsubs.c	Sat Aug 31 15:10:27 2019	(r351644)
+++ projects/nfsv42/sys/fs/nfs/nfs_commonsubs.c	Sat Aug 31 15:17:22 2019	(r351645)
@@ -107,7 +107,7 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, pnfsmirror, CTLFLAG_RD,
  * non-idempotent Ops.
  * Define it here, since it is used by both the client and server.
  */
-struct nfsv4_opflag nfsv4_opflag[NFSV42_NOPS] = {
+struct nfsv4_opflag nfsv4_opflag[NFSV4N_NOPS] = {
 	{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 },		/* undef */
 	{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 },		/* undef */
 	{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 },		/* undef */
@@ -180,6 +180,10 @@ struct nfsv4_opflag nfsv4_opflag[NFSV42_NOPS] = {
 	{ 0, 1, 0, 0, LK_SHARED, 1, 0 },		/* Seek */
 	{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 },		/* Write Same */
 	{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 },		/* Clone */
+	{ 0, 1, 0, 0, LK_SHARED, 1, 1 },		/* Getxattr */
+	{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 },		/* Setxattr */
+	{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 },		/* Listxattrs */
+	{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 },		/* Removexattr */
 };
 #endif	/* !APPLEKEXT */
 
@@ -206,7 +210,8 @@ 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 };
+    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 };
 
 /* local functions */
 static int nfsrv_skipace(struct nfsrv_descript *nd, int *acesizep);
@@ -285,6 +290,7 @@ static struct {
 	{ NFSV4OP_SAVEFH, 5, "Copy", 4, },
 	{ NFSV4OP_SEEK, 2, "Seek", 4, },
 	{ NFSV4OP_SEEK, 1, "SeekDS", 6, },
+	{ NFSV4OP_GETXATTR, 2, "Getxattr", 8, },
 };
 
 /*
@@ -293,7 +299,7 @@ static struct {
 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, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
 
 /*

Modified: projects/nfsv42/sys/fs/nfs/nfs_var.h
==============================================================================
--- projects/nfsv42/sys/fs/nfs/nfs_var.h	Sat Aug 31 15:10:27 2019	(r351644)
+++ projects/nfsv42/sys/fs/nfs/nfs_var.h	Sat Aug 31 15:17:22 2019	(r351645)
@@ -283,6 +283,8 @@ int nfsrvd_copy_file_range(struct nfsrv_descript *, in
     vnode_t, vnode_t, struct nfsexstuff *, struct nfsexstuff *);
 int nfsrvd_seek(struct nfsrv_descript *, int,
     vnode_t, struct nfsexstuff *);
+int nfsrvd_getxattr(struct nfsrv_descript *, int,
+    vnode_t, struct nfsexstuff *);
 int nfsrvd_notsupp(struct nfsrv_descript *, int,
     vnode_t, struct nfsexstuff *);
 
@@ -544,6 +546,8 @@ int nfsrpc_copy_file_range(vnode_t, off_t *, vnode_t, 
     struct ucred *, bool, bool *);
 int nfsrpc_seek(vnode_t, off_t *, bool *, int, struct ucred *,
     struct nfsvattr *, int *);
+int nfsrpc_getextattr(vnode_t, const char *, struct uio *, ssize_t *,
+    struct nfsvattr *, int *, struct ucred *, NFSPROC_T *);
 
 /* nfs_clstate.c */
 int nfscl_open(vnode_t, u_int8_t *, int, u_int32_t, int,
@@ -727,6 +731,8 @@ void nfsrv_killrpcs(struct nfsmount *);
 int nfsrv_setacl(struct vnode *, NFSACL_T *, struct ucred *, NFSPROC_T *);
 int nfsvno_seek(struct nfsrv_descript *, struct vnode *, u_long, off_t *, int,
     bool *, struct ucred *, NFSPROC_T *);
+int nfsvno_getxattr(struct vnode *, char *, struct ucred *, struct thread *,
+    struct mbuf **, struct mbuf **, int *);
 
 /* nfs_commonkrpc.c */
 int newnfs_nmcancelreqs(struct nfsmount *);

Modified: projects/nfsv42/sys/fs/nfs/nfsport.h
==============================================================================
--- projects/nfsv42/sys/fs/nfs/nfsport.h	Sat Aug 31 15:10:27 2019	(r351644)
+++ projects/nfsv42/sys/fs/nfs/nfsport.h	Sat Aug 31 15:17:22 2019	(r351645)
@@ -278,10 +278,21 @@
 #define	NFSV4OP_CLONE		71
 
 /*
- * Must be one more than the last op#.
+ * Must be one more than the last NFSv4.2 op#.
  */
 #define	NFSV42_NOPS		72
 
+/* and the optional Extended attribute operations (RFC-8276). */
+#define	NFSV4OP_GETXATTR	72
+#define	NFSV4OP_SETXATTR	73
+#define	NFSV4OP_LISTXATTRS	74
+#define	NFSV4OP_REMOVEXATTR	75
+
+/*
+ * Must be one more that the last op#.
+ */
+#define	NFSV4N_NOPS		76
+
 /* Quirky case if the illegal op code */
 #define	NFSV4OP_OPILLEGAL	10044
 
@@ -400,10 +411,13 @@
 #define	NFSPROC_SEEK		59
 #define	NFSPROC_SEEKDS		60
 
+/* and the ones for the optional Extended attribute support (RFC-8276). */
+#define	NFSPROC_GETEXTATTR	61
+
 /*
  * Must be defined as one higher than the last NFSv4.2 Proc# above.
  */
-#define	NFSV42_NPROCS		61
+#define	NFSV42_NPROCS		62
 
 #endif	/* NFS_V3NPROCS */
 
@@ -432,7 +446,7 @@ struct nfsstatsv1 {
 	uint64_t	readlink_bios;
 	uint64_t	biocache_readdirs;
 	uint64_t	readdir_bios;
-	uint64_t	rpccnt[NFSV42_NPROCS + 8];
+	uint64_t	rpccnt[NFSV42_NPROCS + 7];
 	uint64_t	rpcretries;
 	uint64_t	srvrpccnt[NFSV42_NOPS + NFSV4OP_FAKENOPS];
 	uint64_t	srvrpc_errs;

Modified: projects/nfsv42/sys/fs/nfs/nfsproto.h
==============================================================================
--- projects/nfsv42/sys/fs/nfs/nfsproto.h	Sat Aug 31 15:10:27 2019	(r351644)
+++ projects/nfsv42/sys/fs/nfs/nfsproto.h	Sat Aug 31 15:17:22 2019	(r351645)
@@ -224,8 +224,12 @@
 #define	NFSERR_BADLABEL		10093
 #define	NFSERR_OFFLOADNOREQS	10094
 
+/* NFSv4.2 Extended Attribute errors. */
+#define	NFSERR_NOXATTR		10095
+#define	NFSERR_XATTR2BIG	10096
+
 /* Maximum value of all the NFS error values. */
-#define	NFSERR_MAXERRVAL	NFSERR_OFFLOADNOREQS
+#define	NFSERR_MAXERRVAL	NFSERR_XATTR2BIG
 
 #define	NFSERR_STALEWRITEVERF	30001	/* Fake return for nfs_commit() */
 #define	NFSERR_DONTREPLY	30003	/* Don't process request */
@@ -384,10 +388,13 @@
 #define	NFSPROC_SEEK		59
 #define	NFSPROC_SEEKDS		60
 
+/* and the ones for the optional Extended attribute support (RFC-8276). */
+#define	NFSPROC_GETEXTATTR	61
+
 /*
  * Must be defined as one higher than the last NFSv4.2 Proc# above.
  */
-#define	NFSV42_NPROCS		61
+#define	NFSV42_NPROCS		62
 
 #endif	/* NFS_V3NPROCS */
 
@@ -400,10 +407,10 @@
 
 /*
  * NFSPROC_NOOP is a fake op# that can't be the same as any V2/3/4 Procedure
- * or Operation#. Since the NFS V4 Op #s go higher, use NFSV42_NOPS, which
+ * or Operation#. Since the NFS V4 Op #s go higher, use NFSV4N_NOPS, which
  * is one greater than the highest Op#.
  */
-#define	NFSPROC_NOOP		NFSV42_NOPS
+#define	NFSPROC_NOOP		NFSV4N_NOPS
 
 /* Actual Version 2 procedure numbers */
 #define	NFSV2PROC_NULL		0


More information about the svn-src-projects mailing list