From owner-svn-src-projects@freebsd.org Tue Apr 12 21:47:39 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD324B0D534 for ; Tue, 12 Apr 2016 21:47:39 +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 mx1.freebsd.org (Postfix) with ESMTPS id 605CB17FC; Tue, 12 Apr 2016 21:47:39 +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 u3CLlctW056716; Tue, 12 Apr 2016 21:47:38 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3CLlbM8056702; Tue, 12 Apr 2016 21:47:37 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201604122147.u3CLlbM8056702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 12 Apr 2016 21:47:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r297881 - in projects/pnfs-server/sys/fs: nfs nfsclient nfsserver X-SVN-Group: projects 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.21 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: Tue, 12 Apr 2016 21:47:39 -0000 Author: rmacklem Date: Tue Apr 12 21:47:37 2016 New Revision: 297881 URL: https://svnweb.freebsd.org/changeset/base/297881 Log: Put the pNFS server/client changes into the new NFS kernel directories. More to come, before it is ready for build/test. Modified: projects/pnfs-server/sys/fs/nfs/nfs.h projects/pnfs-server/sys/fs/nfs/nfs_commonsubs.c projects/pnfs-server/sys/fs/nfs/nfs_var.h projects/pnfs-server/sys/fs/nfs/nfscl.h projects/pnfs-server/sys/fs/nfs/nfsclstate.h projects/pnfs-server/sys/fs/nfs/nfsport.h projects/pnfs-server/sys/fs/nfs/nfsproto.h projects/pnfs-server/sys/fs/nfs/nfsrvstate.h projects/pnfs-server/sys/fs/nfsclient/nfs_clcomsubs.c projects/pnfs-server/sys/fs/nfsclient/nfs_clnode.c projects/pnfs-server/sys/fs/nfsclient/nfs_clport.c projects/pnfs-server/sys/fs/nfsclient/nfs_clrpcops.c projects/pnfs-server/sys/fs/nfsclient/nfs_clstate.c projects/pnfs-server/sys/fs/nfsclient/nfs_clvnops.c projects/pnfs-server/sys/fs/nfsclient/nfsnode.h projects/pnfs-server/sys/fs/nfsserver/nfs_nfsdkrpc.c projects/pnfs-server/sys/fs/nfsserver/nfs_nfsdport.c projects/pnfs-server/sys/fs/nfsserver/nfs_nfsdserv.c projects/pnfs-server/sys/fs/nfsserver/nfs_nfsdsocket.c projects/pnfs-server/sys/fs/nfsserver/nfs_nfsdstate.c Modified: projects/pnfs-server/sys/fs/nfs/nfs.h ============================================================================== --- projects/pnfs-server/sys/fs/nfs/nfs.h Tue Apr 12 21:40:54 2016 (r297880) +++ projects/pnfs-server/sys/fs/nfs/nfs.h Tue Apr 12 21:47:37 2016 (r297881) @@ -130,6 +130,9 @@ #endif #define NFSV4_CBPORT 7745 /* Callback port for testing */ +/* This value is defined in GlusterFS as GF_NFS3_FILE_IO_SIZE_MAX. */ +#define NFSV4SRV_PNFS_MAXIO 1048576 /* Max I/O size for the DS */ + /* * This macro defines the high water mark for issuing V4 delegations. * (It is currently set at a conservative 20% of nfsrv_v4statelimit. This @@ -168,12 +171,39 @@ struct nfsd_addsock_args { }; /* + * The file handle used by the pNFS Data Servers, which are actually + * GlusterFS servers. The userland nfsd passes in the value for the + * GlusterFS volume root. The only field that changes for files within the + * volume is the gfid field. + */ +struct pnfsfh { + char id[4]; /* Always ":OGL". */ + char expid[16]; /* Export ID. */ + char gfid[16]; /* Gfid. */ + char mntid[16]; /* Mount ID. */ +}; + +/* * nfsd argument for new krpc. + * (New version supports pNFS, indicated by NFSSVC_NEWSTRUCT flag.) */ struct nfsd_nfsd_args { const char *principal; /* GSS-API service principal name */ int minthreads; /* minimum service thread count */ int maxthreads; /* maximum service thread count */ + int version; /* Allow multiple variants */ + struct pnfsfh nfsfh; /* pNFS DS file handle */ + char *addr; /* pNFS DS addresses */ + int addrlen; /* Length of addrs */ + char *dnshost; /* DNS names for DS addresses */ + int dnshostlen; /* Length of DNS names */ +}; + +/* Old version. */ +struct nfsd_nfsd_oargs { + const char *principal; /* GSS-API service principal name */ + int minthreads; /* minimum service thread count */ + int maxthreads; /* maximum service thread count */ }; /* @@ -333,6 +363,7 @@ struct nfsreferral { #define NFSLCK_WANTWDELEG 0x10000000 #define NFSLCK_WANTRDELEG 0x20000000 #define NFSLCK_WANTNODELEG 0x40000000 +#define NFSLCK_LAYOUT 0x80000000 #define NFSLCK_WANTBITS \ (NFSLCK_WANTWDELEG | NFSLCK_WANTRDELEG | NFSLCK_WANTNODELEG) Modified: projects/pnfs-server/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- projects/pnfs-server/sys/fs/nfs/nfs_commonsubs.c Tue Apr 12 21:40:54 2016 (r297880) +++ projects/pnfs-server/sys/fs/nfs/nfs_commonsubs.c Tue Apr 12 21:47:37 2016 (r297881) @@ -71,6 +71,7 @@ int nfsd_enable_stringtouid = 0; NFSNAMEIDMUTEX; NFSSOCKMUTEX; extern int nfsrv_lughashsize; +extern int nfscl_debuglevel; /* * This array of structures indicates, for V4: @@ -507,7 +508,7 @@ nfsm_fhtom(struct nfsrv_descript *nd, u_ } (void) nfsm_strtom(nd, fhp, size); break; - } + }; return (bytesize); } @@ -544,7 +545,7 @@ nfsaddr_match(int family, union nethosta } break; #endif - } + }; return (0); } @@ -581,7 +582,7 @@ nfsaddr2_match(NFSSOCKADDR_T nam1, NFSSO } break; #endif - } + }; return (0); } @@ -1203,7 +1204,8 @@ nfsv4_loadattr(struct nfsrv_descript *nd } } else if (nap != NULL) { if (*tl++) - printf("NFSv4 fileid > 32bits\n"); + NFSCL_DEBUG(1, + "NFSv4 fileid > 32bits\n"); nap->na_fileid = thyp; } attrsum += NFSX_HYPER; @@ -1741,7 +1743,8 @@ nfsv4_loadattr(struct nfsrv_descript *nd } } else if (nap != NULL) { if (*tl++) - printf("NFSv4 mounted on fileid > 32bits\n"); + NFSCL_DEBUG(1, + "NFSv4 mounted on fileid > 32bits\n"); nap->na_mntonfileno = thyp; } attrsum += NFSX_HYPER; @@ -1774,7 +1777,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd */ bitpos = NFSATTRBIT_MAX; break; - } + }; } /* @@ -2508,7 +2511,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd break; default: printf("EEK! Bad V4 attribute bitpos=%d\n", bitpos); - } + }; } } if (naclp != NULL) @@ -3916,122 +3919,6 @@ newnfs_sndunlock(int *flagp) NFSUNLOCKSOCK(); } -APPLESTATIC int -nfsv4_getipaddr(struct nfsrv_descript *nd, struct sockaddr_storage *sa, - int *isudp) -{ - struct sockaddr_in *sad; - struct sockaddr_in6 *sad6; - struct in_addr saddr; - uint32_t portnum, *tl; - int af = 0, i, j, k; - char addr[64], protocol[5], *cp; - int cantparse = 0, error = 0; - uint16_t portv; - - NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); - i = fxdr_unsigned(int, *tl); - if (i >= 3 && i <= 4) { - error = nfsrv_mtostr(nd, protocol, i); - if (error) - goto nfsmout; - if (strcmp(protocol, "tcp") == 0) { - af = AF_INET; - *isudp = 0; - } else if (strcmp(protocol, "udp") == 0) { - af = AF_INET; - *isudp = 1; - } else if (strcmp(protocol, "tcp6") == 0) { - af = AF_INET6; - *isudp = 0; - } else if (strcmp(protocol, "udp6") == 0) { - af = AF_INET6; - *isudp = 1; - } else - cantparse = 1; - } else { - cantparse = 1; - if (i > 0) { - error = nfsm_advance(nd, NFSM_RNDUP(i), -1); - if (error) - goto nfsmout; - } - } - NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); - i = fxdr_unsigned(int, *tl); - if (i < 0) { - error = NFSERR_BADXDR; - goto nfsmout; - } else if (cantparse == 0 && i >= 11 && i < 64) { - /* - * The shortest address is 11chars and the longest is < 64. - */ - error = nfsrv_mtostr(nd, addr, i); - if (error) - goto nfsmout; - - /* Find the port# at the end and extract that. */ - i = strlen(addr); - k = 0; - cp = &addr[i - 1]; - /* Count back two '.'s from end to get port# field. */ - for (j = 0; j < i; j++) { - if (*cp == '.') { - k++; - if (k == 2) - break; - } - cp--; - } - if (k == 2) { - /* - * The NFSv4 port# is appended as .N.N, where N is - * a decimal # in the range 0-255, just like an inet4 - * address. Cheat and use inet_aton(), which will - * return a Class A address and then shift the high - * order 8bits over to convert it to the port#. - */ - *cp++ = '\0'; - if (inet_aton(cp, &saddr) == 1) { - portnum = ntohl(saddr.s_addr); - portv = (uint16_t)((portnum >> 16) | - (portnum & 0xff)); - } else - cantparse = 1; - } else - cantparse = 1; - if (cantparse == 0) { - if (af == AF_INET) { - sad = (struct sockaddr_in *)sa; - if (inet_pton(af, addr, &sad->sin_addr) == 1) { - sad->sin_len = sizeof(*sad); - sad->sin_family = AF_INET; - sad->sin_port = htons(portv); - return (0); - } - } else { - sad6 = (struct sockaddr_in6 *)sa; - if (inet_pton(af, addr, &sad6->sin6_addr) - == 1) { - sad6->sin6_len = sizeof(*sad6); - sad6->sin6_family = AF_INET6; - sad6->sin6_port = htons(portv); - return (0); - } - } - } - } else { - if (i > 0) { - error = nfsm_advance(nd, NFSM_RNDUP(i), -1); - if (error) - goto nfsmout; - } - } - error = EPERM; -nfsmout: - return (error); -} - /* * Handle an NFSv4.1 Sequence request for the session. * If reply != NULL, use it to return the cached reply, as required. Modified: projects/pnfs-server/sys/fs/nfs/nfs_var.h ============================================================================== --- projects/pnfs-server/sys/fs/nfs/nfs_var.h Tue Apr 12 21:40:54 2016 (r297880) +++ projects/pnfs-server/sys/fs/nfs/nfs_var.h Tue Apr 12 21:47:37 2016 (r297881) @@ -136,6 +136,15 @@ int nfsrv_checksequence(struct nfsrv_des int nfsrv_checkreclaimcomplete(struct nfsrv_descript *); void nfsrv_cache_session(uint8_t *, uint32_t, int, struct mbuf **); void nfsrv_freeallbackchannel_xprts(void); +int nfsrv_layoutget(struct nfsrv_descript *, vnode_t, struct nfsexstuff *, + int, int *, uint64_t *, uint64_t *, uint64_t, nfsv4stateid_t *, int, int *, + int *, char *, struct ucred *, NFSPROC_T *); +int nfsrv_layoutreturn(struct nfsrv_descript *, vnode_t, int, int, uint64_t, + uint64_t, int, int, nfsv4stateid_t *, int, char *, int *, struct ucred *, + NFSPROC_T *); +int nfsrv_getdevinfo(char *, int, int *, uint32_t *, int *, char **); +void nfsrv_freealllayoutsanddevids(void); +void nfsrv_createdevids(struct nfsd_nfsd_args *); /* nfs_nfsdserv.c */ int nfsrvd_access(struct nfsrv_descript *, int, @@ -234,8 +243,16 @@ int nfsrvd_destroysession(struct nfsrv_d vnode_t, NFSPROC_T *, struct nfsexstuff *); int nfsrvd_freestateid(struct nfsrv_descript *, int, vnode_t, NFSPROC_T *, struct nfsexstuff *); +int nfsrvd_getdevinfo(struct nfsrv_descript *, int, + vnode_t, NFSPROC_T *, struct nfsexstuff *); +int nfsrvd_layoutget(struct nfsrv_descript *, int, + vnode_t, NFSPROC_T *, struct nfsexstuff *); +int nfsrvd_layoutreturn(struct nfsrv_descript *, int, + vnode_t, NFSPROC_T *, struct nfsexstuff *); int nfsrvd_notsupp(struct nfsrv_descript *, int, vnode_t, NFSPROC_T *, struct nfsexstuff *); +int nfsrvd_notsuppvp(struct nfsrv_descript *, int, + vnode_t, NFSPROC_T *, struct nfsexstuff *); /* nfs_nfsdsocket.c */ void nfsrvd_rephead(struct nfsrv_descript *); @@ -287,8 +304,6 @@ void nfsrv_cleanusergroup(void); int nfsrv_checkutf8(u_int8_t *, int); int newnfs_sndlock(int *); void newnfs_sndunlock(int *); -int nfsv4_getipaddr(struct nfsrv_descript *, struct sockaddr_storage *, - int *); int nfsv4_seqsession(uint32_t, uint32_t, uint32_t, struct nfsslot *, struct mbuf **, uint16_t); void nfsv4_seqsess_cacherep(uint32_t, struct nfsslot *, int, struct mbuf **); @@ -302,11 +317,11 @@ struct ucred *nfsrv_getgrpscred(struct u /* nfs_clcomsubs.c */ void nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int); void nfscl_reqstart(struct nfsrv_descript *, int, struct nfsmount *, - u_int8_t *, int, u_int32_t **, struct nfsclsession *); + u_int8_t *, int, u_int32_t **, struct nfsclsession *, int, int); nfsuint64 *nfscl_getcookie(struct nfsnode *, off_t off, int); void nfscl_fillsattr(struct nfsrv_descript *, struct vattr *, vnode_t, int, u_int32_t); -u_int8_t *nfscl_getmyip(struct nfsmount *, struct in6_addr *, int *); +u_int8_t *nfscl_getmyip(struct nfsmount *, int *); int nfsm_getfh(struct nfsrv_descript *, struct nfsfh **); int nfscl_mtofh(struct nfsrv_descript *, struct nfsfh **, struct nfsvattr *, int *); @@ -481,8 +496,6 @@ int nfsrpc_destroyclient(struct nfsmount int nfsrpc_layoutget(struct nfsmount *, uint8_t *, int, int, uint64_t, uint64_t, uint64_t, int, nfsv4stateid_t *, int *, struct nfsclflayouthead *, struct ucred *, NFSPROC_T *, void *); -int nfsrpc_getdeviceinfo(struct nfsmount *, uint8_t *, int, uint32_t *, - struct nfscldevinfo **, struct ucred *, NFSPROC_T *); int nfsrpc_layoutcommit(struct nfsmount *, uint8_t *, int, int, uint64_t, uint64_t, uint64_t, nfsv4stateid_t *, int, int, uint8_t *, struct ucred *, NFSPROC_T *, void *); @@ -490,8 +503,8 @@ int nfsrpc_layoutreturn(struct nfsmount int, uint64_t, uint64_t, nfsv4stateid_t *, int, uint32_t *, struct ucred *, NFSPROC_T *, void *); int nfsrpc_reclaimcomplete(struct nfsmount *, struct ucred *, NFSPROC_T *); -int nfscl_doiods(vnode_t, struct uio *, int *, int *, uint32_t, - struct ucred *, NFSPROC_T *); +int nfscl_doiods(vnode_t, struct uio *, int *, int *, uint32_t, int, + struct ucred *, NFSPROC_T *, struct nfsvattr *, int *); int nfscl_findlayoutforio(struct nfscllayout *, uint64_t, uint32_t, struct nfsclflayout **); void nfscl_freenfsclds(struct nfsclds *); Modified: projects/pnfs-server/sys/fs/nfs/nfscl.h ============================================================================== --- projects/pnfs-server/sys/fs/nfs/nfscl.h Tue Apr 12 21:40:54 2016 (r297880) +++ projects/pnfs-server/sys/fs/nfs/nfscl.h Tue Apr 12 21:47:37 2016 (r297881) @@ -49,7 +49,8 @@ struct nfsv4node { */ #define NFSCL_REQSTART(n, p, v) \ nfscl_reqstart((n), (p), VFSTONFS((v)->v_mount), \ - VTONFS(v)->n_fhp->nfh_fh, VTONFS(v)->n_fhp->nfh_len, NULL, NULL) + VTONFS(v)->n_fhp->nfh_fh, VTONFS(v)->n_fhp->nfh_len, NULL, \ + NULL, 0, 0) /* * These two macros convert between a lease duration and renew interval. Modified: projects/pnfs-server/sys/fs/nfs/nfsclstate.h ============================================================================== --- projects/pnfs-server/sys/fs/nfs/nfsclstate.h Tue Apr 12 21:40:54 2016 (r297880) +++ projects/pnfs-server/sys/fs/nfs/nfsclstate.h Tue Apr 12 21:47:37 2016 (r297881) @@ -70,6 +70,7 @@ struct nfsclsession { /* * This structure holds the session, clientid and related information * needed for an NFSv4.1 Meta Data Server (MDS) or Data Server (DS). + * If NFSCLDS_V3CONN is set, it holds the connection for an NFSv3 DS. * It is malloc'd to the correct length. */ struct nfsclds { @@ -90,6 +91,7 @@ struct nfsclds { #define NFSCLDS_HASWRITEVERF 0x0001 #define NFSCLDS_MDS 0x0002 #define NFSCLDS_DS 0x0004 +#define NFSCLDS_V3CONN 0x0008 struct nfsclclient { LIST_ENTRY(nfsclclient) nfsc_list; @@ -257,6 +259,18 @@ struct nfscllayout { #define NFSLY_RECALLALL 0x0040 #define NFSLY_RETONCLOSE 0x0080 #define NFSLY_WRITTEN 0x0100 /* Has been used to write to a DS. */ +#define NFSLY_FLEXFILE 0x0200 + +/* + * Flex Files Data Server structures. + */ +struct nfsffds { + uint32_t nfsffds_efficiency; + nfsv4stateid_t nfsffds_stateid; + uid_t nfsffds_uid; + gid_t nfsffds_gid; + struct nfsfh *nfsffds_fh[4]; +}; /* * MALLOC'd to the correct length to accommodate the file handle list. @@ -270,20 +284,46 @@ struct nfsclflayout { uint8_t nfsfl_dev[NFSX_V4DEVICEID]; uint64_t nfsfl_off; uint64_t nfsfl_end; - uint64_t nfsfl_patoff; struct nfscldevinfo *nfsfl_devp; uint32_t nfsfl_iomode; - uint32_t nfsfl_util; - uint32_t nfsfl_stripe1; uint16_t nfsfl_flags; - uint16_t nfsfl_fhcnt; - struct nfsfh *nfsfl_fh[1]; /* FH list for DS */ -}; + uint16_t nfsfl_cnt; + union { + struct { + uint8_t dev[NFSX_V4DEVICEID]; + uint64_t patoff; + uint32_t util; + uint32_t stripe1; + struct nfsfh *fh[1]; + } nfsfl_unfl; + struct { + uint64_t stripeunit; + uint32_t stripecnt; + uint32_t fflags; + struct nfsffds ds; + } nfsfl_unff; + }; +}; + +#define nfsfl_fhcnt nfsfl_cnt +#define nfsfl_patoff nfsfl_unfl.patoff +#define nfsfl_util nfsfl_unfl.util +#define nfsfl_stripe1 nfsfl_unfl.stripe1 +#define nfsfl_fh nfsfl_unfl.fh +#define nfsfl_stripeunit nfsfl_unff.stripeunit +#define nfsfl_stripecnt nfsfl_unff.stripecnt +#define nfsfl_fflags nfsfl_unff.fflags +#define nfsfl_ffdsefficiency nfsfl_unff.ds.nfsffds_efficiency +#define nfsfl_ffdsstateid nfsfl_unff.ds.nfsffds_stateid +#define nfsfl_ffdsuid nfsfl_unff.ds.nfsffds_uid +#define nfsfl_ffdsgid nfsfl_unff.ds.nfsffds_gid +#define nfsfl_ffdsfh nfsfl_unff.ds.nfsffds_fh /* * Flags for nfsfl_flags. */ #define NFSFL_RECALL 0x0001 /* File layout has been recalled */ +#define NFSFL_FLEXFILE 0x0002 /* Flex Files layout */ /* * Structure that is used to store a LAYOUTRECALL. @@ -298,25 +338,46 @@ struct nfsclrecalllayout { }; /* + * Structure for the Flex Files layout versions. + */ +struct nfsffvers { + uint32_t vers; + uint32_t minorvers; + uint32_t rsize; + uint32_t wsize; + uint32_t tightlycoupled; +}; + +/* * Stores the NFSv4.1 Device Info. Malloc'd to the correct length to * store the list of network connections and list of indices. * nfsdi_data[] is allocated the following way: - * - nfsdi_addrcnt * struct nfsclds + * - nfsdi_addrcnt * struct nfsclds ptrs + * For NFSv4.1 Files Layout: * - stripe indices, each stored as one byte, since there can be many * of them. (This implies a limit of 256 on nfsdi_addrcnt, since the * indices select which address.) + * We currently only support 4 Flex Files versions. (That covers us up to + * NFSv4.2.) */ struct nfscldevinfo { LIST_ENTRY(nfscldevinfo) nfsdi_list; + struct nfsffvers nfsdi_ffvers[4]; uint8_t nfsdi_deviceid[NFSX_V4DEVICEID]; struct nfsclclient *nfsdi_clp; uint32_t nfsdi_refcnt; uint32_t nfsdi_layoutrefs; - uint16_t nfsdi_stripecnt; + union { + uint16_t stripecnt; + uint16_t verspos; + } nfsdi_un; uint16_t nfsdi_addrcnt; struct nfsclds *nfsdi_data[0]; }; +#define nfsdi_stripecnt nfsdi_un.stripecnt +#define nfsdi_verspos nfsdi_un.verspos + /* These inline functions return values from nfsdi_data[]. */ /* * Return a pointer to the address at "pos". Modified: projects/pnfs-server/sys/fs/nfs/nfsport.h ============================================================================== --- projects/pnfs-server/sys/fs/nfs/nfsport.h Tue Apr 12 21:40:54 2016 (r297880) +++ projects/pnfs-server/sys/fs/nfs/nfsport.h Tue Apr 12 21:47:37 2016 (r297881) @@ -833,6 +833,7 @@ int newnfs_realign(struct mbuf **, int); */ #define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier */ #define NFSSTA_GOTFSINFO 0x00100000 /* Got the fsinfo */ +#define NFSSTA_PNFSFLEXFILE 0x00200000 /* Use Flex File layout */ #define NFSSTA_NOLAYOUTCOMMIT 0x04000000 /* Don't do LayoutCommit */ #define NFSSTA_SESSPERSIST 0x08000000 /* Has a persistent session */ #define NFSSTA_TIMEO 0x10000000 /* Experiencing a timeout */ @@ -863,6 +864,7 @@ int newnfs_realign(struct mbuf **, int); #define NFSHASNOLAYOUTCOMMIT(n) ((n)->nm_state & NFSSTA_NOLAYOUTCOMMIT) #define NFSHASSESSPERSIST(n) ((n)->nm_state & NFSSTA_SESSPERSIST) #define NFSHASPNFS(n) ((n)->nm_state & NFSSTA_PNFS) +#define NFSHASFLEXFILE(n) ((n)->nm_state & NFSSTA_PNFSFLEXFILE) /* * Gets the stats field out of the mount structure. Modified: projects/pnfs-server/sys/fs/nfs/nfsproto.h ============================================================================== --- projects/pnfs-server/sys/fs/nfs/nfsproto.h Tue Apr 12 21:40:54 2016 (r297880) +++ projects/pnfs-server/sys/fs/nfs/nfsproto.h Tue Apr 12 21:47:37 2016 (r297881) @@ -244,13 +244,17 @@ #define NFSX_V4SETTIME (NFSX_UNSIGNED + NFSX_V4TIME) #define NFSX_V4SESSIONID 16 #define NFSX_V4DEVICEID 16 +#define NFSX_V4PNFSFH (sizeof(struct pnfsfh)) +#define NFSX_V4FLEXFILELAYOUT (10 * NFSX_UNSIGNED + NFSX_V4DEVICEID + \ + NFSX_HYPER + NFSX_STATEID + NFSX_V4PNFSFH) +#define NFSX_V4MAXLAYOUT NFSX_V4FLEXFILELAYOUT +#define NFSX_STATEIDOTHER 12 +#define NFSX_STATEID (NFSX_UNSIGNED + NFSX_STATEIDOTHER) /* sizes common to multiple NFS versions */ #define NFSX_FHMAX (NFSX_V4FHMAX) #define NFSX_MYFH (sizeof (fhandle_t)) /* size this server uses */ #define NFSX_VERF 8 -#define NFSX_STATEIDOTHER 12 -#define NFSX_STATEID (NFSX_UNSIGNED + NFSX_STATEIDOTHER) #define NFSX_GSSH 12 /* variants for multiple versions */ @@ -453,6 +457,11 @@ #define NFSV4ACE_SYNCHRONIZE 0x00100000 /* + * Flags for layout get for Flex files layout. + */ +#define NFSFFLAYOUT_NO_COMMIT 0x1 + +/* * Here are the mappings between mode bits and acl mask bits for * directories and other files. * (Named attributes have not been included, since named attributes are @@ -621,6 +630,7 @@ #define NFSLAYOUT_NFSV4_1_FILES 0x1 #define NFSLAYOUT_OSD2_OBJECTS 0x2 #define NFSLAYOUT_BLOCK_VOLUME 0x3 +#define NFSLAYOUT_FLEXFILE 0x4 #define NFSLAYOUTIOMODE_READ 1 #define NFSLAYOUTIOMODE_RW 2 @@ -1343,4 +1353,14 @@ struct nfsv4stateid { }; typedef struct nfsv4stateid nfsv4stateid_t; +/* Notify bits and notify bitmap size. */ +#define NFSV4NOTIFY_CHANGE 1 +#define NFSV4NOTIFY_DELETE 2 +#define NFSV4_NOTIFYBITMAP 1 /* # of 32bit values needed for bits */ + +/* Layoutreturn kinds. */ +#define NFSV4LAYOUTRET_FILE 1 +#define NFSV4LAYOUTRET_FSID 2 +#define NFSV4LAYOUTRET_ALL 3 + #endif /* _NFS_NFSPROTO_H_ */ Modified: projects/pnfs-server/sys/fs/nfs/nfsrvstate.h ============================================================================== --- projects/pnfs-server/sys/fs/nfs/nfsrvstate.h Tue Apr 12 21:40:54 2016 (r297880) +++ projects/pnfs-server/sys/fs/nfs/nfsrvstate.h Tue Apr 12 21:47:37 2016 (r297881) @@ -84,6 +84,7 @@ struct nfsclient { struct nfsstatehead lc_open; /* Open owner list */ struct nfsstatehead lc_deleg; /* Delegations */ struct nfsstatehead lc_olddeleg; /* and old delegations */ + struct nfsstatehead lc_layout; /* NFSv4.1 layouts */ struct nfssessionhead lc_session; /* List of NFSv4.1 sessions */ time_t lc_expiry; /* Expiry time (sec) */ time_t lc_delegtime; /* Old deleg expiry (sec) */ @@ -153,6 +154,7 @@ struct nfsdsession { * - open file structures chained off an open_owner structure * - lock_owner structures chained off an open file structure * - delegated file structures chained off of nfsclient and nfslockfile + * - pNFS layouts chained off of nfsclient and nfslockfile * - the ls_list field is used for the chain it is in * - the ls_head structure is used to chain off the sibling structure * (it is a union between an nfsstate and nfslock structure head) @@ -186,8 +188,9 @@ struct nfsstate { struct nfslockfile *ls_lfp; /* Back pointer */ struct nfsrvcache *ls_op; /* Op cache reference */ struct nfsclient *ls_clp; /* Back pointer */ - u_short ls_ownerlen; /* Length of ls_owner */ + u_int32_t ls_ownerlen; /* Length of ls_owner */ u_char ls_owner[1]; /* malloc'd the correct size */ + /* Must be uint32_t * aligned */ }; #define ls_lock ls_head.lock #define ls_open ls_head.open @@ -199,6 +202,8 @@ struct nfsstate { #define ls_delegtime ls_un.deleg.expiry #define ls_delegtimelimit ls_un.deleg.limit #define ls_compref ls_un.deleg.compref +#define ls_layout ls_owner +#define ls_layoutlen ls_ownerlen /* * Nfs lock structure. @@ -249,6 +254,7 @@ struct nfsrollback { struct nfslockfile { LIST_HEAD(, nfsstate) lf_open; /* Open list */ LIST_HEAD(, nfsstate) lf_deleg; /* Delegation list */ + LIST_HEAD(, nfsstate) lf_layout; /* Layout list */ LIST_HEAD(, nfslock) lf_lock; /* Lock list */ LIST_HEAD(, nfslock) lf_locallock; /* Local lock list */ LIST_HEAD(, nfsrollback) lf_rollback; /* Local lock rollback list */ @@ -291,6 +297,24 @@ struct nfsf_rec { #if defined(_KERNEL) || defined(KERNEL) void nfsrv_cleanclient(struct nfsclient *, NFSPROC_T *); void nfsrv_freedeleglist(struct nfsstatehead *); +void nfsrv_freelayoutlist(struct nfsstatehead *); + +/* + * This structure is used to create the list of device info entries for + * a GetDeviceInfo operation. + * The nfsdev_addrandhost field has the fully qualified host domain name + * followed by the network address in XDR. + */ +struct nfsdevice { + LIST_ENTRY(nfsdevice) nfsdev_list; + char nfsdev_deviceid[NFSX_V4DEVICEID]; + uint16_t nfsdev_hostnamelen; + uint16_t nfsdev_addrlen; + char *nfsdev_addr; + char *nfsdev_host; +}; +LIST_HEAD(nfsdevicehead, nfsdevice); + #endif #endif /* _NFS_NFSRVSTATE_H_ */ Modified: projects/pnfs-server/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- projects/pnfs-server/sys/fs/nfsclient/nfs_clcomsubs.c Tue Apr 12 21:40:54 2016 (r297880) +++ projects/pnfs-server/sys/fs/nfsclient/nfs_clcomsubs.c Tue Apr 12 21:47:37 2016 (r297881) @@ -129,7 +129,8 @@ static int nfs_bigrequest[NFSV41_NPROCS] */ APPLESTATIC void nfscl_reqstart(struct nfsrv_descript *nd, int procnum, struct nfsmount *nmp, - u_int8_t *nfhp, int fhlen, u_int32_t **opcntpp, struct nfsclsession *sep) + u_int8_t *nfhp, int fhlen, u_int32_t **opcntpp, struct nfsclsession *sep, + int vers, int minorvers) { struct mbuf *mb; u_int32_t *tl; @@ -140,11 +141,12 @@ nfscl_reqstart(struct nfsrv_descript *nd * First, fill in some of the fields of nd. */ nd->nd_slotseq = NULL; - if (NFSHASNFSV4(nmp)) { + if ((NFSHASNFSV4(nmp) && vers == 0) || vers == NFS_VER4) { nd->nd_flag = ND_NFSV4 | ND_NFSCL; - if (NFSHASNFSV4N(nmp)) + if ((NFSHASNFSV4N(nmp) && vers == 0) || minorvers == + NFSV41_MINORVERSION) nd->nd_flag |= ND_NFSV41; - } else if (NFSHASNFSV3(nmp)) + } else if ((NFSHASNFSV3(nmp) && vers == 0) || vers == NFS_VER3) nd->nd_flag = ND_NFSV3 | ND_NFSCL; else nd->nd_flag = ND_NFSV2 | ND_NFSCL; @@ -179,7 +181,7 @@ nfscl_reqstart(struct nfsrv_descript *nd else if (procnum == NFSPROC_WRITEDS || procnum == NFSPROC_COMMITDS) /* - * For the special case of a Writeor Commit to + * For the special case of a Write or Commit to * a DS, the opcnt == 3, for Sequence, PutFH, * Write/Commit. */ Modified: projects/pnfs-server/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- projects/pnfs-server/sys/fs/nfsclient/nfs_clnode.c Tue Apr 12 21:40:54 2016 (r297880) +++ projects/pnfs-server/sys/fs/nfsclient/nfs_clnode.c Tue Apr 12 21:47:37 2016 (r297881) @@ -246,7 +246,7 @@ ncl_inactive(struct vop_inactive_args *a taskqueue_enqueue(taskqueue_thread, &sp->s_task); mtx_lock(&np->n_mtx); } - np->n_flag &= NMODIFIED; + np->n_flag &= (NMODIFIED | NDSCOMMIT); mtx_unlock(&np->n_mtx); return (0); } Modified: projects/pnfs-server/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- projects/pnfs-server/sys/fs/nfsclient/nfs_clport.c Tue Apr 12 21:40:54 2016 (r297880) +++ projects/pnfs-server/sys/fs/nfsclient/nfs_clport.c Tue Apr 12 21:47:37 2016 (r297881) @@ -741,6 +741,8 @@ nfscl_wcc_data(struct nfsrv_descript *nd } } error = nfscl_postop_attr(nd, nap, flagp, stuff); + if (wccflagp != NULL && *flagp == 0) + *wccflagp = 0; } else if ((nd->nd_flag & (ND_NOMOREDATA | ND_NFSV4 | ND_V4WCCATTR)) == (ND_NFSV4 | ND_V4WCCATTR)) { error = nfsv4_loadattr(nd, NULL, &nfsva, NULL, Modified: projects/pnfs-server/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- projects/pnfs-server/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 12 21:40:54 2016 (r297880) +++ projects/pnfs-server/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 12 21:47:37 2016 (r297881) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include +#include #include SYSCTL_DECL(_vfs_nfs); @@ -109,24 +110,49 @@ static int nfsrpc_setaclrpc(vnode_t, str static int nfsrpc_getlayout(struct nfsmount *, vnode_t, struct nfsfh *, int, uint32_t *, nfsv4stateid_t *, uint64_t, struct nfscllayout **, struct ucred *, NFSPROC_T *); -static int nfsrpc_fillsa(struct nfsmount *, struct sockaddr_storage *, - struct nfsclds **, NFSPROC_T *); +static int nfsrpc_fillsa(struct nfsmount *, sa_family_t, struct sockaddr_in *, + struct sockaddr_in6 *, int, int, struct nfsclds **, NFSPROC_T *); static void nfscl_initsessionslots(struct nfsclsession *); -static int nfscl_doflayoutio(vnode_t, struct uio *, int *, int *, int *, +static int nfscl_dofllayoutio(vnode_t, struct uio *, int *, int *, int *, nfsv4stateid_t *, int, struct nfscldevinfo *, struct nfscllayout *, - struct nfsclflayout *, uint64_t, uint64_t, struct ucred *, NFSPROC_T *); -static int nfsrpc_readds(vnode_t, struct uio *, nfsv4stateid_t *, int *, + struct nfsclflayout *, uint64_t, uint64_t, int, struct ucred *, + NFSPROC_T *, struct nfsvattr *, int *); +static int nfscl_dofflayoutio(vnode_t, struct uio *, int *, int *, int *, + nfsv4stateid_t *, int, struct nfscldevinfo *, struct nfscllayout *, + struct nfsclflayout *, uint64_t, uint64_t, int, struct ucred *, + NFSPROC_T *, struct nfsvattr *, int *); +static int nfsrpc_readds41(vnode_t, struct uio *, nfsv4stateid_t *, int *, + struct nfsclds *, uint64_t, int, struct nfsfh *, struct ucred *, + NFSPROC_T *, struct nfsvattr *, int *); +static int nfsrpc_readds3(vnode_t, struct uio *, int *, struct nfsclds *, uint64_t, int, struct nfsfh *, struct ucred *, - NFSPROC_T *); -static int nfsrpc_writeds(vnode_t, struct uio *, int *, int *, + NFSPROC_T *, struct nfsvattr *, int *); +static int nfsrpc_writeds41(vnode_t, struct uio *, int *, int *, nfsv4stateid_t *, struct nfsclds *, uint64_t, int, - struct nfsfh *, int, struct ucred *, NFSPROC_T *); + struct nfsfh *, int, struct ucred *, NFSPROC_T *, struct nfsvattr *, int *); +static int nfsrpc_writeds3(vnode_t, struct uio *, int *, int *, + struct nfsclds *, uint64_t, int, + struct nfsfh *, int, struct ucred *, NFSPROC_T *, struct nfsvattr *, int *); static enum nfsclds_state nfscl_getsameserver(struct nfsmount *, struct nfsclds *, struct nfsclds **); -#ifdef notyet -static int nfsrpc_commitds(vnode_t, uint64_t, int, struct nfsclds *, - struct nfsfh *, struct ucred *, NFSPROC_T *, void *); -#endif +static int nfsrpc_commitds41(vnode_t, uint64_t, int, struct nfsclds *, + struct nfsfh *, struct ucred *, NFSPROC_T *, struct nfsvattr *, int *); +static int nfsrpc_commitds3(vnode_t, uint64_t, int, struct nfsclds *, + struct nfsfh *, struct ucred *, NFSPROC_T *, struct nfsvattr *, int *); +static int nfsrpc_getattrds3(vnode_t, struct nfsclds *, struct nfsfh *, + struct nfsvattr *, struct ucred *, NFSPROC_T *); +static struct nfsclflayout *nfscl_parsefl(struct nfsrv_descript *, uint64_t, + uint64_t, int); +static struct nfsclflayout *nfscl_parseff(struct nfsrv_descript *, uint64_t, + uint64_t, int); +static int nfsrpc_getdeviceinfo(struct nfsmount *, uint8_t *, uint32_t *, + struct nfscldevinfo **, struct ucred *, NFSPROC_T *); +static int nfsv4_getipaddr(struct nfsrv_descript *, struct sockaddr_in *, + struct sockaddr_in6 *, sa_family_t *); +static int nfsrpc_flparseaddr(struct nfsmount *, struct nfsrv_descript *, + struct nfscldevinfo *, int, int *, NFSPROC_T *); +static int nfsrpc_ffparseaddr(struct nfsmount *, struct nfsrv_descript *, + struct nfscldevinfo *, int *, NFSPROC_T *); /* * nfs null call from vfs. @@ -387,7 +413,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno dp = *dpp; *dpp = NULL; - nfscl_reqstart(nd, NFSPROC_OPEN, nmp, nfhp, fhlen, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_OPEN, nmp, nfhp, fhlen, NULL, NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, 5 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); *tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH); @@ -487,7 +513,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno default: error = NFSERR_BADXDR; goto nfsmout; - } + }; } else { ndp->nfsdl_flags = NFSCLDL_READ; } @@ -742,7 +768,7 @@ nfsrpc_closerpc(struct nfsrv_descript *n int error; nfscl_reqstart(nd, NFSPROC_CLOSE, nmp, op->nfso_fh, - op->nfso_fhlen, NULL, NULL); + op->nfso_fhlen, NULL, NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID); *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); if (NFSHASNFSV4N(nmp)) @@ -784,7 +810,8 @@ nfsrpc_openconfirm(vnode_t vp, u_int8_t nmp = VFSTONFS(vnode_mount(vp)); if (NFSHASNFSV4N(nmp)) return (0); /* No confirmation for NFSv4.1. */ - nfscl_reqstart(nd, NFSPROC_OPENCONFIRM, nmp, nfhp, fhlen, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_OPENCONFIRM, nmp, nfhp, fhlen, NULL, NULL, 0, + 0); NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID); *tl++ = op->nfso_stateid.seqid; *tl++ = op->nfso_stateid.other[0]; @@ -829,7 +856,6 @@ nfsrpc_setclient(struct nfsmount *nmp, s u_int32_t lease; static u_int32_t rev = 0; struct nfsclds *dsp, *ndsp, *tdsp; - struct in6_addr a6; if (nfsboottime.tv_sec == 0) NFSSETBOOTTIME(nfsboottime); @@ -877,7 +903,7 @@ nfsrpc_setclient(struct nfsmount *nmp, s TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp, nfsclds_list); NFSUNLOCKMNT(nmp); - nfscl_reqstart(nd, NFSPROC_SETCLIENTID, nmp, NULL, 0, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_SETCLIENTID, nmp, NULL, 0, NULL, NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(nfsboottime.tv_sec); *tl = txdr_unsigned(clp->nfsc_rev); @@ -890,7 +916,7 @@ nfsrpc_setclient(struct nfsmount *nmp, s *tl = txdr_unsigned(NFS_CALLBCKPROG); callblen = strlen(nfsv4_callbackaddr); if (callblen == 0) - cp = nfscl_getmyip(nmp, &a6, &isinet6); + cp = nfscl_getmyip(nmp, &isinet6); if (nfscl_enablecallb && nfs_numnfscbd > 0 && (callblen > 0 || cp != NULL)) { port = htons(nfsv4_cbport); @@ -947,7 +973,7 @@ nfsrpc_setclient(struct nfsmount *nmp, s * and confirm it. */ nfscl_reqstart(nd, NFSPROC_SETCLIENTIDCFRM, nmp, NULL, 0, NULL, - NULL); + NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED); *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; @@ -962,7 +988,7 @@ nfsrpc_setclient(struct nfsmount *nmp, s nd->nd_mrep = NULL; if (nd->nd_repstat == 0) { nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, nmp->nm_fh, - nmp->nm_fhsize, NULL, NULL); + nmp->nm_fhsize, NULL, NULL, 0, 0); NFSZERO_ATTRBIT(&attrbits); NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_LEASETIME); (void) nfsrv_putattrbit(nd, &attrbits); @@ -1029,7 +1055,7 @@ nfsrpc_getattrnovp(struct nfsmount *nmp, int error, vers = NFS_VER2; nfsattrbit_t attrbits; - nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, fhp, fhlen, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, fhp, fhlen, NULL, NULL, 0, 0); if (nd->nd_flag & ND_NFSV4) { vers = NFS_VER4; NFSGETATTR_ATTRBIT(&attrbits); @@ -2086,7 +2112,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, default: error = NFSERR_BADXDR; goto nfsmout; - } + }; } else { dp->nfsdl_flags = NFSCLDL_READ; } @@ -3646,7 +3672,9 @@ nfsrpc_commit(vnode_t vp, u_quad_t offse NFSLOCKMNT(nmp); if (NFSBCMP(nmp->nm_verf, tl, NFSX_VERF)) { NFSBCOPY(tl, nmp->nm_verf, NFSX_VERF); +#ifdef notnow nd->nd_repstat = NFSERR_STALEWRITEVERF; +#endif } NFSUNLOCKMNT(nmp); if (nd->nd_flag & ND_NFSV4) @@ -3698,7 +3726,7 @@ nfsrpc_advlock(vnode_t vp, off_t size, i break; default: return (EINVAL); - } + }; if (start < 0) return (EINVAL); if (fl->l_len != 0) { @@ -3913,7 +3941,7 @@ nfsrpc_locku(struct nfsrv_descript *nd, int error; nfscl_reqstart(nd, NFSPROC_LOCKU, nmp, lp->nfsl_open->nfso_fh, - lp->nfsl_open->nfso_fhlen, NULL, NULL); + lp->nfsl_open->nfso_fhlen, NULL, NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID + 6 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(type); *tl = txdr_unsigned(lp->nfsl_seqid); @@ -3965,7 +3993,7 @@ nfsrpc_lock(struct nfsrv_descript *nd, s int error, size; uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; - nfscl_reqstart(nd, NFSPROC_LOCK, nmp, nfhp, fhlen, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_LOCK, nmp, nfhp, fhlen, NULL, NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED); if (type == F_RDLCK) *tl++ = txdr_unsigned(NFSV4LOCKT_READ); @@ -4237,7 +4265,7 @@ nfsrpc_renew(struct nfsclclient *clp, st if (nmp == NULL) return (0); nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, - &dsp->nfsclds_sess); + &dsp->nfsclds_sess, 0, 0); if (!NFSHASNFSV4N(nmp)) { /* NFSv4.1 just uses a Sequence Op and not a Renew. */ NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); @@ -4273,11 +4301,11 @@ nfsrpc_rellockown(struct nfsmount *nmp, if (NFSHASNFSV4N(nmp)) { /* For NFSv4.1, do a FreeStateID. */ nfscl_reqstart(nd, NFSPROC_FREESTATEID, nmp, NULL, 0, NULL, - NULL); + NULL, 0, 0); nfsm_stateidtom(nd, &lp->nfsl_stateid, NFSSTATEID_PUTSTATEID); } else { nfscl_reqstart(nd, NFSPROC_RELEASELCKOWN, nmp, NULL, 0, NULL, - NULL); + NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; @@ -4309,7 +4337,8 @@ nfsrpc_getdirpath(struct nfsmount *nmp, int error, cnt, len, setnil; u_int32_t *opcntp; - nfscl_reqstart(nd, NFSPROC_PUTROOTFH, nmp, NULL, 0, &opcntp, NULL); + nfscl_reqstart(nd, NFSPROC_PUTROOTFH, nmp, NULL, 0, &opcntp, NULL, 0, + 0); cp = dirpath; cnt = 0; do { @@ -4376,7 +4405,7 @@ nfsrpc_delegreturn(struct nfscldeleg *dp int error; nfscl_reqstart(nd, NFSPROC_DELEGRETURN, nmp, dp->nfsdl_fh, - dp->nfsdl_fhlen, NULL, NULL); + dp->nfsdl_fhlen, NULL, NULL, 0, 0); NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID); if (NFSHASNFSV4N(nmp)) *tl++ = 0; @@ -4486,7 +4515,7 @@ nfsrpc_exchangeid(struct nfsmount *nmp, int error, len; *dspp = NULL; - nfscl_reqstart(nd, NFSPROC_EXCHANGEID, nmp, NULL, 0, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_EXCHANGEID, nmp, NULL, 0, NULL, NULL, 0, 0); NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(nfsboottime.tv_sec); /* Client owner */ *tl = txdr_unsigned(clp->nfsc_rev); @@ -4568,7 +4597,8 @@ nfsrpc_createsession(struct nfsmount *nm struct nfsrv_descript *nd = &nfsd; int error, irdcnt; - nfscl_reqstart(nd, NFSPROC_CREATESESSION, nmp, NULL, 0, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_CREATESESSION, nmp, NULL, 0, NULL, NULL, 0, + 0); NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED); *tl++ = sep->nfsess_clientid.lval[0]; *tl++ = sep->nfsess_clientid.lval[1]; @@ -4662,7 +4692,8 @@ nfsrpc_destroysession(struct nfsmount *n struct nfsrv_descript *nd = &nfsd; int error; - nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL, 0, + 0); NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID); bcopy(NFSMNT_MDSSESSION(nmp)->nfsess_sessionid, tl, NFSX_V4SESSIONID); nd->nd_flag |= ND_USEGSSNAME; @@ -4687,7 +4718,8 @@ nfsrpc_destroyclient(struct nfsmount *nm struct nfsrv_descript *nd = &nfsd; int error; - nfscl_reqstart(nd, NFSPROC_DESTROYCLIENT, nmp, NULL, 0, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_DESTROYCLIENT, nmp, NULL, 0, NULL, NULL, 0, + 0); NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; @@ -4712,19 +4744,22 @@ nfsrpc_layoutget(struct nfsmount *nmp, u { uint32_t *tl; struct nfsrv_descript nfsd, *nd = &nfsd; - struct nfsfh *nfhp; struct nfsclflayout *flp, *prevflp, *tflp; - int cnt, error, gotiomode, fhcnt, nfhlen, i, j; - uint8_t *cp; - uint64_t retlen; + int cnt, error, gotiomode, i; + int retiomode, ltyp; + uint64_t off, retlen; flp = NULL; gotiomode = -1; - nfscl_reqstart(nd, NFSPROC_LAYOUTGET, nmp, fhp, fhlen, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_LAYOUTGET, nmp, fhp, fhlen, NULL, NULL, 0, + 0); NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED + 3 * NFSX_HYPER + *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***