From owner-svn-src-projects@freebsd.org Sat Aug 31 15:17:23 2019 Return-Path: Delivered-To: svn-src-projects@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D5BAFD4813 for ; Sat, 31 Aug 2019 15:17:23 +0000 (UTC) (envelope-from rmacklem@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46LKhg5MK3z4bHS; Sat, 31 Aug 2019 15:17:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B1D11AC02; Sat, 31 Aug 2019 15:17:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7VFHNW9066045; Sat, 31 Aug 2019 15:17:23 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7VFHMSD066042; Sat, 31 Aug 2019 15:17:22 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201908311517.x7VFHMSD066042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 31 Aug 2019 15:17:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r351645 - projects/nfsv42/sys/fs/nfs X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/nfsv42/sys/fs/nfs X-SVN-Commit-Revision: 351645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Aug 2019 15:17:23 -0000 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