From owner-svn-src-projects@freebsd.org Fri Aug 18 01:31:36 2017 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24941DE4B39 for ; Fri, 18 Aug 2017 01:31:36 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E2A896D165; Fri, 18 Aug 2017 01:31:35 +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 v7I1VYqr046981; Fri, 18 Aug 2017 01:31:34 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7I1VYUV046980; Fri, 18 Aug 2017 01:31:34 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201708180131.v7I1VYUV046980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 18 Aug 2017 01:31:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r322641 - projects/pnfs-planb-server-stable11/usr.sbin/nfsd X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/pnfs-planb-server-stable11/usr.sbin/nfsd X-SVN-Commit-Revision: 322641 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.23 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 01:31:36 -0000 Author: rmacklem Date: Fri Aug 18 01:31:34 2017 New Revision: 322641 URL: https://svnweb.freebsd.org/changeset/base/322641 Log: Add the '#' delimiter for use with the "-p" option to indicate that the next DS is a mirror of the current one. This is not yet documented in the man page, since mirroring is only for testing at this time. There is no code to handle mirror failures yet. Modified: projects/pnfs-planb-server-stable11/usr.sbin/nfsd/nfsd.c Modified: projects/pnfs-planb-server-stable11/usr.sbin/nfsd/nfsd.c ============================================================================== --- projects/pnfs-planb-server-stable11/usr.sbin/nfsd/nfsd.c Fri Aug 18 01:23:54 2017 (r322640) +++ projects/pnfs-planb-server-stable11/usr.sbin/nfsd/nfsd.c Fri Aug 18 01:31:34 2017 (r322641) @@ -1174,7 +1174,7 @@ static void parse_dsserver(const char *optarg, struct nfsd_nfsd_args *nfsdargp) { char *ad, *cp, *cp2, *dsaddr, *dshost, *dspath, *dsvol, nfsprt[9]; - char *mirror, mirrorstr[NFSDEV_MIRRORSTR + 1]; + char *mirror, mirrorstr[NFSDEV_MIRRORSTR + 1], *cp3; int adsiz, dsaddrcnt, dshostcnt, dspathcnt, ecode, hostsiz, pathsiz; int mirrorcnt, mirrorstrsiz, mirrorindex; size_t dsaddrsiz, dshostsiz, dspathsiz, nfsprtsiz, mirrorsiz; @@ -1215,12 +1215,26 @@ parse_dsserver(const char *optarg, struct nfsd_nfsd_ar mirrorindex = 0; /* Loop around for each DS server name. */ do { + /* + * If the next DS is separated from the current one with a '#', + * it is a mirror. If the next DS is separated from the current + * one with a ',', it is not a mirror of the previous DS. + */ cp2 = strchr(cp, ','); + cp3 = strchr(cp, '#'); + if (cp3 != NULL && (cp2 == NULL || cp3 < cp2)) + cp2 = cp3; /* A mirror of the previous DS. */ + else + cp3 = NULL; /* Not a mirror of the previous DS. */ if (cp2 != NULL) { + /* Not the last DS in the list. */ *cp2++ = '\0'; if (*cp2 == '\0') usage(); + if (cp3 == NULL) + mirrorindex++; /* Increment if not a mirror. */ } + dsvol = strchr(cp, ':'); if (dsvol == NULL || *(dsvol + 1) == '\0') usage(); @@ -1281,7 +1295,7 @@ printf("pnfs path=%s\n", dsvol); /* Append this mirrorindex to mirror. */ if (snprintf(mirrorstr, NFSDEV_MIRRORSTR + 1, "%d", - mirrorindex++) > NFSDEV_MIRRORSTR) + mirrorindex) > NFSDEV_MIRRORSTR) errx(1, "Too many mirrors"); mirrorstrsiz = strlen(mirrorstr); if (mirrorcnt + mirrorstrsiz + 1 > mirrorsiz) {