From owner-svn-src-projects@freebsd.org Fri Apr 28 20:51:20 2017 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 190BED54DAA for ; Fri, 28 Apr 2017 20:51:20 +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 C2EF961D; Fri, 28 Apr 2017 20:51:19 +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 v3SKpI5O053716; Fri, 28 Apr 2017 20:51:18 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3SKpIU7053715; Fri, 28 Apr 2017 20:51:18 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704282051.v3SKpIU7053715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 28 Apr 2017 20:51:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r317569 - projects/pnfs-planb-server/sys/fs/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.23 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: Fri, 28 Apr 2017 20:51:20 -0000 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);