svn commit: r335778 - projects/pnfs-planb-server/usr.sbin/nfsd

Rick Macklem rmacklem at FreeBSD.org
Thu Jun 28 21:01:39 UTC 2018


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);
 }
 


More information about the svn-src-projects mailing list