Commit f8a41a75 authored by Mike Hibler's avatar Mike Hibler

The new -I option was missing from the patch.

parent ee72b56b
...@@ -147,18 +147,42 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -147,18 +147,42 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
struct exportlist *exphead; struct exportlist *exphead;
struct mountlist *mlhead; struct mountlist *mlhead;
@@ -241,6 +288,10 @@ @@ -241,6 +288,11 @@
int dolog = 0; int dolog = 0;
int got_sighup = 0; int got_sighup = 0;
int xcreated = 0; int xcreated = 0;
+#ifdef SPLIT_MOUNT +#ifdef SPLIT_MOUNT
+int forceincremental = 0;
+int got_sigusr1 = 0; +int got_sigusr1 = 0;
+char *tsfile = "/var/run/mountd.ts"; +char *tsfile = "/var/run/mountd.ts";
+#endif +#endif
char *svcport_str = NULL; char *svcport_str = NULL;
static int mallocd_svcport = 0; static int mallocd_svcport = 0;
@@ -467,7 +518,7 @@ @@ -380,7 +432,7 @@
else
close(s);
- while ((c = getopt(argc, argv, "2deh:lnop:rS")) != -1)
+ while ((c = getopt(argc, argv, "2deh:lnop:rSI")) != -1)
switch (c) {
case '2':
force_v2 = 1;
@@ -435,6 +487,13 @@
case 'S':
suspend_nfsd = 1;
break;
+#ifdef SPLIT_MOUNT
+ case 'I':
+ forceincremental = 1;
+ break;
+#else
+ usage();
+#endif
default:
usage();
};
@@ -467,7 +526,7 @@
openlog("mountd", LOG_PID, LOG_DAEMON); openlog("mountd", LOG_PID, LOG_DAEMON);
if (debug) if (debug)
warnx("getting export list"); warnx("getting export list");
...@@ -167,7 +191,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -167,7 +191,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
if (debug) if (debug)
warnx("getting mount list"); warnx("getting mount list");
get_mountlist(); get_mountlist();
@@ -479,6 +530,9 @@ @@ -479,6 +538,9 @@
signal(SIGQUIT, SIG_IGN); signal(SIGQUIT, SIG_IGN);
} }
signal(SIGHUP, huphandler); signal(SIGHUP, huphandler);
...@@ -177,12 +201,16 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -177,12 +201,16 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
signal(SIGTERM, terminate); signal(SIGTERM, terminate);
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
@@ -638,9 +692,15 @@ @@ -638,9 +700,19 @@
/* Expand svc_run() here so that we can call get_exportlist(). */ /* Expand svc_run() here so that we can call get_exportlist(). */
for (;;) { for (;;) {
if (got_sighup) { if (got_sighup) {
- get_exportlist(); - get_exportlist();
+#ifdef SPLIT_MOUNT
+ get_exportlist(forceincremental);
+#else
+ get_exportlist(0); + get_exportlist(0);
+#endif
got_sighup = 0; got_sighup = 0;
} }
+#ifdef SPLIT_MOUNT +#ifdef SPLIT_MOUNT
...@@ -194,7 +222,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -194,7 +222,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
readfds = svc_fdset; readfds = svc_fdset;
switch (select(svc_maxfd + 1, &readfds, NULL, NULL, NULL)) { switch (select(svc_maxfd + 1, &readfds, NULL, NULL, NULL)) {
case -1: case -1:
@@ -1020,6 +1080,9 @@ @@ -1020,6 +1092,9 @@
sigemptyset(&sighup_mask); sigemptyset(&sighup_mask);
sigaddset(&sighup_mask, SIGHUP); sigaddset(&sighup_mask, SIGHUP);
...@@ -204,7 +232,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -204,7 +232,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
saddr = svc_getrpccaller(transp)->buf; saddr = svc_getrpccaller(transp)->buf;
switch (saddr->sa_family) { switch (saddr->sa_family) {
case AF_INET6: case AF_INET6:
@@ -1296,6 +1359,9 @@ @@ -1296,6 +1371,9 @@
sigemptyset(&sighup_mask); sigemptyset(&sighup_mask);
sigaddset(&sighup_mask, SIGHUP); sigaddset(&sighup_mask, SIGHUP);
...@@ -214,7 +242,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -214,7 +242,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
sigprocmask(SIG_BLOCK, &sighup_mask, NULL); sigprocmask(SIG_BLOCK, &sighup_mask, NULL);
ep = exphead; ep = exphead;
while (ep) { while (ep) {
@@ -1404,11 +1470,152 @@ @@ -1404,11 +1482,152 @@
int linesize; int linesize;
FILE *exp_file; FILE *exp_file;
...@@ -368,7 +396,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -368,7 +396,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
{ {
struct exportlist *ep, *ep2; struct exportlist *ep, *ep2;
struct grouplist *grp, *tgrp; struct grouplist *grp, *tgrp;
@@ -1421,9 +1628,11 @@ @@ -1421,9 +1640,11 @@
v4root_phase = 0; v4root_phase = 0;
dirhead = (struct dirlist *)NULL; dirhead = (struct dirlist *)NULL;
...@@ -380,7 +408,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -380,7 +408,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
cp = line; cp = line;
nextfield(&cp, &endcp); nextfield(&cp, &endcp);
if (*cp == '#') if (*cp == '#')
@@ -1463,6 +1672,7 @@ @@ -1463,6 +1684,7 @@
len = endcp-cp; len = endcp-cp;
tgrp = grp = get_grp(); tgrp = grp = get_grp();
while (len > 0) { while (len > 0) {
...@@ -388,7 +416,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -388,7 +416,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
if (len > MNTNAMLEN) { if (len > MNTNAMLEN) {
getexp_err(ep, tgrp); getexp_err(ep, tgrp);
goto nextline; goto nextline;
@@ -1475,8 +1685,14 @@ @@ -1475,8 +1697,14 @@
if (debug) if (debug)
warnx("doing opt %s", cp); warnx("doing opt %s", cp);
got_nondir = 1; got_nondir = 1;
...@@ -405,7 +433,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -405,7 +433,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
getexp_err(ep, tgrp); getexp_err(ep, tgrp);
goto nextline; goto nextline;
} }
@@ -1534,7 +1750,12 @@ @@ -1534,7 +1762,12 @@
* See if this directory is already * See if this directory is already
* in the list. * in the list.
*/ */
...@@ -418,7 +446,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -418,7 +446,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
if (ep == (struct exportlist *)NULL) { if (ep == (struct exportlist *)NULL) {
ep = get_exp(); ep = get_exp();
ep->ex_fs = fsb.f_fsid; ep->ex_fs = fsb.f_fsid;
@@ -1576,6 +1797,7 @@ @@ -1576,6 +1809,7 @@
goto nextline; goto nextline;
} }
...@@ -426,7 +454,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -426,7 +454,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
/* /*
* Get the host or netgroup. * Get the host or netgroup.
*/ */
@@ -1604,6 +1826,10 @@ @@ -1604,6 +1838,10 @@
} while (netgrp && getnetgrent(&hst, &usr, &dom)); } while (netgrp && getnetgrent(&hst, &usr, &dom));
endnetgrent(); endnetgrent();
*endcp = savedc; *endcp = savedc;
...@@ -437,7 +465,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -437,7 +465,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
} }
cp = endcp; cp = endcp;
nextfield(&cp, &endcp); nextfield(&cp, &endcp);
@@ -1654,11 +1880,17 @@ @@ -1654,11 +1892,17 @@
*/ */
grp = tgrp; grp = tgrp;
do { do {
...@@ -457,7 +485,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -457,7 +485,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
} while (grp->gr_next && (grp = grp->gr_next)); } while (grp->gr_next && (grp = grp->gr_next));
/* /*
@@ -1682,6 +1914,7 @@ @@ -1682,6 +1926,7 @@
/* /*
* Success. Update the data structures. * Success. Update the data structures.
*/ */
...@@ -465,7 +493,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -465,7 +493,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
if (has_host) { if (has_host) {
hang_dirp(dirhead, tgrp, ep, opt_flags); hang_dirp(dirhead, tgrp, ep, opt_flags);
grp->gr_next = grphead; grp->gr_next = grphead;
@@ -1689,13 +1922,22 @@ @@ -1689,13 +1934,22 @@
} else { } else {
hang_dirp(dirhead, (struct grouplist *)NULL, ep, hang_dirp(dirhead, (struct grouplist *)NULL, ep,
opt_flags); opt_flags);
...@@ -488,7 +516,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -488,7 +516,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
/* /*
* Insert in the list in alphabetical order. * Insert in the list in alphabetical order.
*/ */
@@ -1706,8 +1948,15 @@ @@ -1706,8 +1960,15 @@
if (ep2) if (ep2)
ep->ex_next = ep2; ep->ex_next = ep2;
*epp = ep; *epp = ep;
...@@ -504,7 +532,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -504,7 +532,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
nextline: nextline:
v4root_phase = 0; v4root_phase = 0;
if (dirhead) { if (dirhead) {
@@ -1715,75 +1964,63 @@ @@ -1715,75 +1976,63 @@
dirhead = (struct dirlist *)NULL; dirhead = (struct dirlist *)NULL;
} }
} }
...@@ -617,7 +645,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -617,7 +645,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
if (num > 0) { if (num > 0) {
build_iovec(&iov, &iovlen, "fstype", NULL, 0); build_iovec(&iov, &iovlen, "fstype", NULL, 0);
@@ -1795,7 +2032,10 @@ @@ -1795,7 +2044,10 @@
} }
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
...@@ -629,7 +657,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -629,7 +657,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
if (getvfsbyname(fsp->f_fstypename, &vfc) != 0) { if (getvfsbyname(fsp->f_fstypename, &vfc) != 0) {
syslog(LOG_ERR, "getvfsbyname() failed for %s", syslog(LOG_ERR, "getvfsbyname() failed for %s",
fsp->f_fstypename); fsp->f_fstypename);
@@ -1834,6 +2074,7 @@ @@ -1834,6 +2086,7 @@
"can't delete exports for %s: %m %s", "can't delete exports for %s: %m %s",
fsp->f_mntonname, errmsg); fsp->f_mntonname, errmsg);
} }
...@@ -637,7 +665,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -637,7 +665,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
} }
if (iov != NULL) { if (iov != NULL) {
@@ -1848,7 +2089,325 @@ @@ -1848,7 +2101,326 @@
/* free iov, allocated by realloc() */ /* free iov, allocated by realloc() */
free(iov); free(iov);
iovlen = 0; iovlen = 0;
...@@ -916,6 +944,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -916,6 +944,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
+ } + }
+#endif +#endif
+ +
+ syslog(LOG_INFO, "Doing %s update\n", incremental ? "incremental" : "full");
+ TS_GET(tsexport); + TS_GET(tsexport);
+ if (!incremental && suspend_nfsd != 0) { + if (!incremental && suspend_nfsd != 0) {
+ TS_GET(suspend); + TS_GET(suspend);
...@@ -963,7 +992,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -963,7 +992,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
/* /*
* Read in the exports file and build the list, calling * Read in the exports file and build the list, calling
@@ -1862,7 +2421,7 @@ @@ -1862,7 +2434,7 @@
syslog(LOG_WARNING, "can't open %s", exnames[i]); syslog(LOG_WARNING, "can't open %s", exnames[i]);
continue; continue;
} }
...@@ -972,7 +1001,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -972,7 +1001,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
fclose(exp_file); fclose(exp_file);
done++; done++;
} }
@@ -1871,6 +2430,28 @@ @@ -1871,6 +2443,28 @@
exit(2); exit(2);
} }
...@@ -1001,7 +1030,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -1001,7 +1030,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
/* /*
* If there was no public fh, clear any previous one set. * If there was no public fh, clear any previous one set.
*/ */
@@ -1879,6 +2460,87 @@ @@ -1879,6 +2473,87 @@
/* Resume the nfsd. If they weren't suspended, this is harmless. */ /* Resume the nfsd. If they weren't suspended, this is harmless. */
(void)nfssvc(NFSSVC_RESUMENFSD, NULL); (void)nfssvc(NFSSVC_RESUMENFSD, NULL);
...@@ -1089,7 +1118,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -1089,7 +1118,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
} }
/* /*
@@ -1954,6 +2616,8 @@ @@ -1954,6 +2629,8 @@
{ {
struct dirlist *dp; struct dirlist *dp;
...@@ -1098,7 +1127,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -1098,7 +1127,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
dp = (struct dirlist *)malloc(sizeof (struct dirlist) + len); dp = (struct dirlist *)malloc(sizeof (struct dirlist) + len);
if (dp == (struct dirlist *)NULL) if (dp == (struct dirlist *)NULL)
out_of_mem(); out_of_mem();
@@ -2376,7 +3040,7 @@ @@ -2376,7 +3053,7 @@
ai->ai_flags |= AI_CANONNAME; ai->ai_flags |= AI_CANONNAME;
} }
if (debug) if (debug)
...@@ -1107,7 +1136,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -1107,7 +1136,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
/* /*
* Sanity check: make sure we don't already have an entry * Sanity check: make sure we don't already have an entry
* for this host in the grouplist. * for this host in the grouplist.
@@ -2467,7 +3131,8 @@ @@ -2467,7 +3144,8 @@
*/ */
int int
do_mount(struct exportlist *ep, struct grouplist *grp, int exflags, do_mount(struct exportlist *ep, struct grouplist *grp, int exflags,
...@@ -1117,7 +1146,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -1117,7 +1146,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
{ {
struct statfs fsb1; struct statfs fsb1;
struct addrinfo *ai; struct addrinfo *ai;
@@ -2481,6 +3146,8 @@ @@ -2481,6 +3159,8 @@
int ret; int ret;
struct nfsex_args nfsea; struct nfsex_args nfsea;
...@@ -1126,7 +1155,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -1126,7 +1155,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
if (run_v4server > 0) if (run_v4server > 0)
eap = &nfsea.export; eap = &nfsea.export;
else else
@@ -2586,7 +3253,34 @@ @@ -2586,7 +3266,34 @@
iov[5].iov_len = strlen(fsb->f_mntfromname) + 1; iov[5].iov_len = strlen(fsb->f_mntfromname) + 1;
errmsg[0] = '\0'; errmsg[0] = '\0';
...@@ -1162,7 +1191,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -1162,7 +1191,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
if (cp) if (cp)
*cp-- = savedc; *cp-- = savedc;
else else
@@ -2692,6 +3386,12 @@ @@ -2692,6 +3399,12 @@
/* free iov, allocated by realloc() */ /* free iov, allocated by realloc() */
free(iov); free(iov);
} }
...@@ -1175,7 +1204,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -1175,7 +1204,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
return (ret); return (ret);
} }
@@ -2906,6 +3606,15 @@ @@ -2906,6 +3619,15 @@
struct group *gr; struct group *gr;
gid_t groups[XU_NGROUPS + 1]; gid_t groups[XU_NGROUPS + 1];
int ngroups; int ngroups;
...@@ -1191,7 +1220,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -1191,7 +1220,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
cr->cr_version = XUCRED_VERSION; cr->cr_version = XUCRED_VERSION;
/* /*
@@ -2932,17 +3641,44 @@ @@ -2932,17 +3654,44 @@
syslog(LOG_ERR, "unknown user: %s", name); syslog(LOG_ERR, "unknown user: %s", name);
return; return;
} }
...@@ -1240,7 +1269,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -1240,7 +1269,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
return; return;
} }
/* /*
@@ -3150,6 +3886,7 @@ @@ -3150,6 +3899,7 @@
/* /*
* Check an absolute directory path for any symbolic links. Return true * Check an absolute directory path for any symbolic links. Return true
...@@ -1248,7 +1277,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -1248,7 +1277,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
*/ */
int int
check_dirpath(char *dirp) check_dirpath(char *dirp)
@@ -3168,7 +3905,7 @@ @@ -3168,7 +3918,7 @@
} }
cp++; cp++;
} }
...@@ -1257,7 +1286,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -1257,7 +1286,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
ret = 0; ret = 0;
return (ret); return (ret);
} }
@@ -3292,9 +4029,14 @@ @@ -3292,9 +4042,14 @@
} }
void void
...@@ -1274,7 +1303,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c ...@@ -1274,7 +1303,7 @@ diff -Nu mountd.orig/mountd.c mountd/mountd.c
} }
void terminate(int sig __unused) void terminate(int sig __unused)
@@ -3304,4 +4046,3 @@ @@ -3304,4 +4059,3 @@
rpcb_unset(MOUNTPROG, MOUNTVERS3, NULL); rpcb_unset(MOUNTPROG, MOUNTVERS3, NULL);
exit (0); exit (0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment