From owner-svn-src-projects@freebsd.org  Thu Jun 28 19:42:06 2018
Return-Path: <owner-svn-src-projects@freebsd.org>
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 471E91025663
 for <svn-src-projects@mailman.ysv.freebsd.org>;
 Thu, 28 Jun 2018 19:42:06 +0000 (UTC) (envelope-from cy@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 EF3BD8ACAB;
 Thu, 28 Jun 2018 19:42:05 +0000 (UTC) (envelope-from cy@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 D0D2616A85;
 Thu, 28 Jun 2018 19:42:05 +0000 (UTC) (envelope-from cy@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5SJg5ni013570;
 Thu, 28 Jun 2018 19:42:05 GMT (envelope-from cy@FreeBSD.org)
Received: (from cy@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5SJg5IR013569;
 Thu, 28 Jun 2018 19:42:05 GMT (envelope-from cy@FreeBSD.org)
Message-Id: <201806281942.w5SJg5IR013569@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org
 using -f
From: Cy Schubert <cy@FreeBSD.org>
Date: Thu, 28 Jun 2018 19:42:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject: svn commit: r335772 - projects/krb5
X-SVN-Group: projects
X-SVN-Commit-Author: cy
X-SVN-Commit-Paths: projects/krb5
X-SVN-Commit-Revision: 335772
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 &quot; projects&quot;
 tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects/>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 28 Jun 2018 19:42:06 -0000

Author: cy
Date: Thu Jun 28 19:42:05 2018
New Revision: 335772
URL: https://svnweb.freebsd.org/changeset/base/335772

Log:
  Add lib32 libraries made private but not included in Obsoletefiles
  previously.

Modified:
  projects/krb5/ObsoleteFiles.inc

Modified: projects/krb5/ObsoleteFiles.inc
==============================================================================
--- projects/krb5/ObsoleteFiles.inc	Thu Jun 28 19:01:53 2018	(r335771)
+++ projects/krb5/ObsoleteFiles.inc	Thu Jun 28 19:42:05 2018	(r335772)
@@ -38,6 +38,70 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20180625: krb5 private lib32
+OLD_LIBS+=usr/lib32/libgssapi.a
+OLD_LIBS+=usr/lib32/libgssapi.so
+OLD_LIBS+=usr/lib32/libgssapi.so.10
+OLD_LIBS+=usr/lib32/libasn1.a
+OLD_LIBS+=usr/lib32/libasn1.so
+OLD_LIBS+=usr/lib32/libasn1.so.11
+OLD_LIBS+=usr/lib32/libasn1_p.a
+OLD_LIBS+=usr/lib32/libgssapi_krb5.a
+OLD_LIBS+=usr/lib32/libgssapi_krb5.so
+OLD_LIBS+=usr/lib32/libgssapi_krb5.so.10
+OLD_LIBS+=usr/lib32/libgssapi_krb5_p.a
+OLD_LIBS+=usr/lib32/libgssapi_ntlm.a
+OLD_LIBS+=usr/lib32/libgssapi_ntlm.so
+OLD_LIBS+=usr/lib32/libgssapi_ntlm.so.10
+OLD_LIBS+=usr/lib32/libgssapi_ntlm_p.a
+OLD_LIBS+=usr/lib32/libgssapi_spnego.a
+OLD_LIBS+=usr/lib32/libgssapi_spnego.so
+OLD_LIBS+=usr/lib32/libgssapi_spnego.so.10
+OLD_LIBS+=usr/lib32/libgssapi_spnego_p.a
+OLD_LIBS+=usr/lib32/libhdb.a
+OLD_LIBS+=usr/lib32/libhdb.so
+OLD_LIBS+=usr/lib32/libhdb.so.11
+OLD_LIBS+=usr/lib32/libhdb_p.a
+OLD_LIBS+=usr/lib32/libheimbase.a
+OLD_LIBS+=usr/lib32/libheimbase.so
+OLD_LIBS+=usr/lib32/libheimbase.so.11
+OLD_LIBS+=usr/lib32/libheimbase_p.a
+OLD_LIBS+=usr/lib32/libheimntlm.a
+OLD_LIBS+=usr/lib32/libheimntlm.so
+OLD_LIBS+=usr/lib32/libheimntlm.so.11
+OLD_LIBS+=usr/lib32/libheimntlm_p.a
+OLD_LIBS+=usr/lib32/libhx509.a
+OLD_LIBS+=usr/lib32/libhx509.so
+OLD_LIBS+=usr/lib32/libhx509.so.11
+OLD_LIBS+=usr/lib32/libhx509_p.a
+OLD_LIBS+=usr/lib32/libkadm5clnt.a
+OLD_LIBS+=usr/lib32/libkadm5clnt.so
+OLD_LIBS+=usr/lib32/libkadm5clnt.so.11
+OLD_LIBS+=usr/lib32/libkadm5clnt_p.a
+OLD_LIBS+=usr/lib32/libkadm5srv.a
+OLD_LIBS+=usr/lib32/libkadm5srv.so
+OLD_LIBS+=usr/lib32/libkadm5srv.so.11
+OLD_LIBS+=usr/lib32/libkadm5srv_p.a
+OLD_LIBS+=usr/lib32/libkafs5.a
+OLD_LIBS+=usr/lib32/libkafs5.so
+OLD_LIBS+=usr/lib32/libkafs5.so.11
+OLD_LIBS+=usr/lib32/libkafs5_p.a
+OLD_LIBS+=usr/lib32/libkdc.a
+OLD_LIBS+=usr/lib32/libkdc.so
+OLD_LIBS+=usr/lib32/libkdc.so.11
+OLD_LIBS+=usr/lib32/libkdc_p.a
+OLD_LIBS+=usr/lib32/libkrb5.a
+OLD_LIBS+=usr/lib32/libkrb5.so
+OLD_LIBS+=usr/lib32/libkrb5.so.11
+OLD_LIBS+=usr/lib32/libkrb5_p.a
+OLD_LIBS+=usr/lib32/libroken.a
+OLD_LIBS+=usr/lib32/libroken.so
+OLD_LIBS+=usr/lib32/libroken.so.11
+OLD_LIBS+=usr/lib32/libroken_p.a
+OLD_LIBS+=usr/lib32/libwind.a
+OLD_LIBS+=usr/lib32/libwind.so
+OLD_LIBS+=usr/lib32/libwind.so.11
+OLD_LIBS+=usr/lib32/libwind_p.a
 # 20180615: asf(8) removed
 OLD_FILES+=usr/bin/asf
 OLD_FILES+=usr/share/man/man8/asf.8.gz

From owner-svn-src-projects@freebsd.org  Thu Jun 28 20:54:03 2018
Return-Path: <owner-svn-src-projects@freebsd.org>
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 47D4A1026FFF
 for <svn-src-projects@mailman.ysv.freebsd.org>;
 Thu, 28 Jun 2018 20:54:03 +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 ED5C48D93A;
 Thu, 28 Jun 2018 20:54: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 B4DF31764E;
 Thu, 28 Jun 2018 20:54: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 w5SKs2Ar050748;
 Thu, 28 Jun 2018 20:54:02 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5SKs10Z050743;
 Thu, 28 Jun 2018 20:54:01 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201806282054.w5SKs10Z050743@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Thu, 28 Jun 2018 20:54:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject: svn commit: r335777 - 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: 335777
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 &quot; projects&quot;
 tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects/>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 28 Jun 2018 20:54:03 -0000

Author: rmacklem
Date: Thu Jun 28 20:54:01 2018
New Revision: 335777
URL: https://svnweb.freebsd.org/changeset/base/335777

Log:
  Add an optional "#<mds-export-path>" field to the elements for the "-p"
  option that defines the DSs on the MDS.
  This optional field specifies that the MDS should only store files for the
  specified MDS exported file system on the DS.
  It allows a sysadmin to partition the storage on the DSs, based on exported
  MDS file systems.
  This patch consists of the kernel changes needed for this to be done.

Modified:
  projects/pnfs-planb-server/sys/fs/nfs/nfs.h
  projects/pnfs-planb-server/sys/fs/nfs/nfs_commonsubs.c
  projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.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.h
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfs/nfs.h	Thu Jun 28 20:37:17 2018	(r335776)
+++ projects/pnfs-planb-server/sys/fs/nfs/nfs.h	Thu Jun 28 20:54:01 2018	(r335777)
@@ -185,6 +185,8 @@ struct nfsd_nfsd_args {
 	int	dnshostlen;	/* Length of DNS names */
 	char	*dspath;	/* DS Mount path on MDS */
 	int	dspathlen;	/* Length of DS Mount path on MDS */
+	char	*mdspath;	/* MDS mount for DS path on MDS */
+	int	mdspathlen;	/* Length of MDS mount for DS path on MDS */
 	int	mirrorcnt;	/* Number of mirrors to create on DSs */
 };
 

Modified: projects/pnfs-planb-server/sys/fs/nfs/nfs_commonsubs.c
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfs/nfs_commonsubs.c	Thu Jun 28 20:37:17 2018	(r335776)
+++ projects/pnfs-planb-server/sys/fs/nfs/nfs_commonsubs.c	Thu Jun 28 20:54:01 2018	(r335777)
@@ -4692,37 +4692,26 @@ nfsv4_freeslot(struct nfsclsession *sep, int slot)
 }
 
 /*
- * Search for a matching pnfsd mirror device structure, base on the nmp arg.
+ * Search for a matching pnfsd DS, based on the nmp arg.
  * Return one if found, NULL otherwise.
  */
 struct nfsdevice *
 nfsv4_findmirror(struct nfsmount *nmp)
 {
-	struct nfsdevice *ds, *fndds;
-	int fndmirror;
+	struct nfsdevice *ds;
 
 	mtx_assert(NFSDDSMUTEXPTR, MA_OWNED);
 	/*
 	 * Search the DS server list for a match with nmp.
-	 * Remove the DS entry if found and there is a mirror.
 	 */
-	fndds = NULL;
-	fndmirror = 0;
 	if (nfsrv_devidcnt == 0)
-		return (fndds);
+		return (NULL);
 	TAILQ_FOREACH(ds, &nfsrv_devidhead, nfsdev_list) {
 		if (ds->nfsdev_nmp == nmp) {
-			NFSCL_DEBUG(4, "fnd main ds\n");
-			fndds = ds;
-		} else if (ds->nfsdev_nmp != NULL)
-			fndmirror = 1;
-		if (fndds != NULL && fndmirror != 0)
+			NFSCL_DEBUG(4, "nfsv4_findmirror: fnd main ds\n");
 			break;
+		}
 	}
-	if (fndmirror == 0) {
-		NFSCL_DEBUG(4, "no mirror for DS\n");
-		return (NULL);
-	}
-	return (fndds);
+	return (ds);
 }
 

Modified: projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h	Thu Jun 28 20:37:17 2018	(r335776)
+++ projects/pnfs-planb-server/sys/fs/nfs/nfsrvstate.h	Thu Jun 28 20:54:01 2018	(r335777)
@@ -345,9 +345,11 @@ struct nfsdevice {
 	uint16_t		nfsdev_hostnamelen;
 	uint16_t		nfsdev_fileaddrlen;
 	uint16_t		nfsdev_flexaddrlen;
+	uint16_t		nfsdev_mdsisset;
 	char			*nfsdev_fileaddr;
 	char			*nfsdev_flexaddr;
 	char			*nfsdev_host;
+	fsid_t			nfsdev_mdsfsid;
 	uint32_t		nfsdev_nextdir;
 	vnode_t			nfsdev_dsdir[0];
 };

Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c	Thu Jun 28 20:37:17 2018	(r335776)
+++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c	Thu Jun 28 20:54:01 2018	(r335777)
@@ -3355,6 +3355,10 @@ nfssvc_nfsd(struct thread *td, struct nfssvc_args *uap
 				nfsdarg.addrlen = 0;
 				nfsdarg.dnshost = NULL;
 				nfsdarg.dnshostlen = 0;
+				nfsdarg.dspath = NULL;
+				nfsdarg.dspathlen = 0;
+				nfsdarg.mdspath = NULL;
+				nfsdarg.mdspathlen = 0;
 				nfsdarg.mirrorcnt = 1;
 			}
 		} else
@@ -3364,14 +3368,15 @@ nfssvc_nfsd(struct thread *td, struct nfssvc_args *uap
 		if (nfsdarg.addrlen > 0 && nfsdarg.addrlen < 10000 &&
 		    nfsdarg.dnshostlen > 0 && nfsdarg.dnshostlen < 10000 &&
 		    nfsdarg.dspathlen > 0 && nfsdarg.dspathlen < 10000 &&
+		    nfsdarg.mdspathlen > 0 && nfsdarg.mdspathlen < 10000 &&
 		    nfsdarg.mirrorcnt >= 1 &&
 		    nfsdarg.mirrorcnt <= NFSDEV_MAXMIRRORS &&
 		    nfsdarg.addr != NULL && nfsdarg.dnshost != NULL &&
-		    nfsdarg.dspath != NULL) {
+		    nfsdarg.dspath != NULL && nfsdarg.mdspath != NULL) {
 			NFSD_DEBUG(1, "addrlen=%d dspathlen=%d dnslen=%d"
-			    " mirrorcnt=%d\n", nfsdarg.addrlen,
+			    " mdspathlen=%d mirrorcnt=%d\n", nfsdarg.addrlen,
 			    nfsdarg.dspathlen, nfsdarg.dnshostlen,
-			    nfsdarg.mirrorcnt);
+			    nfsdarg.mdspathlen, nfsdarg.mirrorcnt);
 			cp = malloc(nfsdarg.addrlen + 1, M_TEMP, M_WAITOK);
 			error = copyin(nfsdarg.addr, cp, nfsdarg.addrlen);
 			if (error != 0) {
@@ -3399,6 +3404,17 @@ nfssvc_nfsd(struct thread *td, struct nfssvc_args *uap
 			}
 			cp[nfsdarg.dspathlen] = '\0';	/* Ensure nul term. */
 			nfsdarg.dspath = cp;
+			cp = malloc(nfsdarg.mdspathlen + 1, M_TEMP, M_WAITOK);
+			error = copyin(nfsdarg.mdspath, cp, nfsdarg.mdspathlen);
+			if (error != 0) {
+				free(nfsdarg.addr, M_TEMP);
+				free(nfsdarg.dnshost, M_TEMP);
+				free(nfsdarg.dspath, M_TEMP);
+				free(cp, M_TEMP);
+				goto out;
+			}
+			cp[nfsdarg.mdspathlen] = '\0';	/* Ensure nul term. */
+			nfsdarg.mdspath = cp;
 		} else {
 			nfsdarg.addr = NULL;
 			nfsdarg.addrlen = 0;
@@ -3406,12 +3422,15 @@ nfssvc_nfsd(struct thread *td, struct nfssvc_args *uap
 			nfsdarg.dnshostlen = 0;
 			nfsdarg.dspath = NULL;
 			nfsdarg.dspathlen = 0;
+			nfsdarg.mdspath = NULL;
+			nfsdarg.mdspathlen = 0;
 			nfsdarg.mirrorcnt = 1;
 		}
 		error = nfsrvd_nfsd(td, &nfsdarg);
 		free(nfsdarg.addr, M_TEMP);
 		free(nfsdarg.dnshost, M_TEMP);
 		free(nfsdarg.dspath, M_TEMP);
+		free(nfsdarg.mdspath, M_TEMP);
 	} else if (uap->flag & NFSSVC_PNFSDS) {
 		error = copyin(uap->argp, &pnfsdarg, sizeof(pnfsdarg));
 		if (error == 0 && pnfsdarg.op == PNFSDOP_DELDSSERVER) {
@@ -3846,9 +3865,12 @@ nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, 
 
 	/* Get a DS server directory in a round-robin order. */
 	mirrorcnt = 1;
+	mp = vp->v_mount;
 	NFSDDSLOCK();
 	TAILQ_FOREACH(ds, &nfsrv_devidhead, nfsdev_list) {
-		if (ds->nfsdev_nmp != NULL)
+		if (ds->nfsdev_nmp != NULL && (ds->nfsdev_mdsisset == 0 ||
+		    (mp->mnt_stat.f_fsid.val[0] == ds->nfsdev_mdsfsid.val[0] &&
+		     mp->mnt_stat.f_fsid.val[1] == ds->nfsdev_mdsfsid.val[1])))
 			break;
 	}
 	if (ds == NULL) {
@@ -3862,7 +3884,12 @@ nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, 
 	if (nfsrv_maxpnfsmirror > 1) {
 		mds = TAILQ_NEXT(ds, nfsdev_list);
 		TAILQ_FOREACH_FROM(mds, &nfsrv_devidhead, nfsdev_list) {
-			if (mds->nfsdev_nmp != NULL) {
+			if (mds->nfsdev_nmp != NULL &&
+			    (mds->nfsdev_mdsisset == 0 ||
+			     (mp->mnt_stat.f_fsid.val[0] ==
+			      mds->nfsdev_mdsfsid.val[0] &&
+			      mp->mnt_stat.f_fsid.val[1] ==
+			      mds->nfsdev_mdsfsid.val[1]))) {
 				dsdir[mirrorcnt] = i;
 				dvp[mirrorcnt] = mds->nfsdev_dsdir[i];
 				mirrorcnt++;
@@ -4447,6 +4474,7 @@ nfsrv_dsgetsockmnt(struct vnode *vp, int lktype, char 
     struct nfsmount *curnmp, int *ippos, int *dsdirp)
 {
 	struct vnode *dvp, *nvp, **tdvpp;
+	struct mount *mp;
 	struct nfsmount *nmp, *newnmp;
 	struct sockaddr *sad;
 	struct sockaddr_in *sin;
@@ -4468,6 +4496,7 @@ nfsrv_dsgetsockmnt(struct vnode *vp, int lktype, char 
 		newnmp = *newnmpp;
 	else
 		newnmp = NULL;
+	mp = vp->v_mount;
 	error = vn_extattr_get(vp, IO_NODELOCKED, EXTATTR_NAMESPACE_SYSTEM,
 	    "pnfsd.dsfile", buflenp, buf, p);
 	mirrorcnt = *buflenp / sizeof(*pf);
@@ -4528,7 +4557,13 @@ nfsrv_dsgetsockmnt(struct vnode *vp, int lktype, char 
 						fndds = ds;
 					else if (newnmpp != NULL &&
 					    newnmp == NULL &&
-					    (*newnmpp == NULL || fndds == NULL))
+					    (*newnmpp == NULL ||
+					     fndds == NULL) &&
+					    (ds->nfsdev_mdsisset == 0 ||
+					     (ds->nfsdev_mdsfsid.val[0] ==
+					      mp->mnt_stat.f_fsid.val[0] &&
+					      ds->nfsdev_mdsfsid.val[1] ==
+					      mp->mnt_stat.f_fsid.val[1])))
 						/*
 						 * Return a destination for the
 						 * copy in newnmpp. Choose the

Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c	Thu Jun 28 20:37:17 2018	(r335776)
+++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdstate.c	Thu Jun 28 20:54:01 2018	(r335777)
@@ -210,7 +210,7 @@ static void nfsrv_freelayouts(nfsquad_t *clid, fsid_t 
     int iomode);
 static void nfsrv_freealllayouts(void);
 static void nfsrv_freedevid(struct nfsdevice *ds);
-static int nfsrv_setdsserver(char *dspathp, NFSPROC_T *p,
+static int nfsrv_setdsserver(char *dspathp, char *mdspathp, NFSPROC_T *p,
     struct nfsdevice **dsp);
 static int nfsrv_delds(char *devid, NFSPROC_T *p);
 static void nfsrv_deleteds(struct nfsdevice *fndds);
@@ -232,6 +232,7 @@ static int nfsrv_dontlayout(fhandle_t *fhp);
 static int nfsrv_createdsfile(vnode_t vp, fhandle_t *fhp, struct pnfsdsfile *pf,
     vnode_t dvp, struct nfsdevice *ds, struct ucred *cred, NFSPROC_T *p,
     vnode_t *tvpp);
+static struct nfsdevice *nfsrv_findmirroredds(struct nfsmount *nmp);
 
 /*
  * Scan the client list for a match and either return the current one,
@@ -7369,10 +7370,12 @@ nfsrv_freealllayouts(void)
  * Look up the mount path for the DS server.
  */
 static int
-nfsrv_setdsserver(char *dspathp, NFSPROC_T *p, struct nfsdevice **dsp)
+nfsrv_setdsserver(char *dspathp, char *mdspathp, NFSPROC_T *p,
+    struct nfsdevice **dsp)
 {
 	struct nameidata nd;
 	struct nfsdevice *ds;
+	struct mount *mp;
 	int error, i;
 	char *dsdirpath;
 	size_t dsdirsize;
@@ -7400,6 +7403,9 @@ nfsrv_setdsserver(char *dspathp, NFSPROC_T *p, struct 
 	 * Allocate a DS server structure with the NFS mounted directory
 	 * vnode reference counted, so that a non-forced dismount will
 	 * fail with EBUSY.
+	 * This structure is always linked into the list, even if an error
+	 * is being returned.  The caller will free the entire list upon
+	 * an error return.
 	 */
 	*dsp = ds = malloc(sizeof(*ds) + nfsrv_dsdirsize * sizeof(vnode_t),
 	    M_NFSDSTATE, M_WAITOK | M_ZERO);
@@ -7435,6 +7441,36 @@ nfsrv_setdsserver(char *dspathp, NFSPROC_T *p, struct 
 	}
 	free(dsdirpath, M_TEMP);
 
+	if (strlen(mdspathp) > 0) {
+		/*
+		 * This DS stores file for a specific MDS exported file
+		 * system.
+		 */
+		NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
+		    UIO_SYSSPACE, mdspathp, p);
+		error = namei(&nd);
+		NFSD_DEBUG(4, "mds lookup=%d\n", error);
+		if (error != 0)
+			goto out;
+		if (nd.ni_vp->v_type != VDIR) {
+			vput(nd.ni_vp);
+			error = ENOTDIR;
+			NFSD_DEBUG(4, "mdspath not dir\n");
+			goto out;
+		}
+		mp = nd.ni_vp->v_mount;
+		if ((mp->mnt_flag & MNT_EXPORTED) == 0) {
+			vput(nd.ni_vp);
+			error = ENXIO;
+			NFSD_DEBUG(4, "mdspath not an exported fs\n");
+			goto out;
+		}
+		ds->nfsdev_mdsfsid = mp->mnt_stat.f_fsid;
+		ds->nfsdev_mdsisset = 1;
+		vput(nd.ni_vp);
+	}
+
+out:
 	TAILQ_INSERT_TAIL(&nfsrv_devidhead, ds, nfsdev_list);
 	atomic_add_int(&nfsrv_devidcnt, 1);
 	return (error);
@@ -7514,11 +7550,7 @@ nfsrv_deldsnmp(struct nfsmount *nmp, NFSPROC_T *p)
 
 	NFSD_DEBUG(4, "deldsdvp\n");
 	NFSDDSLOCK();
-	if (nfsrv_faildscnt <= 0) {
-		NFSDDSUNLOCK();
-		return (NULL);
-	}
-	fndds = nfsv4_findmirror(nmp);
+	fndds = nfsrv_findmirroredds(nmp);
 	if (fndds != NULL)
 		nfsrv_deleteds(fndds);
 	NFSDDSUNLOCK();
@@ -7551,21 +7583,35 @@ nfsrv_delds(char *devid, NFSPROC_T *p)
 	nmp = NULL;
 	fndmirror = 0;
 	NFSDDSLOCK();
-	if (nfsrv_faildscnt <= 0) {
-		NFSDDSUNLOCK();
-		return (ENXIO);
-	}
 	TAILQ_FOREACH(ds, &nfsrv_devidhead, nfsdev_list) {
 		if (NFSBCMP(ds->nfsdev_deviceid, devid, NFSX_V4DEVICEID) == 0 &&
 		    ds->nfsdev_nmp != NULL) {
 			NFSD_DEBUG(4, "fnd main ds\n");
 			fndds = ds;
-		} else if (ds->nfsdev_nmp != NULL)
-			fndmirror = 1;
-		if (fndds != NULL && fndmirror != 0)
 			break;
+		}
 	}
-	if (fndds != NULL && fndmirror != 0) {
+	if (fndds == NULL) {
+		NFSDDSUNLOCK();
+		return (ENXIO);
+	}
+	if (fndds->nfsdev_mdsisset == 0 && nfsrv_faildscnt > 0)
+		fndmirror = 1;
+	else {
+		/* For the fsid is set case, search for a mirror. */
+		TAILQ_FOREACH(ds, &nfsrv_devidhead, nfsdev_list) {
+			if (ds != fndds && ds->nfsdev_nmp != NULL &&
+			    ds->nfsdev_mdsisset != 0 &&
+			    ds->nfsdev_mdsfsid.val[0] ==
+			    fndds->nfsdev_mdsfsid.val[0] &&
+			    ds->nfsdev_mdsfsid.val[1] ==
+			    fndds->nfsdev_mdsfsid.val[1]) {
+				fndmirror = 1;
+				break;
+			}
+		}
+	}
+	if (fndmirror != 0) {
 		nmp = fndds->nfsdev_nmp;
 		NFSLOCKMNT(nmp);
 		if ((nmp->nm_privflag & (NFSMNTP_FORCEDISM |
@@ -7579,7 +7625,7 @@ nfsrv_delds(char *devid, NFSPROC_T *p)
 		}
 	}
 	NFSDDSUNLOCK();
-	if (fndds != NULL && nmp != NULL) {
+	if (nmp != NULL) {
 		nfsrv_flexmirrordel(fndds->nfsdev_deviceid, p);
 		printf("pNFS server: mirror %s failed\n", fndds->nfsdev_host);
 		nfsrv_killrpcs(nmp);
@@ -7601,7 +7647,8 @@ nfsrv_deleteds(struct nfsdevice *fndds)
 
 	NFSD_DEBUG(4, "deleteds: deleting a mirror\n");
 	fndds->nfsdev_nmp = NULL;
-	nfsrv_faildscnt--;
+	if (fndds->nfsdev_mdsisset == 0)
+		nfsrv_faildscnt--;
 }
 
 /*
@@ -7687,24 +7734,27 @@ int
 nfsrv_createdevids(struct nfsd_nfsd_args *args, NFSPROC_T *p)
 {
 	struct nfsdevice *ds;
-	char *addrp, *dnshostp, *dspathp;
+	char *addrp, *dnshostp, *dspathp, *mdspathp;
 	int error, i;
 
 	addrp = args->addr;
 	dnshostp = args->dnshost;
 	dspathp = args->dspath;
+	mdspathp = args->mdspath;
 	nfsrv_maxpnfsmirror = args->mirrorcnt;
-	if (addrp == NULL || dnshostp == NULL || dspathp == NULL)
+	if (addrp == NULL || dnshostp == NULL || dspathp == NULL ||
+	    mdspathp == NULL)
 		return (0);
 
 	/*
 	 * Loop around for each nul-terminated string in args->addr,
-	 * args->dnshost and args->dnspath.
+	 * args->dnshost, args->dnspath and args->mdspath.
 	 */
 	while (addrp < (args->addr + args->addrlen) &&
 	    dnshostp < (args->dnshost + args->dnshostlen) &&
-	    dspathp < (args->dspath + args->dspathlen)) {
-		error = nfsrv_setdsserver(dspathp, p, &ds);
+	    dspathp < (args->dspath + args->dspathlen) &&
+	    mdspathp < (args->mdspath + args->mdspathlen)) {
+		error = nfsrv_setdsserver(dspathp, mdspathp, p, &ds);
 		if (error != 0) {
 			/* Free all DS servers. */
 			nfsrv_freealldevids();
@@ -7715,6 +7765,7 @@ nfsrv_createdevids(struct nfsd_nfsd_args *args, NFSPRO
 		addrp += (strlen(addrp) + 1);
 		dnshostp += (strlen(dnshostp) + 1);
 		dspathp += (strlen(dspathp) + 1);
+		mdspathp += (strlen(mdspathp) + 1);
 	}
 	if (nfsrv_devidcnt < nfsrv_maxpnfsmirror) {
 		/* Free all DS servers. */
@@ -8299,9 +8350,15 @@ nfsrv_mdscopymr(char *mdspathp, char *dspathp, char *c
 		}
 		nmp = VFSTONFS(nd.ni_vp->v_mount);
 	
-		/* Search the nfsdev list for a match. */
+		/*
+		 * Search the nfsdevice list for a match.  If curnmp == NULL,
+		 * this is a recovery and there must be a mirror.
+		 */
 		NFSDDSLOCK();
-		*dsp = nfsv4_findmirror(nmp);
+		if (curnmp == NULL)
+			*dsp = nfsrv_findmirroredds(nmp);
+		else
+			*dsp = nfsv4_findmirror(nmp);
 		NFSDDSUNLOCK();
 		if (*dsp == NULL) {
 			vput(nd.ni_vp);
@@ -8331,7 +8388,7 @@ nfsrv_mdscopymr(char *mdspathp, char *dspathp, char *c
 		if (error == 0 && nmp != NULL) {
 			/* Search the nfsdev list for a match. */
 			NFSDDSLOCK();
-			*dsp = nfsv4_findmirror(nmp);
+			*dsp = nfsrv_findmirroredds(nmp);
 			NFSDDSUNLOCK();
 		}
 		if (error == 0 && (nmp == NULL || *dsp == NULL)) {
@@ -8374,5 +8431,56 @@ nfsrv_mdscopymr(char *mdspathp, char *dspathp, char *c
 	} else
 		vput(vp);
 	return (error);
+}
+
+/*
+ * Search for a matching pnfsd mirror device structure, base on the nmp arg.
+ * Return one if found, NULL otherwise.
+ */
+static struct nfsdevice *
+nfsrv_findmirroredds(struct nfsmount *nmp)
+{
+	struct nfsdevice *ds, *fndds;
+	int fndmirror;
+
+	mtx_assert(NFSDDSMUTEXPTR, MA_OWNED);
+	/*
+	 * Search the DS server list for a match with nmp.
+	 * Remove the DS entry if found and there is a mirror.
+	 */
+	fndds = NULL;
+	fndmirror = 0;
+	if (nfsrv_devidcnt == 0)
+		return (fndds);
+	TAILQ_FOREACH(ds, &nfsrv_devidhead, nfsdev_list) {
+		if (ds->nfsdev_nmp == nmp) {
+			NFSD_DEBUG(4, "nfsrv_findmirroredds: fnd main ds\n");
+			fndds = ds;
+			break;
+		}
+	}
+	if (fndds == NULL)
+		return (fndds);
+	if (fndds->nfsdev_mdsisset == 0 && nfsrv_faildscnt > 0)
+		fndmirror = 1;
+	else {
+		/* For the fsid is set case, search for a mirror. */
+		TAILQ_FOREACH(ds, &nfsrv_devidhead, nfsdev_list) {
+			if (ds != fndds && ds->nfsdev_nmp != NULL &&
+			    ds->nfsdev_mdsisset != 0 &&
+			    ds->nfsdev_mdsfsid.val[0] ==
+			    fndds->nfsdev_mdsfsid.val[0] &&
+			    ds->nfsdev_mdsfsid.val[1] ==
+			    fndds->nfsdev_mdsfsid.val[1]) {
+				fndmirror = 1;
+				break;
+			}
+		}
+	}
+	if (fndmirror == 0) {
+		NFSD_DEBUG(4, "nfsrv_findmirroredds: no mirror for DS\n");
+		return (NULL);
+	}
+	return (fndds);
 }
 

From owner-svn-src-projects@freebsd.org  Thu Jun 28 21:01:39 2018
Return-Path: <owner-svn-src-projects@freebsd.org>
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 E77DF10272FC
 for <svn-src-projects@mailman.ysv.freebsd.org>;
 Thu, 28 Jun 2018 21:01:38 +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 954B88DFA2;
 Thu, 28 Jun 2018 21:01:38 +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 76A25177AE;
 Thu, 28 Jun 2018 21:01:38 +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 w5SL1cpX053795;
 Thu, 28 Jun 2018 21:01:38 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5SL1c9W053794;
 Thu, 28 Jun 2018 21:01:38 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201806282101.w5SL1c9W053794@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Thu, 28 Jun 2018 21:01:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject: svn commit: r335778 - projects/pnfs-planb-server/usr.sbin/nfsd
X-SVN-Group: projects
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: projects/pnfs-planb-server/usr.sbin/nfsd
X-SVN-Commit-Revision: 335778
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 &quot; projects&quot;
 tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects/>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 28 Jun 2018 21:01:39 -0000

Author: rmacklem
Date: Thu Jun 28 21:01:37 2018
New Revision: 335778
URL: https://svnweb.freebsd.org/changeset/base/335778

Log:
  Patch nfsd.c and nfsd.8 to add support for the optional "#<mds-export-path"
  suffix for each element of the option string for the "-p" option.
  The kernel changes are already committed.

Modified:
  projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8
  projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c

Modified: projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8
==============================================================================
--- projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8	Thu Jun 28 20:54:01 2018	(r335777)
+++ projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8	Thu Jun 28 21:01:37 2018	(r335778)
@@ -28,7 +28,7 @@
 .\"	@(#)nfsd.8	8.4 (Berkeley) 3/29/95
 .\" $FreeBSD$
 .\"
-.Dd May 31, 2018
+.Dd June 29, 2018
 .Dt NFSD 8
 .Os
 .Sh NAME
@@ -117,30 +117,62 @@ The
 .Ar pnfs_setup
 string is a set of fields separated by ',' characters:
 .Bl -tag -width Ds
-Each of these fields specifies one Data Server.
+Each of these fields specifies one DS.
 It consists of a server hostname, followed by a ':'
 and the directory path where the DS's data storage file system is mounted on
 this MDS server.
+This can optionally be followed by a '#' and the mds_path, which is the
+directory path for an exported file system on this MDS.
+If this is specified, it means that this DS is to be used to store data
+files for this mds_path file system only.
+If this optional component does not exist, the DS will be used to store data
+files for all exported MDS file systems.
+At this time, only IPv4 addresses are supported by the interface to the kernel,
+so the
+.Dq server hostname
+must resolve to an IPv4 address and support mounts on that address.
+This needs to be extended to support IPv6 addresses in the near future.
 The DS storage file systems must be mounted on this system before the
 .Nm
 is started with this option specified.
+.br
 For example:
 .sp
 nfsv4-data0:/data0,nfsv4-data1:/data1
 .sp
-Would specify two DS servers called nfsv4-data0 and nfsv4-data1 that comprise
+would specify two DS servers called nfsv4-data0 and nfsv4-data1 that comprise
 the data storage component of the pNFS service.
-The directories "/data0" and "/data1" are where the data storage servers exported
+These two DSs would be used to store data files for all exported file systems
+on this MDS.
+The directories
+.Dq /data0
+and
+.Dq /data1
+are where the data storage servers exported
 storage directories are mounted on this system (which will act as the MDS).
+.br
+Whereas, for the example:
+.sp
+nfsv4-data0:/data0#/export1,nfsv4-data1:/data1#/export2
+.sp
+would specify two DSs as above, however nfsv4-data0 will be used to store
+data files for
+.Dq /export1
+and nfsv4-data1 will be used to store data files for
+.Dq /export2 .
 .El
 .It Fl m Ar mirror_level
 This option is only meaningful when used with the
 .Fl p
 option.
-It specifies the ``mirror_level'', which defines how many of the DSs will
+It specifies the
+.Dq mirror_level ,
+which defines how many of the DSs will
 have a copy of a file's data storage file.
 The default of one implies no mirroring of data storage files on the DSs.
-The ``mirror_level'' would normally be set to 2 to enable mirroring, but
+The
+.Dq mirror_level
+would normally be set to 2 to enable mirroring, but
 can be as high as NFSDEV_MAXMIRRORS.
 .Pp
 If mirroring is enabled, the server must use the Flexible File
@@ -172,7 +204,7 @@ transports using six daemons.
 .Pp
 A server should run enough daemons to handle
 the maximum level of concurrency from its clients,
-typically four or more per CPU core.
+typically four to six.
 .Pp
 The
 .Nm
@@ -292,8 +324,10 @@ is running.
 If mirroring is enabled via the
 .Fl m
 option and there are Linux clients doing NFSv4.1 mounts, those clients
-need to be patched to support the ``tightly coupled'' variant of
+need to be patched to support the
+.Dq tightly coupled
+variant of
 the Flexible File layout or the
 .Xr sysctl 1
 vfs.nfsd.flexlinuxhack
-must be set on the MDS as a workaround.
+must be set to one on the MDS as a workaround.

Modified: projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c
==============================================================================
--- projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c	Thu Jun 28 20:54:01 2018	(r335777)
+++ projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c	Thu Jun 28 21:01:37 2018	(r335778)
@@ -787,10 +787,10 @@ main(int argc, char **argv)
 
 	setproctitle("master");
 	/*
-	 * We always want a master to have a clean way to to shut nfsd down
+	 * We always want a master to have a clean way to shut nfsd down
 	 * (with unregistration): if the master is killed, it unregisters and
 	 * kills all children. If we run for UDP only (and so do not have to
-	 * loop waiting waiting for accept), we instead make the parent
+	 * loop waiting for accept), we instead make the parent
 	 * a "server" too. start_server will not return.
 	 */
 	if (!tcpflag)
@@ -1178,9 +1178,11 @@ static void
 parse_dsserver(const char *optionarg, struct nfsd_nfsd_args *nfsdargp)
 {
 	char *ad, *cp, *cp2, *dsaddr, *dshost, *dspath, *dsvol, nfsprt[9];
+	char *mdspath, *mdsp;
 	int ecode;
 	u_int adsiz, dsaddrcnt, dshostcnt, dspathcnt, hostsiz, pathsiz;
-	size_t dsaddrsiz, dshostsiz, dspathsiz, nfsprtsiz;
+	u_int mdspathcnt;
+	size_t dsaddrsiz, dshostsiz, dspathsiz, nfsprtsiz, mdspathsiz;
 	struct addrinfo hints, *ai_tcp;
 	struct sockaddr_in sin;
 
@@ -1204,6 +1206,11 @@ parse_dsserver(const char *optionarg, struct nfsd_nfsd
 	dsaddr = malloc(dsaddrsiz);
 	if (dsaddr == NULL)
 		errx(1, "Out of memory");
+	mdspathsiz = 1024;
+	mdspathcnt = 0;
+	mdspath = malloc(mdspathsiz);
+	if (mdspath == NULL)
+		errx(1, "Out of memory");
 
 	/* Put the NFS port# in "." form. */
 	snprintf(nfsprt, 9, ".%d.%d", 2049 >> 8, 2049 & 0xff);
@@ -1225,6 +1232,14 @@ parse_dsserver(const char *optionarg, struct nfsd_nfsd
 			usage();
 		*dsvol++ = '\0';
 
+		/* Optional path for MDS file system to be stored on DS. */
+		mdsp = strchr(dsvol, '#');
+		if (mdsp != NULL) {
+			if (*(mdsp + 1) == '\0' || mdsp <= dsvol)
+				usage();
+			*mdsp++ = '\0';
+		}
+
 		/* Append this pathname to dspath. */
 		pathsiz = strlen(dsvol);
 		if (dspathcnt + pathsiz + 1 > dspathsiz) {
@@ -1236,6 +1251,23 @@ parse_dsserver(const char *optionarg, struct nfsd_nfsd
 		strcpy(&dspath[dspathcnt], dsvol);
 		dspathcnt += pathsiz + 1;
 
+		/* Append this pathname to mdspath. */
+		if (mdsp != NULL)
+			pathsiz = strlen(mdsp);
+		else
+			pathsiz = 0;
+		if (mdspathcnt + pathsiz + 1 > mdspathsiz) {
+			mdspathsiz *= 2;
+			mdspath = realloc(mdspath, mdspathsiz);
+			if (mdspath == NULL)
+				errx(1, "Out of memory");
+		}
+		if (mdsp != NULL)
+			strcpy(&mdspath[mdspathcnt], mdsp);
+		else
+			mdspath[mdspathcnt] = '\0';
+		mdspathcnt += pathsiz + 1;
+
 		if (ai_tcp != NULL)
 			freeaddrinfo(ai_tcp);
 
@@ -1288,6 +1320,8 @@ parse_dsserver(const char *optionarg, struct nfsd_nfsd
 	nfsdargp->dnshostlen = dshostcnt;
 	nfsdargp->dspath = dspath;
 	nfsdargp->dspathlen = dspathcnt;
+	nfsdargp->mdspath = mdspath;
+	nfsdargp->mdspathlen = mdspathcnt;
 	freeaddrinfo(ai_tcp);
 }
 

From owner-svn-src-projects@freebsd.org  Thu Jun 28 21:16:51 2018
Return-Path: <owner-svn-src-projects@freebsd.org>
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 7F731102774E
 for <svn-src-projects@mailman.ysv.freebsd.org>;
 Thu, 28 Jun 2018 21:16:51 +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 2B1228E7CB;
 Thu, 28 Jun 2018 21:16:51 +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 01300179B3;
 Thu, 28 Jun 2018 21:16:50 +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 w5SLGo8t061459;
 Thu, 28 Jun 2018 21:16:50 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5SLGoxp061458;
 Thu, 28 Jun 2018 21:16:50 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201806282116.w5SLGoxp061458@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Thu, 28 Jun 2018 21:16:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject: svn commit: r335780 - projects/pnfs-planb-server/usr.sbin/nfsd
X-SVN-Group: projects
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: projects/pnfs-planb-server/usr.sbin/nfsd
X-SVN-Commit-Revision: 335780
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 &quot; projects&quot;
 tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects/>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 28 Jun 2018 21:16:51 -0000

Author: rmacklem
Date: Thu Jun 28 21:16:50 2018
New Revision: 335780
URL: https://svnweb.freebsd.org/changeset/base/335780

Log:
  Try and improve the description of the "#mds-exported-path" suffix in the
  nfsd.8 man page.

Modified:
  projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8

Modified: projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8
==============================================================================
--- projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8	Thu Jun 28 21:14:33 2018	(r335779)
+++ projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8	Thu Jun 28 21:16:50 2018	(r335780)
@@ -174,6 +174,17 @@ The
 .Dq mirror_level
 would normally be set to 2 to enable mirroring, but
 can be as high as NFSDEV_MAXMIRRORS.
+There must be at least
+.Dq mirror_level
+DSs for each exported file system on the MDS, as specified in the
+.Fl p
+option.
+This implies that, for the above example using "#/export1" and "#/export2",
+mirroring cannot be done.
+There would need to be two DS entries for each of "#/export1" and "#/export2"
+in order to support a
+.Dq mirror_level
+of two.
 .Pp
 If mirroring is enabled, the server must use the Flexible File
 layout.

From owner-svn-src-projects@freebsd.org  Fri Jun 29 01:06:49 2018
Return-Path: <owner-svn-src-projects@freebsd.org>
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 D73CD102E97E
 for <svn-src-projects@mailman.ysv.freebsd.org>;
 Fri, 29 Jun 2018 01:06:48 +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 8C12676687;
 Fri, 29 Jun 2018 01:06:48 +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 6926119F2E;
 Fri, 29 Jun 2018 01:06:48 +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 w5T16m2H079236;
 Fri, 29 Jun 2018 01:06:48 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5T16m4T079235;
 Fri, 29 Jun 2018 01:06:48 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201806290106.w5T16m4T079235@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Fri, 29 Jun 2018 01:06:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject: svn commit: r335789 - 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: 335789
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 &quot; projects&quot;
 tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects/>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 29 Jun 2018 01:06:49 -0000

Author: rmacklem
Date: Fri Jun 29 01:06:47 2018
New Revision: 335789
URL: https://svnweb.freebsd.org/changeset/base/335789

Log:
  Fix a bug that was introduced by the recent addition of the "#<mds-path"
  optional suffix and the fact that I didn't realize that
  TAILQ_FOREACH_FROM() will start at the beginning of the list if the first
  argument == NULL when it is called.

Modified:
  projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c

Modified: projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c	Thu Jun 28 22:24:16 2018	(r335788)
+++ projects/pnfs-planb-server/sys/fs/nfsserver/nfs_nfsdport.c	Fri Jun 29 01:06:47 2018	(r335789)
@@ -3881,8 +3881,8 @@ nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, 
 	i = dsdir[0] = ds->nfsdev_nextdir;
 	ds->nfsdev_nextdir = (ds->nfsdev_nextdir + 1) % nfsrv_dsdirsize;
 	dvp[0] = ds->nfsdev_dsdir[i];
-	if (nfsrv_maxpnfsmirror > 1) {
-		mds = TAILQ_NEXT(ds, nfsdev_list);
+	mds = TAILQ_NEXT(ds, nfsdev_list);
+	if (nfsrv_maxpnfsmirror > 1 && mds != NULL) {
 		TAILQ_FOREACH_FROM(mds, &nfsrv_devidhead, nfsdev_list) {
 			if (mds->nfsdev_nmp != NULL &&
 			    (mds->nfsdev_mdsisset == 0 ||
@@ -3906,7 +3906,8 @@ nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, 
 	if (mirrorcnt > 1)
 		tdsc = dsc = malloc(sizeof(*dsc) * (mirrorcnt - 1), M_TEMP,
 		    M_WAITOK | M_ZERO);
-	tpf = pf = malloc(sizeof(*pf) * mirrorcnt, M_TEMP, M_WAITOK | M_ZERO);
+	tpf = pf = malloc(sizeof(*pf) * nfsrv_maxpnfsmirror, M_TEMP, M_WAITOK |
+	    M_ZERO);
 
 	error = nfsvno_getfh(vp, &fh, p);
 	if (error == 0)
@@ -4014,11 +4015,27 @@ nfsrv_pnfscreate(struct vnode *vp, struct vattr *vap, 
 	NFSFREECRED(tcred);
 	if (error == 0) {
 		ASSERT_VOP_ELOCKED(vp, "nfsrv_pnfscreate vp");
+
+		NFSD_DEBUG(4, "nfsrv_pnfscreate: mirrorcnt=%d maxmirror=%d\n",
+		    mirrorcnt, nfsrv_maxpnfsmirror);
+		/*
+		 * For all mirrors that couldn't be created, fill in the
+		 * *pf structure, but with an IP address == 0.0.0.0.
+		 */
+		tpf = pf + mirrorcnt;
+		for (i = mirrorcnt; i < nfsrv_maxpnfsmirror; i++, tpf++) {
+			*tpf = *pf;
+			tpf->dsf_sin.sin_family = AF_INET;
+			tpf->dsf_sin.sin_len = sizeof(struct sockaddr_in);
+			tpf->dsf_sin.sin_addr.s_addr = 0;
+			tpf->dsf_sin.sin_port = 0;
+		}
+
 		error = vn_start_write(vp, &mp, V_WAIT);
 		if (error == 0) {
 			error = vn_extattr_set(vp, IO_NODELOCKED,
 			    EXTATTR_NAMESPACE_SYSTEM, "pnfsd.dsfile",
-			    sizeof(*pf) * mirrorcnt, (char *)pf, p);
+			    sizeof(*pf) * nfsrv_maxpnfsmirror, (char *)pf, p);
 			if (error == 0)
 				error = vn_extattr_set(vp, IO_NODELOCKED,
 				    EXTATTR_NAMESPACE_SYSTEM, "pnfsd.dsattr",

From owner-svn-src-projects@freebsd.org  Fri Jun 29 22:07:26 2018
Return-Path: <owner-svn-src-projects@freebsd.org>
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 A818CF7EBC1
 for <svn-src-projects@mailman.ysv.freebsd.org>;
 Fri, 29 Jun 2018 22:07:26 +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 59C867E3CE;
 Fri, 29 Jun 2018 22:07:26 +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 3632526B55;
 Fri, 29 Jun 2018 22:07:26 +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 w5TM7Q8a052771;
 Fri, 29 Jun 2018 22:07:26 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5TM7QX9052770;
 Fri, 29 Jun 2018 22:07:26 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201806292207.w5TM7QX9052770@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Fri, 29 Jun 2018 22:07:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject: svn commit: r335806 - projects/pnfs-planb-server/usr.sbin/nfsd
X-SVN-Group: projects
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: projects/pnfs-planb-server/usr.sbin/nfsd
X-SVN-Commit-Revision: 335806
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 &quot; projects&quot;
 tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects/>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 29 Jun 2018 22:07:26 -0000

Author: rmacklem
Date: Fri Jun 29 22:07:25 2018
New Revision: 335806
URL: https://svnweb.freebsd.org/changeset/base/335806

Log:
  Add support for IPv6 addresses to the "-p" option for the pNFS server DS
  specifications.

Modified:
  projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c

Modified: projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c
==============================================================================
--- projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c	Fri Jun 29 21:15:26 2018	(r335805)
+++ projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c	Fri Jun 29 22:07:25 2018	(r335806)
@@ -1177,14 +1177,16 @@ backup_stable(__unused int signo)
 static void
 parse_dsserver(const char *optionarg, struct nfsd_nfsd_args *nfsdargp)
 {
-	char *ad, *cp, *cp2, *dsaddr, *dshost, *dspath, *dsvol, nfsprt[9];
-	char *mdspath, *mdsp;
+	char *cp, *cp2, *dsaddr, *dshost, *dspath, *dsvol, nfsprt[9];
+	char *mdspath, *mdsp, ip6[INET6_ADDRSTRLEN];
+	const char *ad;
 	int ecode;
 	u_int adsiz, dsaddrcnt, dshostcnt, dspathcnt, hostsiz, pathsiz;
 	u_int mdspathcnt;
 	size_t dsaddrsiz, dshostsiz, dspathsiz, nfsprtsiz, mdspathsiz;
-	struct addrinfo hints, *ai_tcp;
+	struct addrinfo hints, *ai_tcp, *res;
 	struct sockaddr_in sin;
+	struct sockaddr_in6 sin6;
 
 	cp = strdup(optionarg);
 	if (cp == NULL)
@@ -1273,22 +1275,45 @@ parse_dsserver(const char *optionarg, struct nfsd_nfsd
 
 		/* Get the fully qualified domain name and IP address. */
 		memset(&hints, 0, sizeof(hints));
-		hints.ai_flags = AI_CANONNAME;
-		hints.ai_family = AF_INET;
+		hints.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;
+		hints.ai_family = PF_UNSPEC;
 		hints.ai_socktype = SOCK_STREAM;
 		hints.ai_protocol = IPPROTO_TCP;
 		ecode = getaddrinfo(cp, NULL, &hints, &ai_tcp);
 		if (ecode != 0)
 			err(1, "getaddrinfo pnfs: %s %s", cp,
 			    gai_strerror(ecode));
-		if (ai_tcp->ai_addr->sa_family != AF_INET ||
-		    ai_tcp->ai_addrlen < sizeof(sin))
-			err(1, "getaddrinfo() returned non-INET address");
-		/* Mips cares about sockaddr_in alignment, so copy the addr. */
-		memcpy(&sin, ai_tcp->ai_addr, sizeof(sin));
+		ad = NULL;
+		for (res = ai_tcp; res != NULL; res = res->ai_next) {
+			if (res->ai_addr->sa_family == AF_INET) {
+				if (res->ai_addrlen < sizeof(sin))
+					err(1, "getaddrinfo() returned "
+					    "undersized IPv4 address");
+				/*
+				 * Mips cares about sockaddr_in alignment,
+				 * so copy the address.
+				 */
+				memcpy(&sin, res->ai_addr, sizeof(sin));
+				ad = inet_ntoa(sin.sin_addr);
+				break;
+			} else if (res->ai_family == AF_INET6) {
+				if (res->ai_addrlen < sizeof(sin6))
+					err(1, "getaddrinfo() returned "
+					    "undersized IPv6 address");
+				/*
+				 * Mips cares about sockaddr_in6 alignment,
+				 * so copy the address.
+				 */
+				memcpy(&sin6, res->ai_addr, sizeof(sin6));
+				ad = inet_ntop(AF_INET6, &sin6.sin6_addr, ip6,
+				    sizeof(ip6));
+				break;
+			}
+		}
+		if (ad == NULL)
+			err(1, "No IP address for %s", cp);
 
 		/* Append this address to dsaddr. */
-		ad = inet_ntoa(sin.sin_addr);
 		adsiz = strlen(ad);
 		if (dsaddrcnt + adsiz + nfsprtsiz + 1 > dsaddrsiz) {
 			dsaddrsiz *= 2;

From owner-svn-src-projects@freebsd.org  Fri Jun 29 22:10:41 2018
Return-Path: <owner-svn-src-projects@freebsd.org>
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 3F9AFF7ED76
 for <svn-src-projects@mailman.ysv.freebsd.org>;
 Fri, 29 Jun 2018 22:10:41 +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 D980D7E524;
 Fri, 29 Jun 2018 22:10:40 +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 BAB1426B63;
 Fri, 29 Jun 2018 22:10:40 +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 w5TMAe4g053002;
 Fri, 29 Jun 2018 22:10:40 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5TMAeM1053001;
 Fri, 29 Jun 2018 22:10:40 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201806292210.w5TMAeM1053001@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Fri, 29 Jun 2018 22:10:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject: svn commit: r335807 - projects/pnfs-planb-server/usr.sbin/nfsd
X-SVN-Group: projects
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: projects/pnfs-planb-server/usr.sbin/nfsd
X-SVN-Commit-Revision: 335807
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 &quot; projects&quot;
 tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects/>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 29 Jun 2018 22:10:41 -0000

Author: rmacklem
Date: Fri Jun 29 22:10:40 2018
New Revision: 335807
URL: https://svnweb.freebsd.org/changeset/base/335807

Log:
  Update the nfsd.8 man page to reflect that IPv6 addresses are now supported
  when getaddrinfo(3) returns them while parsing the "-p" option for the
  specification of DSs.

Modified:
  projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8

Modified: projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8
==============================================================================
--- projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8	Fri Jun 29 22:07:25 2018	(r335806)
+++ projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.8	Fri Jun 29 22:10:40 2018	(r335807)
@@ -28,7 +28,7 @@
 .\"	@(#)nfsd.8	8.4 (Berkeley) 3/29/95
 .\" $FreeBSD$
 .\"
-.Dd June 29, 2018
+.Dd June 30, 2018
 .Dt NFSD 8
 .Os
 .Sh NAME
@@ -127,11 +127,6 @@ If this is specified, it means that this DS is to be u
 files for this mds_path file system only.
 If this optional component does not exist, the DS will be used to store data
 files for all exported MDS file systems.
-At this time, only IPv4 addresses are supported by the interface to the kernel,
-so the
-.Dq server hostname
-must resolve to an IPv4 address and support mounts on that address.
-This needs to be extended to support IPv6 addresses in the near future.
 The DS storage file systems must be mounted on this system before the
 .Nm
 is started with this option specified.

From owner-svn-src-projects@freebsd.org  Sat Jun 30 08:25:57 2018
Return-Path: <owner-svn-src-projects@freebsd.org>
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 85AA0102435E
 for <svn-src-projects@mailman.ysv.freebsd.org>;
 Sat, 30 Jun 2018 08:25:57 +0000 (UTC)
 (envelope-from bu7cher@yandex.ru)
Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net
 [IPv6:2a02:6b8:0:1472:2741:0:8b7:106])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id D23A87423A;
 Sat, 30 Jun 2018 08:25:56 +0000 (UTC)
 (envelope-from bu7cher@yandex.ru)
Received: from mxback7g.mail.yandex.net (mxback7g.mail.yandex.net
 [IPv6:2a02:6b8:0:1472:2741:0:8b7:168])
 by forward103p.mail.yandex.net (Yandex) with ESMTP id AD222218660B;
 Sat, 30 Jun 2018 11:25:52 +0300 (MSK)
Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net
 [2a02:6b8:0:1619::15:6])
 by mxback7g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 6w5M9wXgj4-PqlWn7YR; 
 Sat, 30 Jun 2018 11:25:52 +0300
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail;
 t=1530347152; bh=SP+HI8ndtKkEaXZgdmjTGv3tbfFow3qXoqgSZB5t+mA=;
 h=Subject:To:References:From:Message-ID:Date:In-Reply-To;
 b=eXyEJb7iKMoj6dfXys02SsAgJBpXwShjnG+4Qle08fOTWOv5GKtCb+JQOAu8VNJlH
 +SXZeFTpNnC4I5ysXBv4hjRg4w6+a1646yArktQdsopfQTkVGWxOsbfgfkyoC7s/Fe
 X6TwwA1Xci2btriweEVdLPUff2udZPnCimxgwt9A=
Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id
 AcRL7szujp-Pq5OHaPv; Sat, 30 Jun 2018 11:25:52 +0300
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client certificate not present)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail;
 t=1530347152; bh=SP+HI8ndtKkEaXZgdmjTGv3tbfFow3qXoqgSZB5t+mA=;
 h=Subject:To:References:From:Message-ID:Date:In-Reply-To;
 b=eXyEJb7iKMoj6dfXys02SsAgJBpXwShjnG+4Qle08fOTWOv5GKtCb+JQOAu8VNJlH
 +SXZeFTpNnC4I5ysXBv4hjRg4w6+a1646yArktQdsopfQTkVGWxOsbfgfkyoC7s/Fe
 X6TwwA1Xci2btriweEVdLPUff2udZPnCimxgwt9A=
Authentication-Results: smtp4j.mail.yandex.net; dkim=pass header.i=@yandex.ru
Subject: Re: svn commit: r335806 - projects/pnfs-planb-server/usr.sbin/nfsd
To: Rick Macklem <rmacklem@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-projects@freebsd.org
References: <201806292207.w5TM7QX9052770@repo.freebsd.org>
From: "Andrey V. Elsukov" <bu7cher@yandex.ru>
Openpgp: id=E6591E1B41DA1516F0C9BC0001C5EA0410C8A17A
Autocrypt: addr=bu7cher@yandex.ru; prefer-encrypt=mutual; keydata=
 xsBNBEwBF1kBCADB9sXFhBEUy8qQ4X63Y8eBatYMHGEFWN9ypS5lI3RE6qQW2EYbxNk7qUC5
 21YIIS1mMFVBEfvR7J9uc7yaYgFCEb6Sce1RSO4ULN2mRKGHP3/Sl0ijZEjWHV91hY1YTHEF
 ZW/0GYinDf56sYpDDehaBF5wkWIo1+QK5nmj3vl0DIDCMNd7QEiWpyLVwECgLX2eOAXByT8B
 bCqVhJGcG6iFP7/B9Ll6uX5gb8thM9LM+ibwErDBVDGiOgvfxqidab7fdkh893IBCXa82H9N
 CNwnEtcgzh+BSKK5BgvPohFMgRwjti37TSxwLu63QejRGbZWSz3OK3jMOoF63tCgn7FvABEB
 AAHNIkFuZHJleSBWLiBFbHN1a292IDxhZUBmcmVlYnNkLm9yZz7CwHsEEwECACUCGwMGCwkI
 BwMCBhUIAgkKCwQWAgMBAh4BAheABQJMB/ruAhkBAAoJEAHF6gQQyKF6MLwH/3Ri/TZl9uo0
 SepYWXOnxL6EaDVXDA+dLb1eLKC4PRBBjX29ttQ0KaWapiE6y5/AfzOPmRtHLrHYHjd/aiHX
 GMLHcYRXD+5GvdkK8iMALrZ28X0JXyuuZa8rAxWIWmCbYHNSBy2unqWgTI04Erodk90IALgM
 9JeHN9sFqTM6zalrMnTzlcmel4kcjT3lyYw3vOKgoYLtsLhKZSbJoVVVlvRlGBpHFJI5AoYJ
 SyfXoN0rcX6k9X7Isp2K50YjqxV4v78xluh1puhwZyC0p8IShPrmrp9Oy9JkMX90o6UAXdGU
 KfdExJuGJfUZOFBTtNIMNIAKfMTjhpRhxONIr0emxxDOwE0ETAEXWQEIAJ2p6l9LBoqdH/0J
 PEFDY2t2gTvAuzz+8zs3R03dFuHcNbOwjvWCG0aOmVpAzkRa8egn5JB4sZaFUtKPYJEQ1Iu+
 LUBwgvtXf4vWpzC67zs2dDuiW4LamH5p6xkTD61aHR7mCB3bg2TUjrDWn2Jt44cvoYxj3dz4
 S49U1rc9ZPgD5axCNv45j72tggWlZvpefThP7xT1OlNTUqye2gAwQravXpZkl5JG4eOqJVIU
 X316iE3qso0iXRUtO7OseBf0PiVmk+wCahdreHOeOxK5jMhYkPKVn7z1sZiB7W2H2TojbmcK
 HZC22sz7Z/H36Lhg1+/RCnGzdEcjGc8oFHXHCxUAEQEAAcLAXwQYAQIACQUCTAEXWQIbDAAK
 CRABxeoEEMihegkYCAC3ivGYNe2taNm/4Nx5GPdzuaAJGKWksV+w9mo7dQvU+NmI2az5w8vw
 98OmX7G0OV9snxMW+6cyNqBrVFTu33VVNzz9pnqNCHxGvj5dL5ltP160JV2zw2bUwJBYsgYQ
 WfyJJIM7l3gv5ZS3DGqaGIm9gOK1ANxfrR5PgPzvI9VxDhlr2juEVMZYAqPLEJe+SSxbwLoz
 BcFCNdDAyXcaAzXsx/E02YWm1hIWNRxanAe7Vlg7OL+gvLpdtrYCMg28PNqKNyrQ87LQ49O9
 50IIZDOtNFeR0FGucjcLPdS9PiEqCoH7/waJxWp6ydJ+g4OYRBYNM0EmMgy1N85JJrV1mi5i
Message-ID: <0c85d229-3b8f-3b4c-ba3c-34ec06728455@yandex.ru>
Date: Sat, 30 Jun 2018 11:22:41 +0300
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101
 Thunderbird/52.8.0
MIME-Version: 1.0
In-Reply-To: <201806292207.w5TM7QX9052770@repo.freebsd.org>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="wOxAZ3H2Y5wTidZlugg1gFckvddm0P1z0"
X-BeenThere: svn-src-projects@freebsd.org
X-Mailman-Version: 2.1.26
Precedence: list
List-Id: "SVN commit messages for the src &quot; projects&quot;
 tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects/>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 30 Jun 2018 08:25:57 -0000

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--wOxAZ3H2Y5wTidZlugg1gFckvddm0P1z0
Content-Type: multipart/mixed; boundary="Cy0mHi3LpMMo4xu93hEg62X8ZtHJcBV4w";
 protected-headers="v1"
From: "Andrey V. Elsukov" <bu7cher@yandex.ru>
To: Rick Macklem <rmacklem@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-projects@freebsd.org
Message-ID: <0c85d229-3b8f-3b4c-ba3c-34ec06728455@yandex.ru>
Subject: Re: svn commit: r335806 - projects/pnfs-planb-server/usr.sbin/nfsd
References: <201806292207.w5TM7QX9052770@repo.freebsd.org>
In-Reply-To: <201806292207.w5TM7QX9052770@repo.freebsd.org>

--Cy0mHi3LpMMo4xu93hEg62X8ZtHJcBV4w
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

On 30.06.2018 01:07, Rick Macklem wrote:
> Author: rmacklem
> Date: Fri Jun 29 22:07:25 2018
> New Revision: 335806
> URL: https://svnweb.freebsd.org/changeset/base/335806
>=20
> Log:
>   Add support for IPv6 addresses to the "-p" option for the pNFS server=
 DS
>   specifications.
>=20
> +	char *mdspath, *mdsp, ip6[INET6_ADDRSTRLEN];
> +	const char *ad;
>  	int ecode;
> +		hints.ai_flags =3D AI_CANONNAME | AI_ADDRCONFIG;
> +		hints.ai_family =3D PF_UNSPEC;
>  		hints.ai_socktype =3D SOCK_STREAM;
>  		hints.ai_protocol =3D IPPROTO_TCP;
>  		ecode =3D getaddrinfo(cp, NULL, &hints, &ai_tcp);
>  		if (ecode !=3D 0)
>  			err(1, "getaddrinfo pnfs: %s %s", cp,
>  			    gai_strerror(ecode));
> +				memcpy(&sin6, res->ai_addr, sizeof(sin6));
> +				ad =3D inet_ntop(AF_INET6, &sin6.sin6_addr, ip6,
> +				    sizeof(ip6));

Hi,

I'm unaware of applicability of IPv6 addresses with restricted scope in
this area, but when you use inet_ntop() to get IPv6 address text
representation, you can lost IPv6 scope zone id. getaddrinfo() can
return sockaddr structure with properly filled sin6_scope_id field. It
is better to use getnameinfo() with NI_NUMERICHOST flag. Also the size
of ip6 buffer should be enough to keep scope specifier.

--=20
WBR, Andrey V. Elsukov


--Cy0mHi3LpMMo4xu93hEg62X8ZtHJcBV4w--

--wOxAZ3H2Y5wTidZlugg1gFckvddm0P1z0
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAls3PdcACgkQAcXqBBDI
oXocJAf9HrU/c/Ptmk/ZCsEAaSxuT8n8sk2EPyu8H2qDW1/HIQXD3zR0p54fwHBE
iuiZmnjgVG2k4dNF1zkVsTOB++Zx/2jvAyld2JZdjWWKy1HqyXLvdIWmLlzUr0u+
yOWroPhW3r+pAWAHmJ72mtIVbRj6wJBa4ItOhA22WPQVR5ZUBvUklWhqgDUMfbII
o5Cgoo2YfQSNVvFiXDkey5/4AZ4cexq0iKgI5HPguc2xYsMRGJBYvLx+sCd20vKK
kzh/Ua0Kh4PD2s90EDk5vjY2SNqa3MsNNkiQFuq8bNUD07Eb0LGw3Qb6YH+3iN8e
bkurSxIYHPLq1OgmhCRQ3GwNLMKAEA==
=Z+au
-----END PGP SIGNATURE-----

--wOxAZ3H2Y5wTidZlugg1gFckvddm0P1z0--

From owner-svn-src-projects@freebsd.org  Sat Jun 30 12:17:51 2018
Return-Path: <owner-svn-src-projects@freebsd.org>
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 EA65B102D9AB
 for <svn-src-projects@mailman.ysv.freebsd.org>;
 Sat, 30 Jun 2018 12:17:50 +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 9DB467B7F8;
 Sat, 30 Jun 2018 12:17:50 +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 7BBC57D70;
 Sat, 30 Jun 2018 12:17:50 +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 w5UCHo7I003718;
 Sat, 30 Jun 2018 12:17:50 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5UCHonN003717;
 Sat, 30 Jun 2018 12:17:50 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201806301217.w5UCHonN003717@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Sat, 30 Jun 2018 12:17:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject: svn commit: r335815 - projects/pnfs-planb-server/usr.sbin/nfsd
X-SVN-Group: projects
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: projects/pnfs-planb-server/usr.sbin/nfsd
X-SVN-Commit-Revision: 335815
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 &quot; projects&quot;
 tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects/>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 30 Jun 2018 12:17:51 -0000

Author: rmacklem
Date: Sat Jun 30 12:17:50 2018
New Revision: 335815
URL: https://svnweb.freebsd.org/changeset/base/335815

Log:
  Add a safety belt assignment to the nfsd for when "-p" isn't specified.
  
  The kernel code assumes that nfsdargs.addr == NULL and nfsdargs.addrlen == 0
  when there is no "-p" argument used for starting the nfsd.
  This small patch ensures this is the case. In practice, I believe this always
  happened, since "nfsdargs" was the last element on the stack for "main()",
  but this little patch ensures it will be the case.
  Spotted by inspection while adding a new optional field for "-p".

Modified:
  projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c

Modified: projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c
==============================================================================
--- projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c	Sat Jun 30 12:14:20 2018	(r335814)
+++ projects/pnfs-planb-server/usr.sbin/nfsd/nfsd.c	Sat Jun 30 12:17:50 2018	(r335815)
@@ -180,6 +180,8 @@ main(int argc, char **argv)
 	struct nfsd_nfsd_args nfsdargs;
 
 	nfsdargs.mirrorcnt = 1;
+	nfsdargs.addr = NULL;
+	nfsdargs.addrlen = 0;
 	nfsdcnt = DEFNFSDCNT;
 	unregister = reregister = tcpflag = maxsock = 0;
 	bindanyflag = udpflag = connect_type_cnt = bindhostc = 0;

From owner-svn-src-projects@freebsd.org  Sat Jun 30 19:50:26 2018
Return-Path: <owner-svn-src-projects@freebsd.org>
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 2F908FD5BBF
 for <svn-src-projects@mailman.ysv.freebsd.org>;
 Sat, 30 Jun 2018 19:50:26 +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 CDDDD8A228;
 Sat, 30 Jun 2018 19:50:25 +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 AAE9E14589;
 Sat, 30 Jun 2018 19:50:25 +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 w5UJoPLp037857;
 Sat, 30 Jun 2018 19:50:25 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5UJoPOS037856;
 Sat, 30 Jun 2018 19:50:25 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201806301950.w5UJoPOS037856@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Sat, 30 Jun 2018 19:50:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject: svn commit: r335824 - projects/pnfs-planb-server/usr.bin/pnfsdsfile
X-SVN-Group: projects
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: projects/pnfs-planb-server/usr.bin/pnfsdsfile
X-SVN-Commit-Revision: 335824
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.27
Precedence: list
List-Id: "SVN commit messages for the src &quot; projects&quot;
 tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects/>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 30 Jun 2018 19:50:26 -0000

Author: rmacklem
Date: Sat Jun 30 19:50:25 2018
New Revision: 335824
URL: https://svnweb.freebsd.org/changeset/base/335824

Log:
  Add a "-m" option to pnfsdsfile that can be used by a sysadmin to prep a
  file on the MDS exported tree to be mirrored.
  It simply add entrie(s) with an IP address of 0.0.0.0, so pnfsdscopymr -r
  will mirror it.

Modified:
  projects/pnfs-planb-server/usr.bin/pnfsdsfile/pnfsdsfile.c

Modified: projects/pnfs-planb-server/usr.bin/pnfsdsfile/pnfsdsfile.c
==============================================================================
--- projects/pnfs-planb-server/usr.bin/pnfsdsfile/pnfsdsfile.c	Sat Jun 30 19:36:02 2018	(r335823)
+++ projects/pnfs-planb-server/usr.bin/pnfsdsfile/pnfsdsfile.c	Sat Jun 30 19:50:25 2018	(r335824)
@@ -50,6 +50,7 @@ static void usage(void);
 
 static struct option longopts[] = {
 	{ "changeds",	required_argument,	NULL,	'c'	},
+	{ "mirror",	required_argument,	NULL,	'm'	},
 	{ "quiet",	no_argument,		NULL,	'q'	},
 	{ "zerods",	required_argument,	NULL,	'r'	},
 	{ "ds",		required_argument,	NULL,	's'	},
@@ -71,27 +72,27 @@ main(int argc, char *argv[])
 	struct sockaddr_in6 *sin6, adsin6;
 	char hostn[2 * NI_MAXHOST + 2], *cp;
 	struct pnfsdsfile dsfile[NFSDEV_MAXMIRRORS];
-	int ch, dosetxattr, i, mirrorcnt, quiet, zerods, zerofh;
+	int ch, dosetxattr, i, mirrorcnt, mirrorit, quiet, zerods, zerofh;
 	in_port_t tport;
 	ssize_t xattrsize, xattrsize2;
 
 	zerods = 0;
 	zerofh = 0;
+	mirrorit = 0;
 	quiet = 0;
 	dosetxattr = 0;
 	res = NULL;
 	newres = NULL;
 	cp = NULL;
-	while ((ch = getopt_long(argc, argv, "c:qr:s:z", longopts, NULL)) != -1)
-	    {
+	while ((ch = getopt_long(argc, argv, "c:m:qr:s:z", longopts, NULL)) !=
+	    -1) {
 		switch (ch) {
 		case 'c':
 			/* Replace the first DS server with the second one. */
-			if (zerofh != 0 || zerods != 0)
-				errx(1, "-c, -r and -z are mutually "
-				    "exclusive");
-			if (res != NULL)
-				errx(1, "-c and -s are mutually exclusive");
+			if (zerofh != 0 || zerods != 0 || mirrorit != 0 ||
+			    newres != NULL || res != NULL)
+				errx(1, "-c, -m, -r, -s and -z are mutually "
+				    "exclusive and only can be used once");
 			strlcpy(hostn, optarg, 2 * NI_MAXHOST + 2);
 			cp = strchr(hostn, ',');
 			if (cp == NULL)
@@ -103,31 +104,44 @@ main(int argc, char *argv[])
 			if (getaddrinfo(cp, NULL, NULL, &newres) != 0)
 				errx(1, "Can't get IP# for %s", cp);
 			break;
+		case 'm':
+			/* Add 0.0.0.0 entries up to mirror level. */
+			if (zerofh != 0 || zerods != 0 || mirrorit != 0 ||
+			    newres != NULL || res != NULL)
+				errx(1, "-c, -m, -r, -s and -z are mutually "
+				    "exclusive and only can be used once");
+			mirrorit = atoi(optarg);
+			if (mirrorit < 2 || mirrorit > NFSDEV_MAXMIRRORS)
+				errx(1, "-m %d out of range", mirrorit);
+			break;
 		case 'q':
 			quiet = 1;
 			break;
 		case 'r':
 			/* Reset the DS server in a mirror with 0.0.0.0. */
-			if (zerofh != 0 || res != NULL || newres != NULL)
-				errx(1, "-r and -s, -z or -c are mutually "
-				    "exclusive");
+			if (zerofh != 0 || zerods != 0 || mirrorit != 0 ||
+			    newres != NULL || res != NULL)
+				errx(1, "-c, -m, -r, -s and -z are mutually "
+				    "exclusive and only can be used once");
 			zerods = 1;
 			/* Translate the server name to an IP address. */
 			if (getaddrinfo(optarg, NULL, NULL, &res) != 0)
 				errx(1, "Can't get IP# for %s", optarg);
 			break;
 		case 's':
-			if (res != NULL)
-				errx(1, "-s, -c and -r are mutually "
-				    "exclusive");
 			/* Translate the server name to an IP address. */
+			if (zerofh != 0 || zerods != 0 || mirrorit != 0 ||
+			    newres != NULL || res != NULL)
+				errx(1, "-c, -m, -r, -s and -z are mutually "
+				    "exclusive and only can be used once");
 			if (getaddrinfo(optarg, NULL, NULL, &res) != 0)
 				errx(1, "Can't get IP# for %s", optarg);
 			break;
 		case 'z':
-			if (newres != NULL || zerods != 0)
-				errx(1, "-c, -r and -z are mutually "
-				    "exclusive");
+			if (zerofh != 0 || zerods != 0 || mirrorit != 0 ||
+			    newres != NULL || res != NULL)
+				errx(1, "-c, -m, -r, -s and -z are mutually "
+				    "exclusive and only can be used once");
 			zerofh = 1;
 			break;
 		default:
@@ -309,8 +323,26 @@ main(int argc, char *argv[])
 			    dsfile[i].dsf_filename);
 		}
 	}
+	/* Add entrie(s) with IP address set to 0.0.0.0, as required. */
+	for (i = mirrorcnt; i < mirrorit; i++) {
+		dsfile[i] = dsfile[0];
+		dsfile[i].dsf_sin.sin_family = AF_INET;
+		dsfile[i].dsf_sin.sin_len = sizeof(struct sockaddr_in);
+		dsfile[i].dsf_sin.sin_addr.s_addr = 0;
+		dsfile[i].dsf_sin.sin_port = 0;
+		if (quiet == 0) {
+			/* Print out the 0.0.0.0 entry. */
+			printf("\t0.0.0.0\tds%d/%s", dsfile[i].dsf_dir,
+			    dsfile[i].dsf_filename);
+		}
+	}
+	if (mirrorit > mirrorcnt) {
+		xattrsize = mirrorit * sizeof(struct pnfsdsfile);
+		dosetxattr = 1;
+	}
 	if (quiet == 0)
 		printf("\n");
+
 	if (dosetxattr != 0 && extattr_set_file(*argv, EXTATTR_NAMESPACE_SYSTEM,
 	    "pnfsd.dsfile", dsfile, xattrsize) != xattrsize)
 		err(1, "Can't set pnfsd.dsfile");

From owner-svn-src-projects@freebsd.org  Sat Jun 30 20:10:29 2018
Return-Path: <owner-svn-src-projects@freebsd.org>
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 23788FDA79A
 for <svn-src-projects@mailman.ysv.freebsd.org>;
 Sat, 30 Jun 2018 20:10: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 CAB7A8B213;
 Sat, 30 Jun 2018 20:10:28 +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 AD1C0148B6;
 Sat, 30 Jun 2018 20:10:28 +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 w5UKASlx048774;
 Sat, 30 Jun 2018 20:10:28 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5UKASsu048773;
 Sat, 30 Jun 2018 20:10:28 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201806302010.w5UKASsu048773@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Sat, 30 Jun 2018 20:10:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject: svn commit: r335826 - projects/pnfs-planb-server/usr.bin/pnfsdsfile
X-SVN-Group: projects
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: projects/pnfs-planb-server/usr.bin/pnfsdsfile
X-SVN-Commit-Revision: 335826
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.27
Precedence: list
List-Id: "SVN commit messages for the src &quot; projects&quot;
 tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects/>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 30 Jun 2018 20:10:29 -0000

Author: rmacklem
Date: Sat Jun 30 20:10:28 2018
New Revision: 335826
URL: https://svnweb.freebsd.org/changeset/base/335826

Log:
  The previous patch checked for other incompatible options too agressively.
  "-s" can be used with "-z" and this patch again allows that.

Modified:
  projects/pnfs-planb-server/usr.bin/pnfsdsfile/pnfsdsfile.c

Modified: projects/pnfs-planb-server/usr.bin/pnfsdsfile/pnfsdsfile.c
==============================================================================
--- projects/pnfs-planb-server/usr.bin/pnfsdsfile/pnfsdsfile.c	Sat Jun 30 20:09:43 2018	(r335825)
+++ projects/pnfs-planb-server/usr.bin/pnfsdsfile/pnfsdsfile.c	Sat Jun 30 20:10:28 2018	(r335826)
@@ -130,18 +130,18 @@ main(int argc, char *argv[])
 			break;
 		case 's':
 			/* Translate the server name to an IP address. */
-			if (zerofh != 0 || zerods != 0 || mirrorit != 0 ||
-			    newres != NULL || res != NULL)
-				errx(1, "-c, -m, -r, -s and -z are mutually "
-				    "exclusive and only can be used once");
+			if (zerods != 0 || mirrorit != 0 || newres != NULL ||
+			    res != NULL)
+				errx(1, "-c, -m and -r are mutually exclusive "
+				    "from use with -s and -z");
 			if (getaddrinfo(optarg, NULL, NULL, &res) != 0)
 				errx(1, "Can't get IP# for %s", optarg);
 			break;
 		case 'z':
 			if (zerofh != 0 || zerods != 0 || mirrorit != 0 ||
-			    newres != NULL || res != NULL)
-				errx(1, "-c, -m, -r, -s and -z are mutually "
-				    "exclusive and only can be used once");
+			    newres != NULL)
+				errx(1, "-c, -m and -r are mutually exclusive "
+				    "from use with -s and -z");
 			zerofh = 1;
 			break;
 		default:

From owner-svn-src-projects@freebsd.org  Sat Jun 30 20:15:12 2018
Return-Path: <owner-svn-src-projects@freebsd.org>
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 191C9FDA96B
 for <svn-src-projects@mailman.ysv.freebsd.org>;
 Sat, 30 Jun 2018 20:15: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 AAD768B5C6;
 Sat, 30 Jun 2018 20:15: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 856A014A60;
 Sat, 30 Jun 2018 20:15: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 w5UKFBYo053664;
 Sat, 30 Jun 2018 20:15:11 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5UKFBPp053663;
 Sat, 30 Jun 2018 20:15:11 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201806302015.w5UKFBPp053663@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem <rmacklem@FreeBSD.org>
Date: Sat, 30 Jun 2018 20:15:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject: svn commit: r335827 - projects/pnfs-planb-server/usr.bin/pnfsdsfile
X-SVN-Group: projects
X-SVN-Commit-Author: rmacklem
X-SVN-Commit-Paths: projects/pnfs-planb-server/usr.bin/pnfsdsfile
X-SVN-Commit-Revision: 335827
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.27
Precedence: list
List-Id: "SVN commit messages for the src &quot; projects&quot;
 tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects/>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
 <mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 30 Jun 2018 20:15:12 -0000

Author: rmacklem
Date: Sat Jun 30 20:15:11 2018
New Revision: 335827
URL: https://svnweb.freebsd.org/changeset/base/335827

Log:
  Update the man page to describe the recently added "-m" option flag.

Modified:
  projects/pnfs-planb-server/usr.bin/pnfsdsfile/pnfsdsfile.1

Modified: projects/pnfs-planb-server/usr.bin/pnfsdsfile/pnfsdsfile.1
==============================================================================
--- projects/pnfs-planb-server/usr.bin/pnfsdsfile/pnfsdsfile.1	Sat Jun 30 20:10:28 2018	(r335826)
+++ projects/pnfs-planb-server/usr.bin/pnfsdsfile/pnfsdsfile.1	Sat Jun 30 20:15:11 2018	(r335827)
@@ -23,7 +23,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 11, 2018
+.Dd June 30, 2018
 .Dt PNFSDSFILE 1
 .Os
 .Sh NAME
@@ -37,6 +37,7 @@ extended attribute for them
 .Op Fl qz
 .Op Fl s Ar dshostname
 .Op Fl c Ar old-dshostname,new-dshostname
+.Op Fl m Ar mirror_level
 .Op Fl r Ar dshostname
 .Ar mdsfile
 .Sh DESCRIPTION
@@ -91,6 +92,16 @@ or AF_INET6 address that
 returns for the new-dshostname.
 Changing a DS server's host IP# should be avoided, but this option will
 allow it to be changed, if the change is unavoidable.
+.It Fl m Ar mirror_level
+This option adds entrie(s) to the extended attributes with IP address set
+to 0.0.0.0 to bring the number of entries up to
+.Dq mirror_level .
+It can be used by a system administrator to prepare a file for mirroring
+via the
+.Xr pnfsdscopymr
+command with
+.Fl r
+option.
 .It Fl r Ar dshostname
 This option sets the IP address of the extended attribute entry for the
 .Ar dshostname