From owner-svn-src-projects@freebsd.org Sun May 20 21:07:31 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0C96EF0180 for ; Sun, 20 May 2018 21:07:30 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F29F70CEB; Sun, 20 May 2018 21:07:30 +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 0C7511B96B; Sun, 20 May 2018 21:07:30 +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 w4KL7T7W071530; Sun, 20 May 2018 21:07:29 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4KL7T4h071526; Sun, 20 May 2018 21:07:29 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201805202107.w4KL7T4h071526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 20 May 2018 21:07:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r333940 - in projects/pnfs-planb-server/sys/fs: nfs nfsserver X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in projects/pnfs-planb-server/sys/fs: nfs nfsserver X-SVN-Commit-Revision: 333940 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.26 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: Sun, 20 May 2018 21:07:31 -0000 Author: rmacklem Date: Sun May 20 21:07:29 2018 New Revision: 333940 URL: https://svnweb.freebsd.org/changeset/base/333940 Log: Add code to free layouts in the NFSv4.1 pNFS server when the file is deleted. Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h Sun May 20 20:48:26 2018 (r333939) +++ projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h Sun May 20 21:07:29 2018 (r333940) @@ -155,6 +155,7 @@ int nfsrv_layoutreturn(struct nfsrv_descript *, vnode_ int nfsrv_getdevinfo(char *, int, uint32_t *, uint32_t *, int *, char **); void nfsrv_freeonedevid(struct nfsdevice *); void nfsrv_freealllayoutsanddevids(void); +void nfsrv_freefilelayouts(fhandle_t *); int nfsrv_deldsserver(char *, NFSPROC_T *); struct nfsdevice *nfsrv_deldsnmp(struct nfsmount *, NFSPROC_T *); int nfsrv_createdevids(struct nfsd_nfsd_args *, NFSPROC_T *); Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c Sun May 20 20:48:26 2018 (r333939) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c Sun May 20 21:07:29 2018 (r333940) @@ -106,8 +106,9 @@ extern struct nfsdevicehead nfsrv_devidhead; static void nfsrv_pnfscreate(struct vnode *, struct vattr *, struct ucred *, NFSPROC_T *); static void nfsrv_pnfsremovesetup(struct vnode *, NFSPROC_T *, struct vnode **, - int *, char *); -static void nfsrv_pnfsremove(struct vnode **, int, char *, NFSPROC_T *); + int *, char *, fhandle_t *); +static void nfsrv_pnfsremove(struct vnode **, int, char *, fhandle_t *, + NFSPROC_T *); static int nfsrv_proxyds(struct nfsrv_descript *, struct vnode *, off_t, int, struct ucred *, struct thread *, int, struct mbuf **, char *, struct mbuf **, struct nfsvattr *, struct acl *); @@ -1209,6 +1210,7 @@ nfsvno_removesub(struct nameidata *ndp, int is_v4, str struct vnode *vp, *dsdvp[NFSDEV_MAXMIRRORS]; int error = 0, i, mirrorcnt; char fname[PNFS_FILENAME_LEN + 1]; + fhandle_t fh; vp = ndp->ni_vp; dsdvp[0] = NULL; @@ -1217,12 +1219,12 @@ nfsvno_removesub(struct nameidata *ndp, int is_v4, str else if (is_v4) error = nfsrv_checkremove(vp, 1, p); if (error == 0) - nfsrv_pnfsremovesetup(vp, p, dsdvp, &mirrorcnt, fname); + nfsrv_pnfsremovesetup(vp, p, dsdvp, &mirrorcnt, fname, &fh); if (!error) error = VOP_REMOVE(ndp->ni_dvp, vp, &ndp->ni_cnd); if (dsdvp[0] != NULL) { if (error == 0) - nfsrv_pnfsremove(dsdvp, mirrorcnt, fname, p); + nfsrv_pnfsremove(dsdvp, mirrorcnt, fname, &fh, p); for (i = 0; i < mirrorcnt; i++) NFSVOPUNLOCK(dsdvp[i], 0); } @@ -1288,6 +1290,7 @@ nfsvno_rename(struct nameidata *fromndp, struct nameid struct vnode *fvp, *tvp, *tdvp, *dsdvp[NFSDEV_MAXMIRRORS]; int error = 0, i, mirrorcnt; char fname[PNFS_FILENAME_LEN + 1]; + fhandle_t fh; dsdvp[0] = NULL; fvp = fromndp->ni_vp; @@ -1365,7 +1368,7 @@ nfsvno_rename(struct nameidata *fromndp, struct nameid nfsd_recalldelegation(fvp, p); } if (error == 0 && tvp != NULL) { - nfsrv_pnfsremovesetup(tvp, p, dsdvp, &mirrorcnt, fname); + nfsrv_pnfsremovesetup(tvp, p, dsdvp, &mirrorcnt, fname, &fh); NFSD_DEBUG(4, "nfsvno_rename: pnfsremovesetup" " dsdvp=%p\n", dsdvp[0]); } @@ -1394,7 +1397,7 @@ out: */ if (dsdvp[0] != NULL) { if (error == 0) { - nfsrv_pnfsremove(dsdvp, mirrorcnt, fname, p); + nfsrv_pnfsremove(dsdvp, mirrorcnt, fname, &fh, p); NFSD_DEBUG(4, "nfsvno_rename: pnfsremove\n"); } for (i = 0; i < mirrorcnt; i++) @@ -3970,7 +3973,7 @@ nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, */ static void nfsrv_pnfsremovesetup(struct vnode *vp, NFSPROC_T *p, struct vnode **dvpp, - int *mirrorcntp, char *fname) + int *mirrorcntp, char *fname, fhandle_t *fhp) { struct vattr va; struct ucred *tcred; @@ -3994,6 +3997,12 @@ nfsrv_pnfsremovesetup(struct vnode *vp, NFSPROC_T *p, if (va.va_nlink > 1) return; + error = nfsvno_getfh(vp, fhp, p); + if (error != 0) { + printf("pNFS: nfsrv_pnfsremovesetup getfh=%d\n", error); + return; + } + buflen = 1024; buf = malloc(buflen, M_TEMP, M_WAITOK); /* Get the directory vnode for the DS mount and the file handle. */ @@ -4073,7 +4082,8 @@ start_dsremove(void *arg, int pending) * removed to set up the dvp and fill in the FH. */ static void -nfsrv_pnfsremove(struct vnode **dvp, int mirrorcnt, char *fname, NFSPROC_T *p) +nfsrv_pnfsremove(struct vnode **dvp, int mirrorcnt, char *fname, fhandle_t *fhp, + NFSPROC_T *p) { struct ucred *tcred; struct nfsrvdsremove *dsrm, *tdsrm; @@ -4145,6 +4155,9 @@ nfsrv_pnfsremove(struct vnode **dvp, int mirrorcnt, ch } NFSUNLOCKMNT(nmp); } + + /* Get rid all layouts for the file. */ + nfsrv_freefilelayouts(fhp); NFSFREECRED(tcred); free(dsrm, M_TEMP); Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Sun May 20 20:48:26 2018 (r333939) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Sun May 20 21:07:29 2018 (r333940) @@ -7027,6 +7027,27 @@ nfsrv_freelayouts(nfsquad_t *clid, fsid_t *fs, int lay } /* + * Free all layouts for the argument file. + */ +void +nfsrv_freefilelayouts(fhandle_t *fhp) +{ + struct nfslayouthash *lhyp; + struct nfslayout *lyp, *nlyp; + int i; + + for (i = 0; i < nfsrv_layouthashsize; i++) { + lhyp = &nfslayouthash[i]; + NFSLOCKLAYOUT(lhyp); + LIST_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) { + if (NFSBCMP(&lyp->lay_fh, fhp, sizeof(*fhp)) == 0) + nfsrv_freelayout(lyp); + } + NFSUNLOCKLAYOUT(lhyp); + } +} + +/* * Free all layouts. */ static void From owner-svn-src-projects@freebsd.org Mon May 21 00:51:32 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47D86EFB310 for ; Mon, 21 May 2018 00:51:32 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ECCEB7E729; Mon, 21 May 2018 00:51:31 +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 CF95D1DD45; Mon, 21 May 2018 00:51:31 +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 w4L0pV6g086898; Mon, 21 May 2018 00:51:31 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4L0pVcE086895; Mon, 21 May 2018 00:51:31 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201805210051.w4L0pVcE086895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 21 May 2018 00:51:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r333950 - in projects/pnfs-planb-server/sys/fs: nfs nfsserver X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in projects/pnfs-planb-server/sys/fs: nfs nfsserver X-SVN-Commit-Revision: 333950 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.26 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: Mon, 21 May 2018 00:51:32 -0000 Author: rmacklem Date: Mon May 21 00:51:30 2018 New Revision: 333950 URL: https://svnweb.freebsd.org/changeset/base/333950 Log: Convert the nfslayout lists from LIST to TAILQ so it will be possible to access the tail of the lists. Also, apply an optimization to nfsrv_freefilelayouts() and add the lay_fsid field missed in a recent commit. Modified: projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsubs.c Modified: projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h Mon May 21 00:32:48 2018 (r333949) +++ projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h Mon May 21 00:51:30 2018 (r333950) @@ -47,7 +47,7 @@ LIST_HEAD(nfslockhead, nfslock); LIST_HEAD(nfslockhashhead, nfslockfile); LIST_HEAD(nfssessionhead, nfsdsession); LIST_HEAD(nfssessionhashhead, nfsdsession); -LIST_HEAD(nfslayouthead, nfslayout); +TAILQ_HEAD(nfslayouthead, nfslayout); SLIST_HEAD(nfsdsdirhead, nfsdsdir); TAILQ_HEAD(nfsdevicehead, nfsdevice); LIST_HEAD(nfsdontlisthead, nfsdontlist); @@ -128,10 +128,11 @@ struct nfsclient { * Malloc'd to correct size for the lay_xdr. */ struct nfslayout { - LIST_ENTRY(nfslayout) lay_list; + TAILQ_ENTRY(nfslayout) lay_list; nfsv4stateid_t lay_stateid; nfsquad_t lay_clientid; fhandle_t lay_fh; + fsid_t lay_fsid; uint32_t lay_layoutlen; uint32_t lay_mirrorcnt; uint16_t lay_type; Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Mon May 21 00:32:48 2018 (r333949) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Mon May 21 00:51:30 2018 (r333950) @@ -201,7 +201,7 @@ static int nfsv4_setcbsequence(struct nfsrv_descript * static int nfsv4_getcbsession(struct nfsclient *clp, struct nfsdsession **sepp); static int nfsrv_addlayout(struct nfsrv_descript *nd, struct nfslayout **lypp, nfsv4stateid_t *stateidp, char *layp, int *layoutlenp, NFSPROC_T *p); -static void nfsrv_freelayout(struct nfslayout *lyp); +static void nfsrv_freelayout(struct nfslayouthead *lhp, struct nfslayout *lyp); static void nfsrv_freelayoutlist(nfsquad_t clientid); static void nfsrv_freelayouts(nfsquad_t *clid, fsid_t *fs, int laytype, int iomode); @@ -6566,11 +6566,11 @@ nfsrv_flexmirrordel(char *devid, NFSPROC_T *p) NFSD_DEBUG(4, "flexmirrordel\n"); /* Move all layouts found onto a local list. */ - LIST_INIT(&loclyp); + TAILQ_INIT(&loclyp); for (i = 0; i < nfsrv_layouthashsize; i++) { lhyp = &nfslayouthash[i]; NFSLOCKLAYOUT(lhyp); - LIST_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) { + TAILQ_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) { if (lyp->lay_type == NFSLAYOUT_FLEXFILE && lyp->lay_mirrorcnt > 1) { NFSD_DEBUG(4, "possible match\n"); @@ -6582,9 +6582,10 @@ nfsrv_flexmirrordel(char *devid, NFSPROC_T *p) == 0) { /* Found one. */ NFSD_DEBUG(4, "fnd one\n"); - LIST_REMOVE(lyp, lay_list); - LIST_INSERT_HEAD(&loclyp, lyp, + TAILQ_REMOVE(&lhyp->list, lyp, lay_list); + TAILQ_INSERT_HEAD(&loclyp, lyp, + lay_list); break; } tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED + @@ -6597,7 +6598,7 @@ nfsrv_flexmirrordel(char *devid, NFSPROC_T *p) } /* Now, try to do a Layout recall for each one found. */ - LIST_FOREACH_SAFE(lyp, &loclyp, lay_list, nlyp) { + TAILQ_FOREACH_SAFE(lyp, &loclyp, lay_list, nlyp) { NFSD_DEBUG(4, "do layout recall\n"); /* * The layout stateid.seqid needs to be incremented @@ -6606,7 +6607,7 @@ nfsrv_flexmirrordel(char *devid, NFSPROC_T *p) if (++lyp->lay_stateid.seqid == 0) lyp->lay_stateid.seqid = 1; nfsrv_recalllayout(lyp, p); - nfsrv_freelayout(lyp); + nfsrv_freelayout(&loclyp, lyp); } } @@ -6696,7 +6697,8 @@ nfsrv_layoutreturn(struct nfsrv_descript *nd, vnode_t lyp->lay_flags &= ~NFSLAY_RW; if ((lyp->lay_flags & (NFSLAY_READ | NFSLAY_RW)) == 0) - nfsrv_freelayout(lyp); + nfsrv_freelayout(&lhyp->list, + lyp); else *fndp = 1; } else @@ -6704,7 +6706,7 @@ nfsrv_layoutreturn(struct nfsrv_descript *nd, vnode_t } NFSUNLOCKLAYOUT(lhyp); /* Search the nfsrv_recalllist for a match. */ - LIST_FOREACH(lyp, &nfsrv_recalllisthead, lay_list) { + TAILQ_FOREACH(lyp, &nfsrv_recalllisthead, lay_list) { if (NFSBCMP(&lyp->lay_fh, &fh, sizeof(fh)) == 0 && lyp->lay_clientid.qval == @@ -6752,7 +6754,7 @@ nfsrv_findlayout(struct nfsrv_descript *nd, fhandle_t *lypp = NULL; ret = 0; lhyp = NFSLAYOUTHASH(fhp); - LIST_FOREACH(lyp, &lhyp->list, lay_list) { + TAILQ_FOREACH(lyp, &lhyp->list, lay_list) { if (NFSBCMP(&lyp->lay_fh, fhp, sizeof(*fhp)) == 0 && lyp->lay_clientid.qval == nd->nd_clientid.qval && lyp->lay_type == laytype) @@ -6800,7 +6802,7 @@ nfsrv_addlayout(struct nfsrv_descript *nd, struct nfsl lhyp = NFSLAYOUTHASH(fhp); NFSLOCKLAYOUT(lhyp); - LIST_FOREACH(nlyp, &lhyp->list, lay_list) { + TAILQ_FOREACH(nlyp, &lhyp->list, lay_list) { if (NFSBCMP(&nlyp->lay_fh, fhp, sizeof(*fhp)) == 0 && nlyp->lay_clientid.qval == nd->nd_clientid.qval) break; @@ -6824,7 +6826,7 @@ nfsrv_addlayout(struct nfsrv_descript *nd, struct nfsl *lypp = NULL; NFSBCOPY(lyp->lay_xdr, layp, lyp->lay_layoutlen); *layoutlenp = lyp->lay_layoutlen; - LIST_INSERT_HEAD(&lhyp->list, lyp, lay_list); + TAILQ_INSERT_HEAD(&lhyp->list, lyp, lay_list); NFSUNLOCKLAYOUT(lhyp); return (0); } @@ -6910,9 +6912,9 @@ nfsrv_freelayoutlist(nfsquad_t clientid) for (i = 0; i < nfsrv_layouthashsize; i++) { lhyp = &nfslayouthash[i]; NFSLOCKLAYOUT(lhyp); - LIST_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) { + TAILQ_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) { if (lyp->lay_clientid.qval == clientid.qval) - nfsrv_freelayout(lyp); + nfsrv_freelayout(&lhyp->list, lyp); } NFSUNLOCKLAYOUT(lhyp); } @@ -6922,11 +6924,11 @@ nfsrv_freelayoutlist(nfsquad_t clientid) * Free up a layout. */ static void -nfsrv_freelayout(struct nfslayout *lyp) +nfsrv_freelayout(struct nfslayouthead *lhp, struct nfslayout *lyp) { NFSD_DEBUG(4, "Freelayout=%p\n", lyp); - LIST_REMOVE(lyp, lay_list); + TAILQ_REMOVE(lhp, lyp, lay_list); free(lyp, M_NFSDSTATE); } @@ -6989,9 +6991,9 @@ nfsrv_freealllayoutsanddevids(void) nfsrv_dontlistlen = 0; /* Free layouts in the recall list. */ - LIST_FOREACH_SAFE(lyp, &nfsrv_recalllisthead, lay_list, nlyp) - nfsrv_freelayout(lyp); - LIST_INIT(&nfsrv_recalllisthead); + TAILQ_FOREACH_SAFE(lyp, &nfsrv_recalllisthead, lay_list, nlyp) + nfsrv_freelayout(&nfsrv_recalllisthead, lyp); + TAILQ_INIT(&nfsrv_recalllisthead); } /* @@ -7007,7 +7009,7 @@ nfsrv_freelayouts(nfsquad_t *clid, fsid_t *fs, int lay for (i = 0; i < nfsrv_layouthashsize; i++) { lhyp = &nfslayouthash[i]; NFSLOCKLAYOUT(lhyp); - LIST_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) { + TAILQ_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) { if (clid->qval != lyp->lay_clientid.qval) continue; if (fs != NULL && (fs->val[0] != lyp->lay_fsid.val[0] || @@ -7020,7 +7022,7 @@ nfsrv_freelayouts(nfsquad_t *clid, fsid_t *fs, int lay if ((iomode & NFSLAYOUTIOMODE_RW) != 0) lyp->lay_flags &= ~NFSLAY_RW; if ((lyp->lay_flags & (NFSLAY_READ | NFSLAY_RW)) == 0) - nfsrv_freelayout(lyp); + nfsrv_freelayout(&lhyp->list, lyp); } NFSUNLOCKLAYOUT(lhyp); } @@ -7034,17 +7036,14 @@ nfsrv_freefilelayouts(fhandle_t *fhp) { struct nfslayouthash *lhyp; struct nfslayout *lyp, *nlyp; - int i; - for (i = 0; i < nfsrv_layouthashsize; i++) { - lhyp = &nfslayouthash[i]; - NFSLOCKLAYOUT(lhyp); - LIST_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) { - if (NFSBCMP(&lyp->lay_fh, fhp, sizeof(*fhp)) == 0) - nfsrv_freelayout(lyp); - } - NFSUNLOCKLAYOUT(lhyp); + lhyp = NFSLAYOUTHASH(fhp); + NFSLOCKLAYOUT(lhyp); + TAILQ_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) { + if (NFSBCMP(&lyp->lay_fh, fhp, sizeof(*fhp)) == 0) + nfsrv_freelayout(&lhyp->list, lyp); } + NFSUNLOCKLAYOUT(lhyp); } /* @@ -7060,8 +7059,8 @@ nfsrv_freealllayouts(void) for (i = 0; i < nfsrv_layouthashsize; i++) { lhyp = &nfslayouthash[i]; NFSLOCKLAYOUT(lhyp); - LIST_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) - nfsrv_freelayout(lyp); + TAILQ_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) + nfsrv_freelayout(&lhyp->list, lyp); NFSUNLOCKLAYOUT(lhyp); } } @@ -7551,7 +7550,7 @@ nfsrv_checkdsattr(struct nfsrv_descript *nd, vnode_t v clidcnt = 0; lhyp = NFSLAYOUTHASH(&fh); NFSLOCKLAYOUT(lhyp); - LIST_FOREACH(lyp, &lhyp->list, lay_list) { + TAILQ_FOREACH(lyp, &lhyp->list, lay_list) { if (NFSBCMP(&lyp->lay_fh, &fh, sizeof(fh)) == 0 && ((lyp->lay_flags & NFSLAY_RW) != 0 || ((lyp->lay_flags & NFSLAY_READ) != 0 && @@ -7725,11 +7724,11 @@ nfsrv_copymr(vnode_t vp, vnode_t fvp, vnode_t dvp, str lhyp = NFSLAYOUTHASH(&fh); NFSDRECALLLOCK(); NFSLOCKLAYOUT(lhyp); - LIST_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) { + TAILQ_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) { if (NFSBCMP(&lyp->lay_fh, &fh, sizeof(fh)) == 0 && (lyp->lay_flags & NFSLAY_RW) != 0) { - LIST_REMOVE(lyp, lay_list); - LIST_INSERT_HEAD(&nfsrv_recalllisthead, lyp, lay_list); + TAILQ_REMOVE(&lhyp->list, lyp, lay_list); + TAILQ_INSERT_HEAD(&nfsrv_recalllisthead, lyp, lay_list); } } NFSUNLOCKLAYOUT(lhyp); @@ -7737,13 +7736,13 @@ nfsrv_copymr(vnode_t vp, vnode_t fvp, vnode_t dvp, str ret = 0; didprintf = 0; - LIST_INIT(&thl); + TAILQ_INIT(&thl); /* Unlock the MDS vp, so that a LayoutReturn can be done on it. */ NFSVOPUNLOCK(vp, 0); /* Now, do a recall for all layouts not yet recalled. */ tryagain: NFSDRECALLLOCK(); - LIST_FOREACH(lyp, &nfsrv_recalllisthead, lay_list) { + TAILQ_FOREACH(lyp, &nfsrv_recalllisthead, lay_list) { if (NFSBCMP(&lyp->lay_fh, &fh, sizeof(fh)) == 0 && (lyp->lay_flags & NFSLAY_RECALL) == 0) { lyp->lay_flags |= NFSLAY_RECALL; @@ -7762,11 +7761,12 @@ tryagain: /* Now wait for them to be returned. */ tryagain2: - LIST_FOREACH(lyp, &nfsrv_recalllisthead, lay_list) { + TAILQ_FOREACH(lyp, &nfsrv_recalllisthead, lay_list) { if (NFSBCMP(&lyp->lay_fh, &fh, sizeof(fh)) == 0) { if ((lyp->lay_flags & NFSLAY_RETURNED) != 0) { - LIST_REMOVE(lyp, lay_list); - LIST_INSERT_HEAD(&thl, lyp, lay_list); + TAILQ_REMOVE(&nfsrv_recalllisthead, lyp, + lay_list); + TAILQ_INSERT_HEAD(&thl, lyp, lay_list); NFSD_DEBUG(4, "nfsrv_copymr: layout returned\n"); } else { @@ -7788,8 +7788,8 @@ tryagain2: } NFSDRECALLUNLOCK(); /* We can now get rid of the layouts that have been returned. */ - LIST_FOREACH_SAFE(lyp, &thl, lay_list, nlyp) - nfsrv_freelayout(lyp); + TAILQ_FOREACH_SAFE(lyp, &thl, lay_list, nlyp) + nfsrv_freelayout(&thl, lyp); /* * LK_EXCLUSIVE lock the MDS vnode, so that any Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsubs.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsubs.c Mon May 21 00:32:48 2018 (r333949) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsubs.c Mon May 21 00:51:30 2018 (r333950) @@ -2068,10 +2068,10 @@ nfsd_init(void) 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); + TAILQ_INIT(&nfslayouthash[i].list); } LIST_INIT(&nfsrv_dontlisthead); - LIST_INIT(&nfsrv_recalllisthead); + TAILQ_INIT(&nfsrv_recalllisthead); /* and the v2 pubfh should be all zeros */ NFSBZERO(nfs_v2pubfh, NFSX_V2FH); From owner-svn-src-projects@freebsd.org Mon May 21 01:07:00 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79799EA9824 for ; Mon, 21 May 2018 01:07:00 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C31B8036F; Mon, 21 May 2018 01:07:00 +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 0E5A41E020; Mon, 21 May 2018 01:07:00 +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 w4L16xKV093646; Mon, 21 May 2018 01:06:59 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4L16xb5093645; Mon, 21 May 2018 01:06:59 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201805210106.w4L16xb5093645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 21 May 2018 01:06:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r333953 - projects/pnfs-planb-server/sys/fs/nfsserver X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/pnfs-planb-server/sys/fs/nfsserver X-SVN-Commit-Revision: 333953 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.26 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: Mon, 21 May 2018 01:07:00 -0000 Author: rmacklem Date: Mon May 21 01:06:59 2018 New Revision: 333953 URL: https://svnweb.freebsd.org/changeset/base/333953 Log: Add support for a "reclaim" LayoutReturn. Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Mon May 21 01:05:32 2018 (r333952) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Mon May 21 01:06:59 2018 (r333953) @@ -6666,6 +6666,13 @@ nfsrv_layoutreturn(struct nfsrv_descript *nd, vnode_t " failed=%d\n", error); } if (error == 0) { + if (reclaim == newnfs_true) { + error = nfsrv_checkgrace(NULL, NULL, + NFSLCK_RECLAIM); + if (error != NFSERR_NOGRACE) + error = 0; + return (error); + } lhyp = NFSLAYOUTHASH(&fh); NFSDRECALLLOCK(); NFSLOCKLAYOUT(lhyp); From owner-svn-src-projects@freebsd.org Mon May 21 13:08:20 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 170DFEF091F for ; Mon, 21 May 2018 13:08:20 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B8D457D24E; Mon, 21 May 2018 13:08:19 +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 9668E253EF; Mon, 21 May 2018 13:08: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 w4LD8J2t061210; Mon, 21 May 2018 13:08:19 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4LD8I6e061206; Mon, 21 May 2018 13:08:18 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201805211308.w4LD8I6e061206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 21 May 2018 13:08:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r333977 - in projects/pnfs-planb-server/sys/fs: nfs nfsserver X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in projects/pnfs-planb-server/sys/fs: nfs nfsserver X-SVN-Commit-Revision: 333977 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.26 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: Mon, 21 May 2018 13:08:20 -0000 Author: rmacklem Date: Mon May 21 13:08:18 2018 New Revision: 333977 URL: https://svnweb.freebsd.org/changeset/base/333977 Log: Only allocate the nfslayouthash table when a pNFS service is started the first time. This allows the allocation to be quite large, since pNFS MDS servers will normally be dedicated fairly large servers. Replace vfs.nfsd.layouthashsize with vfs.nfsd.layouthighwater, so that both the maximum # of layouts in the server and the size of the hash table can both be tuned with this. Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs.h projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsubs.c Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs.h ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfs/nfs.h Mon May 21 11:58:02 2018 (r333976) +++ projects/pnfs-planb-server/sys/fs/nfs/nfs.h Mon May 21 13:08:18 2018 (r333977) @@ -98,7 +98,7 @@ #define NFSSESSIONHASHSIZE 20 /* Size of server session hash table */ #endif #define NFSSTATEHASHSIZE 10 /* Size of server stateid hash table */ -#define NFSLAYOUTHASHSIZE 100 /* Size of server layout hash table */ +#define NFSLAYOUTHIGHWATER 1000000 /* Upper limit for # of layouts */ #ifndef NFSCLDELEGHIGHWATER #define NFSCLDELEGHIGHWATER 10000 /* limit for client delegations */ #endif Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c Mon May 21 11:58:02 2018 (r333976) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c Mon May 21 13:08:18 2018 (r333977) @@ -5496,13 +5496,15 @@ nfsd_modevent(module_t mod, int type, void *data) mtx_destroy(&nfsrv_recalllock_mtx); for (i = 0; i < nfsrv_sessionhashsize; i++) mtx_destroy(&nfssessionhash[i].mtx); - for (i = 0; i < nfsrv_layouthashsize; i++) - mtx_destroy(&nfslayouthash[i].mtx); + if (nfslayouthash != NULL) { + for (i = 0; i < nfsrv_layouthashsize; i++) + mtx_destroy(&nfslayouthash[i].mtx); + free(nfslayouthash, M_NFSDSESSION); + } lockdestroy(&nfsv4root_mnt.mnt_explock); free(nfsclienthash, M_NFSDCLIENT); free(nfslockhash, M_NFSDLOCKFILE); free(nfssessionhash, M_NFSDSESSION); - free(nfslayouthash, M_NFSDSESSION); loaded = 0; break; default: Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Mon May 21 11:58:02 2018 (r333976) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Mon May 21 13:08:18 2018 (r333977) @@ -39,6 +39,7 @@ int nfsrv_issuedelegs = 0; int nfsrv_dolocallocks = 0; struct nfsv4lock nfsv4rootfs_lock; time_t nfsdev_time = 0; +int nfsrv_layouthashsize; extern int newnfs_numnfsd; extern struct nfsstatsv1 nfsstatsv1; @@ -80,10 +81,10 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, sessionhashsize, CTLFL &nfsrv_sessionhashsize, 0, "Size of session hash table set via loader.conf"); -int nfsrv_layouthashsize = NFSLAYOUTHASHSIZE; -SYSCTL_INT(_vfs_nfsd, OID_AUTO, layouthashsize, CTLFLAG_RDTUN, - &nfsrv_layouthashsize, 0, - "Size of layout hash table set via loader.conf"); +int nfsrv_layouthighwater = NFSLAYOUTHIGHWATER; +SYSCTL_INT(_vfs_nfsd, OID_AUTO, layouthighwater, CTLFLAG_RDTUN, + &nfsrv_layouthighwater, 0, + "High water mark for number of layouts set via loader.conf"); static int nfsrv_v4statelimit = NFSRV_V4STATELIMIT; SYSCTL_INT(_vfs_nfsd, OID_AUTO, v4statelimit, CTLFLAG_RWTUN, @@ -7476,7 +7477,7 @@ nfsrv_createdevids(struct nfsd_nfsd_args *args, NFSPRO { struct nfsdevice *ds; char *addrp, *dnshostp, *dspathp, *mirrorp; - int error; + int error, i; addrp = args->addr; dnshostp = args->dnshost; @@ -7511,6 +7512,23 @@ nfsrv_createdevids(struct nfsd_nfsd_args *args, NFSPRO dnshostp += (strlen(dnshostp) + 1); dspathp += (strlen(dspathp) + 1); mirrorp += (strlen(mirrorp) + 1); + } + + /* + * Allocate the nfslayout hash table now, since this is a pNFS server. + * Make it 1% of the high water mark and at least 100. + */ + if (nfslayouthash == NULL) { + nfsrv_layouthashsize = nfsrv_layouthighwater / 100; + if (nfsrv_layouthashsize < 100) + nfsrv_layouthashsize = 100; + nfslayouthash = mallocarray(nfsrv_layouthashsize, + sizeof(struct nfslayouthash), M_NFSDSESSION, M_WAITOK | + M_ZERO); + for (i = 0; i < nfsrv_layouthashsize; i++) { + mtx_init(&nfslayouthash[i].mtx, "nfslm", NULL, MTX_DEF); + TAILQ_INIT(&nfslayouthash[i].list); + } } return (0); } Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsubs.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsubs.c Mon May 21 11:58:02 2018 (r333976) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsubs.c Mon May 21 13:08:18 2018 (r333977) @@ -52,8 +52,6 @@ extern struct nfslockhashhead *nfslockhash; 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; @@ -2063,12 +2061,6 @@ nfsd_init(void) for (i = 0; i < nfsrv_sessionhashsize; i++) { 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); - TAILQ_INIT(&nfslayouthash[i].list); } LIST_INIT(&nfsrv_dontlisthead); TAILQ_INIT(&nfsrv_recalllisthead); From owner-svn-src-projects@freebsd.org Mon May 21 20:20:29 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0D30EFD671 for ; Mon, 21 May 2018 20:20:29 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 825156E79E; Mon, 21 May 2018 20:20:29 +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 604451A5D; Mon, 21 May 2018 20:20:29 +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 w4LKKT6K081688; Mon, 21 May 2018 20:20:29 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4LKKTUe081687; Mon, 21 May 2018 20:20:29 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201805212020.w4LKKTUe081687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 21 May 2018 20:20:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r333993 - projects/pnfs-planb-server/sys/fs/nfsserver X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/pnfs-planb-server/sys/fs/nfsserver X-SVN-Commit-Revision: 333993 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.26 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: Mon, 21 May 2018 20:20:30 -0000 Author: rmacklem Date: Mon May 21 20:20:28 2018 New Revision: 333993 URL: https://svnweb.freebsd.org/changeset/base/333993 Log: No need to M_ZERO the structures, since the loop initializes all fields. Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Mon May 21 19:15:05 2018 (r333992) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Mon May 21 20:20:28 2018 (r333993) @@ -7523,8 +7523,7 @@ nfsrv_createdevids(struct nfsd_nfsd_args *args, NFSPRO if (nfsrv_layouthashsize < 100) nfsrv_layouthashsize = 100; nfslayouthash = mallocarray(nfsrv_layouthashsize, - sizeof(struct nfslayouthash), M_NFSDSESSION, M_WAITOK | - M_ZERO); + sizeof(struct nfslayouthash), M_NFSDSESSION, M_WAITOK); for (i = 0; i < nfsrv_layouthashsize; i++) { mtx_init(&nfslayouthash[i].mtx, "nfslm", NULL, MTX_DEF); TAILQ_INIT(&nfslayouthash[i].list); From owner-svn-src-projects@freebsd.org Mon May 21 20:54:55 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36AEBEFE114 for ; Mon, 21 May 2018 20:54:55 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D09F16FF63; Mon, 21 May 2018 20:54:54 +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 AC32C20BA; Mon, 21 May 2018 20:54:54 +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 w4LKssxI001776; Mon, 21 May 2018 20:54:54 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4LKsst0001775; Mon, 21 May 2018 20:54:54 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201805212054.w4LKsst0001775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 21 May 2018 20:54:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r333996 - projects/pnfs-planb-server/sys/fs/nfsserver X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/pnfs-planb-server/sys/fs/nfsserver X-SVN-Commit-Revision: 333996 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.26 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: Mon, 21 May 2018 20:54:55 -0000 Author: rmacklem Date: Mon May 21 20:54:54 2018 New Revision: 333996 URL: https://svnweb.freebsd.org/changeset/base/333996 Log: Revert r333993 since it turns out mtx_init() does want the "struct mtx" zeroed out. Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Mon May 21 20:35:16 2018 (r333995) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Mon May 21 20:54:54 2018 (r333996) @@ -7523,7 +7523,8 @@ nfsrv_createdevids(struct nfsd_nfsd_args *args, NFSPRO if (nfsrv_layouthashsize < 100) nfsrv_layouthashsize = 100; nfslayouthash = mallocarray(nfsrv_layouthashsize, - sizeof(struct nfslayouthash), M_NFSDSESSION, M_WAITOK); + sizeof(struct nfslayouthash), M_NFSDSESSION, M_WAITOK | + M_ZERO); for (i = 0; i < nfsrv_layouthashsize; i++) { mtx_init(&nfslayouthash[i].mtx, "nfslm", NULL, MTX_DEF); TAILQ_INIT(&nfslayouthash[i].list); From owner-svn-src-projects@freebsd.org Tue May 22 11:57:12 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08071EF2B5A for ; Tue, 22 May 2018 11:57:12 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B190970D9A; Tue, 22 May 2018 11:57:11 +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 9446713B14; Tue, 22 May 2018 11:57:11 +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 w4MBvBmR058354; Tue, 22 May 2018 11:57:11 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4MBvAsB058350; Tue, 22 May 2018 11:57:10 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201805221157.w4MBvAsB058350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 22 May 2018 11:57:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r334036 - in projects/pnfs-planb-server/sys/fs: nfs nfsserver X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in projects/pnfs-planb-server/sys/fs: nfs nfsserver X-SVN-Commit-Revision: 334036 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.26 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, 22 May 2018 11:57:12 -0000 Author: rmacklem Date: Tue May 22 11:57:10 2018 New Revision: 334036 URL: https://svnweb.freebsd.org/changeset/base/334036 Log: Add code that does CBLAYOUTRECALLs when the total # of layouts exceeds the vfs.nfsd.layouthighwater limit. Unfortunately this required changes to the arguments for nfsrv_recalllayout() and nfsrv_docallback() so the patch got bigger than it would have been. Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsocket.c projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h Tue May 22 11:26:41 2018 (r334035) +++ projects/pnfs-planb-server/sys/fs/nfs/nfs_var.h Tue May 22 11:57:10 2018 (r334036) @@ -149,6 +149,7 @@ int nfsrv_layoutget(struct nfsrv_descript *, vnode_t, int, int *, uint64_t *, uint64_t *, uint64_t, nfsv4stateid_t *, int, int *, int *, char *, struct ucred *, NFSPROC_T *); void nfsrv_flexmirrordel(char *, NFSPROC_T *); +void nfsrv_recalloldlayout(NFSPROC_T *); int nfsrv_layoutreturn(struct nfsrv_descript *, vnode_t, int, int, uint64_t, uint64_t, int, int, nfsv4stateid_t *, int, uint32_t *, int *, struct ucred *, NFSPROC_T *); Modified: projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h Tue May 22 11:26:41 2018 (r334035) +++ projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h Tue May 22 11:57:10 2018 (r334036) @@ -145,6 +145,7 @@ struct nfslayout { #define NFSLAY_RW 0x0002 #define NFSLAY_RECALL 0x0004 #define NFSLAY_RETURNED 0x0008 +#define NFSLAY_CALLB 0x0010 /* * Structure for an NFSv4.1 session. @@ -290,7 +291,6 @@ 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 */ Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsocket.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsocket.c Tue May 22 11:26:41 2018 (r334035) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdsocket.c Tue May 22 11:57:10 2018 (r334036) @@ -52,6 +52,8 @@ extern struct nfsclienthashhead *nfsclienthash; extern int nfsrv_clienthashsize; extern int nfsrc_floodlevel, nfsrc_tcpsavedreplies; extern int nfsd_debuglevel; +extern int nfsrv_layouthighwater; +extern volatile int nfsrv_layoutcnt; NFSV4ROOTLOCKMUTEX; NFSSTATESPINLOCK; @@ -726,6 +728,10 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram if (nfsrv_stablefirst.nsf_flags & NFSNSF_NOOPENS) { nfsrv_throwawayopens(p); } + + /* Do a CBLAYOUTRECALL callback if over the high water mark. */ + if (nfsrv_layoutcnt > nfsrv_layouthighwater) + nfsrv_recalloldlayout(p); savevp = vp = NULL; save_fsid.val[0] = save_fsid.val[1] = 0; Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Tue May 22 11:26:41 2018 (r334035) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Tue May 22 11:57:10 2018 (r334036) @@ -40,6 +40,7 @@ int nfsrv_dolocallocks = 0; struct nfsv4lock nfsv4rootfs_lock; time_t nfsdev_time = 0; int nfsrv_layouthashsize; +volatile int nfsrv_layoutcnt = 0; extern int newnfs_numnfsd; extern struct nfsstatsv1 nfsstatsv1; @@ -161,8 +162,7 @@ static int nfsrv_checkgrace(struct nfsrv_descript *nd, u_int32_t flags); static int nfsrv_docallback(struct nfsclient *clp, int procnum, nfsv4stateid_t *stateidp, int trunc, fhandle_t *fhp, - struct nfsvattr *nap, nfsattrbit_t *attrbitp, struct nfslayout *, - NFSPROC_T *p); + struct nfsvattr *nap, nfsattrbit_t *attrbitp, int laytype, NFSPROC_T *p); static int nfsrv_cbcallargs(struct nfsrv_descript *nd, struct nfsclient *clp, uint32_t callback, int op, const char *optag, struct nfsdsession **sepp); static u_int32_t nfsrv_nextclientindex(void); @@ -216,9 +216,10 @@ static void nfsrv_allocdevid(struct nfsdevice *ds, cha static void nfsrv_freealldevids(void); static void nfsrv_flexlayouterr(struct nfsrv_descript *nd, uint32_t *layp, int maxcnt, NFSPROC_T *p); -static void nfsrv_recalllayout(struct nfslayout *lyp, NFSPROC_T *p); -static int nfsrv_findlayout(struct nfsrv_descript *nd, fhandle_t *fhp, - int laytype, NFSPROC_T *, struct nfslayout **lypp); +static int nfsrv_recalllayout(nfsquad_t clid, nfsv4stateid_t *stateidp, + fhandle_t *fhp, struct nfslayout *lyp, int laytype, NFSPROC_T *p); +static int nfsrv_findlayout(nfsquad_t *clientidp, fhandle_t *fhp, int laytype, + NFSPROC_T *, struct nfslayout **lypp); static int nfsrv_fndclid(nfsquad_t *clidvec, nfsquad_t clid, int clidcnt); static struct nfslayout *nfsrv_filelayout(struct nfsrv_descript *nd, int iomode, fhandle_t *fhp, fhandle_t *dsfhp, char *devid, fsid_t fs); @@ -1288,7 +1289,7 @@ nfsrv_zapclient(struct nfsclient *clp, NFSPROC_T *p) clp->lc_hand.nfsh_flag &= ~NFSG_COMPLETE; clp->lc_hand.nfsh_flag |= NFSG_DESTROYED; (void) nfsrv_docallback(clp, NFSV4PROC_CBNULL, - NULL, 0, NULL, NULL, NULL, NULL, p); + NULL, 0, NULL, NULL, NULL, 0, p); } #endif newnfs_disconnect(&clp->lc_req); @@ -2641,7 +2642,7 @@ tryagain: * harmless. */ cbret = nfsrv_docallback(clp, NFSV4PROC_CBNULL, - NULL, 0, NULL, NULL, NULL, NULL, p); + NULL, 0, NULL, NULL, NULL, 0, p); NFSLOCKSTATE(); clp->lc_flags &= ~LCL_NEEDSCBNULL; if (!cbret) @@ -4196,10 +4197,9 @@ out: * Do a server callback. */ static int -nfsrv_docallback(struct nfsclient *clp, int procnum, - nfsv4stateid_t *stateidp, int trunc, fhandle_t *fhp, - struct nfsvattr *nap, nfsattrbit_t *attrbitp, struct nfslayout *lyp, - NFSPROC_T *p) +nfsrv_docallback(struct nfsclient *clp, int procnum, nfsv4stateid_t *stateidp, + int trunc, fhandle_t *fhp, struct nfsvattr *nap, nfsattrbit_t *attrbitp, + int laytype, NFSPROC_T *p) { mbuf_t m; u_int32_t *tl; @@ -4295,18 +4295,18 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, goto errout; } NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED); - *tl++ = txdr_unsigned(NFSLAYOUT_FLEXFILE); + *tl++ = txdr_unsigned(laytype); *tl++ = txdr_unsigned(NFSLAYOUTIOMODE_ANY); *tl++ = newnfs_true; *tl = txdr_unsigned(NFSV4LAYOUTRET_FILE); - nfsm_fhtom(nd, (uint8_t *)&lyp->lay_fh, NFSX_MYFH, 0); + nfsm_fhtom(nd, (uint8_t *)fhp, NFSX_MYFH, 0); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_HYPER + NFSX_STATEID); tval = 0; txdr_hyper(tval, tl); tl += 2; tval = UINT64_MAX; txdr_hyper(tval, tl); tl += 2; - *tl++ = txdr_unsigned(lyp->lay_stateid.seqid); - NFSBCOPY(lyp->lay_stateid.other, tl, NFSX_STATEIDOTHER); + *tl++ = txdr_unsigned(stateidp->seqid); + NFSBCOPY(stateidp->other, tl, NFSX_STATEIDOTHER); tl += (NFSX_STATEIDOTHER / NFSX_UNSIGNED); NFSD_DEBUG(4, "aft args\n"); } else if (procnum == NFSV4PROC_CBNULL) { @@ -5043,7 +5043,7 @@ nfsrv_delegconflict(struct nfsstate *stp, int *haslock retrycnt = 0; do { error = nfsrv_docallback(clp, NFSV4OP_CBRECALL, - &tstateid, 0, &tfh, NULL, NULL, NULL, p); + &tstateid, 0, &tfh, NULL, NULL, 0, p); retrycnt++; } while ((error == NFSERR_BADSTATEID || error == NFSERR_BADHANDLE) && retrycnt < NFSV4_CBRETRYCNT); @@ -5479,7 +5479,7 @@ nfsrv_checkgetattr(struct nfsrv_descript *nd, vnode_t NFSVNO_ATTRINIT(&nva); nva.na_filerev = NFS64BITSSET; error = nfsrv_docallback(clp, NFSV4OP_CBGETATTR, NULL, - 0, &nfh, &nva, &cbbits, NULL, p); + 0, &nfh, &nva, &cbbits, 0, p); if (!error) { if ((nva.na_filerev != NFS64BITSSET && nva.na_filerev > delegfilerev) || @@ -6326,19 +6326,36 @@ nfsrv_layoutget(struct nfsrv_descript *nd, vnode_t vp, /* First, see if a layout already exists and return if found. */ lhyp = NFSLAYOUTHASH(&fh); NFSLOCKLAYOUT(lhyp); - error = nfsrv_findlayout(nd, &fh, layouttype, p, &lyp); + error = nfsrv_findlayout(&nd->nd_clientid, &fh, layouttype, p, &lyp); NFSD_DEBUG(4, "layoutget findlay=%d\n", error); - if (error == 0) { - /* - * Not sure if the seqid must be the same, so I won't check it. - */ - if (stateidp->other[0] != lyp->lay_stateid.other[0] || - stateidp->other[1] != lyp->lay_stateid.other[1] || - stateidp->other[2] != lyp->lay_stateid.other[2]) { + /* + * Not sure if the seqid must be the same, so I won't check it. + */ + if (error == 0 && (stateidp->other[0] != lyp->lay_stateid.other[0] || + stateidp->other[1] != lyp->lay_stateid.other[1] || + stateidp->other[2] != lyp->lay_stateid.other[2])) { + if ((lyp->lay_flags & NFSLAY_CALLB) == 0) { NFSUNLOCKLAYOUT(lhyp); NFSD_DEBUG(1, "ret bad stateid\n"); return (NFSERR_BADSTATEID); } + /* + * I believe we get here because there is a race between + * the client processing the CBLAYOUTRECALL and the layout + * being deleted here on the server. + * The client has now done a LayoutGet with a non-layout + * stateid, as it would when there is no layout. + * As such, free this layout and set error == NFSERR_BADSTATEID + * so the code below will create a new layout structure as + * would happen if no layout was found. + * "lyp" will be set before being used below, but set it NULL + * as a safety belt. + */ + nfsrv_freelayout(&lhyp->list, lyp); + lyp = NULL; + error = NFSERR_BADSTATEID; + } + if (error == 0) { if (lyp->lay_layoutlen > maxcnt) { NFSUNLOCKLAYOUT(lhyp); NFSD_DEBUG(1, "ret layout too small\n"); @@ -6607,7 +6624,8 @@ nfsrv_flexmirrordel(char *devid, NFSPROC_T *p) */ if (++lyp->lay_stateid.seqid == 0) lyp->lay_stateid.seqid = 1; - nfsrv_recalllayout(lyp, p); + nfsrv_recalllayout(lyp->lay_clientid, &lyp->lay_stateid, + &lyp->lay_fh, lyp, lyp->lay_type, p); nfsrv_freelayout(&loclyp, lyp); } } @@ -6615,22 +6633,23 @@ nfsrv_flexmirrordel(char *devid, NFSPROC_T *p) /* * Do a recall callback to the client for this layout. */ -static void -nfsrv_recalllayout(struct nfslayout *lyp, NFSPROC_T *p) +static int +nfsrv_recalllayout(nfsquad_t clid, nfsv4stateid_t *stateidp, fhandle_t *fhp, + struct nfslayout *lyp, int laytype, NFSPROC_T *p) { struct nfsclient *clp; int error; NFSD_DEBUG(4, "nfsrv_recalllayout\n"); - error = nfsrv_getclient(lyp->lay_clientid, 0, &clp, NULL, - (nfsquad_t)((u_quad_t)0), 0, NULL, p); + error = nfsrv_getclient(clid, 0, &clp, NULL, (nfsquad_t)((u_quad_t)0), + 0, NULL, p); NFSD_DEBUG(4, "aft nfsrv_getclient=%d\n", error); if (error != 0) - return; + return (error); if ((clp->lc_flags & LCL_NFSV41) != 0) { - error = nfsrv_docallback(clp, NFSV4OP_CBLAYOUTRECALL, NULL, 0, - NULL, NULL, NULL, lyp, p); - if (error == NFSERR_NOMATCHLAYOUT) { + error = nfsrv_docallback(clp, NFSV4OP_CBLAYOUTRECALL, + stateidp, 0, fhp, NULL, NULL, laytype, p); + if (lyp != NULL && error == NFSERR_NOMATCHLAYOUT) { NFSDRECALLLOCK(); if ((lyp->lay_flags & NFSLAY_RECALL) != 0) { lyp->lay_flags |= NFSLAY_RETURNED; @@ -6640,9 +6659,68 @@ nfsrv_recalllayout(struct nfslayout *lyp, NFSPROC_T *p } } else printf("nfsrv_recalllayout: clp not NFSv4.1\n"); + return (error); } /* + * Find a layout to recall when we exceed our high water mark. + */ +void +nfsrv_recalloldlayout(NFSPROC_T *p) +{ + struct nfslayouthash *lhyp; + struct nfslayout *lyp; + nfsquad_t clientid; + nfsv4stateid_t stateid; + fhandle_t fh; + int error, laytype; + + lhyp = &nfslayouthash[arc4random() % nfsrv_layouthashsize]; + NFSLOCKLAYOUT(lhyp); + TAILQ_FOREACH_REVERSE(lyp, &lhyp->list, nfslayouthead, lay_list) { + if ((lyp->lay_flags & NFSLAY_CALLB) == 0) { + lyp->lay_flags |= NFSLAY_CALLB; + /* + * The layout stateid.seqid needs to be incremented + * before doing a LAYOUT_RECALL callback. + */ + if (++lyp->lay_stateid.seqid == 0) + lyp->lay_stateid.seqid = 1; + clientid = lyp->lay_clientid; + stateid = lyp->lay_stateid; + fh = lyp->lay_fh; + laytype = lyp->lay_type; + break; + } + } + NFSUNLOCKLAYOUT(lhyp); + if (lyp != NULL) { + error = nfsrv_recalllayout(clientid, &stateid, &fh, NULL, + laytype, p); + if (error != 0 && error != NFSERR_NOMATCHLAYOUT) + printf("recallold=%d\n", error); + if (error == NFSERR_NOMATCHLAYOUT) { + /* + * The client no longer knows this layout, so it can + * be free'd now. + * Since the hash list was unlocked, we need to find + * it again. + */ + NFSLOCKLAYOUT(lhyp); + error = nfsrv_findlayout(&clientid, &fh, laytype, p, + &lyp); + if (error == 0 && + (lyp->lay_flags & NFSLAY_CALLB) != 0 && + lyp->lay_stateid.other[0] == stateid.other[0] && + lyp->lay_stateid.other[1] == stateid.other[1] && + lyp->lay_stateid.other[2] == stateid.other[2]) + nfsrv_freelayout(&lhyp->list, lyp); + NFSUNLOCKLAYOUT(lhyp); + } + } +} + +/* * Try and return layout(s). */ int @@ -6677,7 +6755,8 @@ nfsrv_layoutreturn(struct nfsrv_descript *nd, vnode_t lhyp = NFSLAYOUTHASH(&fh); NFSDRECALLLOCK(); NFSLOCKLAYOUT(lhyp); - error = nfsrv_findlayout(nd, &fh, layouttype, p, &lyp); + error = nfsrv_findlayout(&nd->nd_clientid, &fh, + layouttype, p, &lyp); NFSD_DEBUG(4, "layoutret findlay=%d\n", error); if (error == 0 && stateidp->other[0] == lyp->lay_stateid.other[0] && @@ -6750,21 +6829,19 @@ nfsrv_layoutreturn(struct nfsrv_descript *nd, vnode_t * Look for an existing layout. */ static int -nfsrv_findlayout(struct nfsrv_descript *nd, fhandle_t *fhp, int laytype, +nfsrv_findlayout(nfsquad_t *clientidp, fhandle_t *fhp, int laytype, NFSPROC_T *p, struct nfslayout **lypp) { struct nfslayouthash *lhyp; struct nfslayout *lyp; int ret; - KASSERT((nd->nd_flag & ND_IMPLIEDCLID) != 0, - ("nfsrv_layoutget: no nd_clientid\n")); *lypp = NULL; ret = 0; lhyp = NFSLAYOUTHASH(fhp); TAILQ_FOREACH(lyp, &lhyp->list, lay_list) { if (NFSBCMP(&lyp->lay_fh, fhp, sizeof(*fhp)) == 0 && - lyp->lay_clientid.qval == nd->nd_clientid.qval && + lyp->lay_clientid.qval == clientidp->qval && lyp->lay_type == laytype) break; } @@ -6832,6 +6909,7 @@ nfsrv_addlayout(struct nfsrv_descript *nd, struct nfsl /* Insert the new layout in the lists. */ *lypp = NULL; + atomic_add_int(&nfsrv_layoutcnt, 1); NFSBCOPY(lyp->lay_xdr, layp, lyp->lay_layoutlen); *layoutlenp = lyp->lay_layoutlen; TAILQ_INSERT_HEAD(&lhyp->list, lyp, lay_list); @@ -6907,8 +6985,6 @@ nfsrv_getdevinfo(char *devid, int layouttype, uint32_t /* * Free a list of layout state structures. - * (This function will also free all nfslockfile structures that no - * longer have associated state.) */ static void nfsrv_freelayoutlist(nfsquad_t clientid) @@ -6936,6 +7012,7 @@ nfsrv_freelayout(struct nfslayouthead *lhp, struct nfs { NFSD_DEBUG(4, "Freelayout=%p\n", lyp); + atomic_add_int(&nfsrv_layoutcnt, -1); TAILQ_REMOVE(lhp, lyp, lay_list); free(lyp, M_NFSDSTATE); } @@ -7778,7 +7855,8 @@ tryagain: if (++lyp->lay_stateid.seqid == 0) lyp->lay_stateid.seqid = 1; NFSDRECALLUNLOCK(); - nfsrv_recalllayout(lyp, p); + nfsrv_recalllayout(lyp->lay_clientid, &lyp->lay_stateid, + &lyp->lay_fh, lyp, lyp->lay_type, p); NFSD_DEBUG(4, "nfsrv_copymr: recalled layout\n"); goto tryagain; } From owner-svn-src-projects@freebsd.org Sat May 26 21:31:03 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB5FEEF6E75 for ; Sat, 26 May 2018 21:31:02 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 90EC281E01; Sat, 26 May 2018 21:31:02 +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 71FFE15593; Sat, 26 May 2018 21:31:02 +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 w4QLV2FV029621; Sat, 26 May 2018 21:31:02 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4QLV1GK029619; Sat, 26 May 2018 21:31:01 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201805262131.w4QLV1GK029619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 26 May 2018 21:31:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r334248 - in projects/pnfs-planb-server/sys/fs: nfs nfsserver X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in projects/pnfs-planb-server/sys/fs: nfs nfsserver X-SVN-Commit-Revision: 334248 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.26 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, 26 May 2018 21:31:03 -0000 Author: rmacklem Date: Sat May 26 21:31:01 2018 New Revision: 334248 URL: https://svnweb.freebsd.org/changeset/base/334248 Log: Add handling of errors other than NFSERR_NOMATCHLAYOUT returned by a CBLAYOUTRECALL callback. For these other errors, do retries for a while. Modified: projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Modified: projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h Sat May 26 21:14:49 2018 (r334247) +++ projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h Sat May 26 21:31:01 2018 (r334248) @@ -134,7 +134,8 @@ struct nfslayout { fhandle_t lay_fh; fsid_t lay_fsid; uint32_t lay_layoutlen; - uint32_t lay_mirrorcnt; + uint16_t lay_mirrorcnt; + uint16_t lay_trycnt; uint16_t lay_type; uint16_t lay_flags; uint32_t lay_xdr[0]; Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Sat May 26 21:14:49 2018 (r334247) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c Sat May 26 21:31:01 2018 (r334248) @@ -217,7 +217,8 @@ static void nfsrv_freealldevids(void); static void nfsrv_flexlayouterr(struct nfsrv_descript *nd, uint32_t *layp, int maxcnt, NFSPROC_T *p); static int nfsrv_recalllayout(nfsquad_t clid, nfsv4stateid_t *stateidp, - fhandle_t *fhp, struct nfslayout *lyp, int laytype, NFSPROC_T *p); + fhandle_t *fhp, struct nfslayout *lyp, struct nfslayouthead *lyheadp, + int laytype, NFSPROC_T *p); static int nfsrv_findlayout(nfsquad_t *clientidp, fhandle_t *fhp, int laytype, NFSPROC_T *, struct nfslayout **lypp); static int nfsrv_fndclid(nfsquad_t *clidvec, nfsquad_t clid, int clidcnt); @@ -6621,11 +6622,13 @@ nfsrv_flexmirrordel(char *devid, NFSPROC_T *p) /* * The layout stateid.seqid needs to be incremented * before doing a LAYOUT_RECALL callback. + * Set lay_trycnt to UINT16_MAX so it won't set up a retry. */ if (++lyp->lay_stateid.seqid == 0) lyp->lay_stateid.seqid = 1; + lyp->lay_trycnt = UINT16_MAX; nfsrv_recalllayout(lyp->lay_clientid, &lyp->lay_stateid, - &lyp->lay_fh, lyp, lyp->lay_type, p); + &lyp->lay_fh, lyp, &loclyp, lyp->lay_type, p); nfsrv_freelayout(&loclyp, lyp); } } @@ -6635,7 +6638,8 @@ nfsrv_flexmirrordel(char *devid, NFSPROC_T *p) */ static int nfsrv_recalllayout(nfsquad_t clid, nfsv4stateid_t *stateidp, fhandle_t *fhp, - struct nfslayout *lyp, int laytype, NFSPROC_T *p) + struct nfslayout *lyp, struct nfslayouthead *lyheadp, int laytype, + NFSPROC_T *p) { struct nfsclient *clp; int error; @@ -6649,13 +6653,33 @@ nfsrv_recalllayout(nfsquad_t clid, nfsv4stateid_t *sta if ((clp->lc_flags & LCL_NFSV41) != 0) { error = nfsrv_docallback(clp, NFSV4OP_CBLAYOUTRECALL, stateidp, 0, fhp, NULL, NULL, laytype, p); - if (lyp != NULL && error == NFSERR_NOMATCHLAYOUT) { + /* If lyp != NULL, handle an error return here. */ + if (error != 0 && lyp != NULL) { NFSDRECALLLOCK(); - if ((lyp->lay_flags & NFSLAY_RECALL) != 0) { - lyp->lay_flags |= NFSLAY_RETURNED; - wakeup(lyp); - } - NFSDRECALLUNLOCK(); + if (error == NFSERR_NOMATCHLAYOUT) { + /* + * Mark it returned, since there is no layout. + */ + if ((lyp->lay_flags & NFSLAY_RECALL) != 0) { + lyp->lay_flags |= NFSLAY_RETURNED; + wakeup(lyp); + } + NFSDRECALLUNLOCK(); + } else if ((lyp->lay_flags & NFSLAY_RETURNED) == 0 && + lyp->lay_trycnt < 10) { + /* + * Clear recall, so it can be tried again + * and put it at the end of the list to + * delay the retry a little longer. + */ + lyp->lay_flags &= ~NFSLAY_RECALL; + lyp->lay_trycnt++; + TAILQ_REMOVE(lyheadp, lyp, lay_list); + TAILQ_INSERT_TAIL(lyheadp, lyp, lay_list); + NFSDRECALLUNLOCK(); + nfs_catnap(PVFS, 0, "nfsrclay"); + } else + NFSDRECALLUNLOCK(); } } else printf("nfsrv_recalllayout: clp not NFSv4.1\n"); @@ -6673,7 +6697,7 @@ nfsrv_recalloldlayout(NFSPROC_T *p) nfsquad_t clientid; nfsv4stateid_t stateid; fhandle_t fh; - int error, laytype; + int error, laytype, ret; lhyp = &nfslayouthash[arc4random() % nfsrv_layouthashsize]; NFSLOCKLAYOUT(lhyp); @@ -6695,26 +6719,43 @@ nfsrv_recalloldlayout(NFSPROC_T *p) } NFSUNLOCKLAYOUT(lhyp); if (lyp != NULL) { - error = nfsrv_recalllayout(clientid, &stateid, &fh, NULL, + error = nfsrv_recalllayout(clientid, &stateid, &fh, NULL, NULL, laytype, p); if (error != 0 && error != NFSERR_NOMATCHLAYOUT) printf("recallold=%d\n", error); - if (error == NFSERR_NOMATCHLAYOUT) { + if (error != 0) { + NFSLOCKLAYOUT(lhyp); /* - * The client no longer knows this layout, so it can - * be free'd now. - * Since the hash list was unlocked, we need to find - * it again. + * Since the hash list was unlocked, we need to + * find it again. */ - NFSLOCKLAYOUT(lhyp); - error = nfsrv_findlayout(&clientid, &fh, laytype, p, + ret = nfsrv_findlayout(&clientid, &fh, laytype, p, &lyp); - if (error == 0 && + if (ret == 0 && (lyp->lay_flags & NFSLAY_CALLB) != 0 && lyp->lay_stateid.other[0] == stateid.other[0] && lyp->lay_stateid.other[1] == stateid.other[1] && - lyp->lay_stateid.other[2] == stateid.other[2]) - nfsrv_freelayout(&lhyp->list, lyp); + lyp->lay_stateid.other[2] == stateid.other[2]) { + /* + * The client no longer knows this layout, so + * it can be free'd now. + */ + if (error == NFSERR_NOMATCHLAYOUT) + nfsrv_freelayout(&lhyp->list, lyp); + else { + /* + * Leave it to be tried later by + * clearing NFSLAY_CALLB and moving + * it to the head of the list, so it + * won't be tried again for a while. + */ + lyp->lay_flags &= ~NFSLAY_CALLB; + TAILQ_REMOVE(&lhyp->list, lyp, + lay_list); + TAILQ_INSERT_HEAD(&lhyp->list, lyp, + lay_list); + } + } NFSUNLOCKLAYOUT(lhyp); } } @@ -7831,6 +7872,7 @@ nfsrv_copymr(vnode_t vp, vnode_t fvp, vnode_t dvp, str (lyp->lay_flags & NFSLAY_RW) != 0) { TAILQ_REMOVE(&lhyp->list, lyp, lay_list); TAILQ_INSERT_HEAD(&nfsrv_recalllisthead, lyp, lay_list); + lyp->lay_trycnt = 0; } } NFSUNLOCKLAYOUT(lhyp); @@ -7856,7 +7898,8 @@ tryagain: lyp->lay_stateid.seqid = 1; NFSDRECALLUNLOCK(); nfsrv_recalllayout(lyp->lay_clientid, &lyp->lay_stateid, - &lyp->lay_fh, lyp, lyp->lay_type, p); + &lyp->lay_fh, lyp, &nfsrv_recalllisthead, + lyp->lay_type, p); NFSD_DEBUG(4, "nfsrv_copymr: recalled layout\n"); goto tryagain; } From owner-svn-src-projects@freebsd.org Sat May 26 21:36:30 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F009EF7046 for ; Sat, 26 May 2018 21:36:30 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9CB488210F; Sat, 26 May 2018 21:36:29 +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 787E6156F7; Sat, 26 May 2018 21:36:29 +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 w4QLaTQb032030; Sat, 26 May 2018 21:36:29 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4QLaT1B032029; Sat, 26 May 2018 21:36:29 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201805262136.w4QLaT1B032029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 26 May 2018 21:36:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r334249 - projects/pnfs-planb-server/sys/fs/nfsclient X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/pnfs-planb-server/sys/fs/nfsclient X-SVN-Commit-Revision: 334249 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.26 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, 26 May 2018 21:36:30 -0000 Author: rmacklem Date: Sat May 26 21:36:28 2018 New Revision: 334249 URL: https://svnweb.freebsd.org/changeset/base/334249 Log: Fix the NFSv4.1 client for layout callback handling. The code slept on the wrong event (address). This fix will go in head soon, but I wanted the fix here, since it affects testing of the pNFS server. Modified: projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clstate.c Modified: projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clstate.c Sat May 26 21:31:01 2018 (r334248) +++ projects/pnfs-planb-server/sys/fs/nfsclient/nfs_clstate.c Sat May 26 21:36:28 2018 (r334249) @@ -2721,7 +2721,7 @@ tryagain2: NFSV4LOCK_LOCK) != 0) { lyp->nfsly_lock.nfslock_lock |= NFSV4LOCK_WANTED; - (void)nfsmsleep(&lyp->nfsly_lock, + nfsmsleep(&lyp->nfsly_lock.nfslock_lock, NFSCLSTATEMUTEXPTR, PZERO, "nfslyp", NULL); goto tryagain2; From owner-svn-src-projects@freebsd.org Sat May 26 21:42:28 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDA56EF72C4 for ; Sat, 26 May 2018 21:42:27 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A03C8824A3; Sat, 26 May 2018 21:42:27 +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 8150115885; Sat, 26 May 2018 21:42:27 +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 w4QLgRKc036760; Sat, 26 May 2018 21:42:27 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4QLgR2T036759; Sat, 26 May 2018 21:42:27 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201805262142.w4QLgR2T036759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 26 May 2018 21:42:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r334250 - projects/pnfs-planb-server/sys/fs/nfsserver X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/pnfs-planb-server/sys/fs/nfsserver X-SVN-Commit-Revision: 334250 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.26 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, 26 May 2018 21:42:28 -0000 Author: rmacklem Date: Sat May 26 21:42:27 2018 New Revision: 334250 URL: https://svnweb.freebsd.org/changeset/base/334250 Log: This fix is already in head/current, but I wanted it here too, since it affects testing of the pNFS server when it reboots with Linux client mounts. Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdserv.c Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdserv.c Sat May 26 21:36:28 2018 (r334249) +++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdserv.c Sat May 26 21:42:27 2018 (r334250) @@ -4036,9 +4036,9 @@ nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused txdr_hyper(owner_minor, tl); /* Minor */ (void)nfsm_strtom(nd, nd->nd_cred->cr_prison->pr_hostuuid, strlen(nd->nd_cred->cr_prison->pr_hostuuid)); /* Major */ - NFSM_BUILD(tl, uint32_t *, 3 * NFSX_UNSIGNED); - *tl++ = txdr_unsigned(NFSX_UNSIGNED); - *tl++ = time_uptime; /* Make scope a unique value. */ + (void)nfsm_strtom(nd, nd->nd_cred->cr_prison->pr_hostuuid, + strlen(nd->nd_cred->cr_prison->pr_hostuuid)); /* Scope */ + NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(1); (void)nfsm_strtom(nd, "freebsd.org", strlen("freebsd.org")); (void)nfsm_strtom(nd, version, strlen(version));