Date: Fri, 28 Apr 2017 20:51:18 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r317569 - projects/pnfs-planb-server/sys/fs/nfsserver Message-ID: <201704282051.v3SKpIU7053715@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Fri Apr 28 20:51:18 2017 New Revision: 317569 URL: https://svnweb.freebsd.org/changeset/base/317569 Log: Add the code changes for the pNFS server to nfs_nfsdsubs.c. Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsubs.c Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsubs.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsubs.c Fri Apr 28 19:38:57 2017 (r317568) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsubs.c Fri Apr 28 20:51:18 2017 (r317569) @@ -50,6 +50,8 @@ extern struct nfslockhashhead *nfslockha extern int nfsrv_lockhashsize; extern struct nfssessionhash *nfssessionhash; extern int nfsrv_sessionhashsize; +extern struct nfslayouthash *nfslayouthash; +extern int nfsrv_layouthashsize; extern int nfsrv_useacl; extern uid_t nfsrv_defaultuid; extern gid_t nfsrv_defaultgid; @@ -1442,7 +1444,14 @@ nfsrv_mtofh(struct nfsrv_descript *nd, s nd->nd_flag |= ND_PUBLOOKUP; goto nfsmout; } - if (len < NFSRV_MINFH || len > NFSRV_MAXFH) { + copylen = len; + + /* If len == NFSX_V4PNFSFH the RPC is a pNFS DS one. */ + if (len == NFSX_V4PNFSFH && (nd->nd_flag & ND_NFSV41) != 0) { + copylen = NFSX_MYFH; + len = NFSM_RNDUP(len); + nd->nd_flag |= ND_DSSERVER; + } else if (len < NFSRV_MINFH || len > NFSRV_MAXFH) { if (nd->nd_flag & ND_NFSV4) { if (len > 0 && len <= NFSX_V4FHMAX) { error = nfsm_advance(nd, NFSM_RNDUP(len), -1); @@ -1459,7 +1468,6 @@ nfsrv_mtofh(struct nfsrv_descript *nd, s goto nfsmout; } } - copylen = len; } else { /* * For NFSv2, the file handle is always 32 bytes on the @@ -2054,6 +2062,12 @@ nfsd_init(void) mtx_init(&nfssessionhash[i].mtx, "nfssm", NULL, MTX_DEF); LIST_INIT(&nfssessionhash[i].list); } + nfslayouthash = malloc(sizeof(struct nfslayouthash) * + nfsrv_layouthashsize, M_NFSDSESSION, M_WAITOK | M_ZERO); + for (i = 0; i < nfsrv_layouthashsize; i++) { + mtx_init(&nfslayouthash[i].mtx, "nfslm", NULL, MTX_DEF); + LIST_INIT(&nfslayouthash[i].list); + } /* and the v2 pubfh should be all zeros */ NFSBZERO(nfs_v2pubfh, NFSX_V2FH);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704282051.v3SKpIU7053715>