nfs-utils/nfs-utils-1.3.3-rc2.patch

443 lines
14 KiB
Diff
Raw Normal View History

diff --git a/configure.ac b/configure.ac
index 8e427e3..e61430f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,7 +60,6 @@ AC_ARG_WITH(systemd,
[AC_HELP_STRING([--with-systemd@<:@=unit-dir-path@:>@],
[install systemd unit files @<:@Default: no, and path defaults to /usr/lib/systemd/system if not given@:>@])],
test "$withval" = "no" && use_systemd=0 || unitdir=$withval use_systemd=1
- use_systemd=0
)
AM_CONDITIONAL(INSTALL_SYSTEMD, [test "$use_systemd" = 1])
AC_SUBST(unitdir)
diff --git a/support/nfs/exports.c b/support/nfs/exports.c
index eb782b9..4b17d3c 100644
--- a/support/nfs/exports.c
+++ b/support/nfs/exports.c
@@ -154,6 +154,7 @@ getexportent(int fromkernel, int fromexports)
}
}
+ xfree(ee.e_hostname);
ee = def_ee;
/* Check for default client */
@@ -176,7 +177,6 @@ getexportent(int fromkernel, int fromexports)
if (!has_default_opts)
xlog(L_WARNING, "No options for %s %s: suggest %s(sync) to avoid warning", ee.e_path, exp, exp);
}
- xfree(ee.e_hostname);
ee.e_hostname = xstrdup(hostname);
if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0)
diff --git a/systemd/Makefile.am b/systemd/Makefile.am
index 16cf5e6..fbcabb1 100644
--- a/systemd/Makefile.am
+++ b/systemd/Makefile.am
@@ -3,7 +3,6 @@
MAINTAINERCLEANFILES = Makefile.in
unit_files = \
- nfs-blkmap.target \
nfs-client.target \
\
auth-rpcgss-module.service \
diff --git a/systemd/README b/systemd/README
index a2a5f06..bbd7790 100644
--- a/systemd/README
+++ b/systemd/README
@@ -24,7 +24,7 @@ by a suitable 'preset' setting:
is started by /usr/sbin/start-statd which mount.nfs will run
if statd is needed.
- nfs-blkmap.target
+ nfs-blkmap.service
If enabled, then blkmapd will be run when nfs-client.target is
started.
diff --git a/systemd/auth-rpcgss-module.service b/systemd/auth-rpcgss-module.service
index 0355e13..5241f7b 100644
--- a/systemd/auth-rpcgss-module.service
+++ b/systemd/auth-rpcgss-module.service
@@ -6,6 +6,7 @@
# unit will fail. But that's OK.)
[Unit]
Description=Kernel Module supporting RPCSEC_GSS
+DefaultDependencies=no
Before=gssproxy.service rpc-svcgssd.service rpc-gssd.service
Wants=gssproxy.service rpc-svcgssd.service rpc-gssd.service
ConditionPathExists=/etc/krb5.keytab
diff --git a/systemd/nfs-blkmap.service b/systemd/nfs-blkmap.service
index f470e3d..ddbf4e9 100644
--- a/systemd/nfs-blkmap.service
+++ b/systemd/nfs-blkmap.service
@@ -5,12 +5,13 @@ Conflicts=umount.target
After=var-lib-nfs-rpc_pipefs.mount
Requires=var-lib-nfs-rpc_pipefs.mount
-Requisite=nfs-blkmap.target
-After=nfs-blkmap.target
-
PartOf=nfs-utils.service
[Service]
Type=forking
PIDFile=/var/run/blkmapd.pid
+EnvironmentFile=-/run/sysconfig/nfs-utils
ExecStart=/usr/sbin/blkmapd $BLKMAPDARGS
+
+[Install]
+WantedBy=nfs-client.target
diff --git a/systemd/nfs-blkmap.target b/systemd/nfs-blkmap.target
deleted file mode 100644
index fbcc111..0000000
--- a/systemd/nfs-blkmap.target
+++ /dev/null
@@ -1,8 +0,0 @@
-[Unit]
-Description= PNFS blkmaping enablement.
-# If this target is enabled, then blkmapd will be started
-# as required. If it is not enabled it won't.
-
-[Install]
-WantedBy=remote-fs.target
-WantedBy=multi-user.target
\ No newline at end of file
diff --git a/systemd/nfs-client.target b/systemd/nfs-client.target
index 9b792a3..8a8300a 100644
--- a/systemd/nfs-client.target
+++ b/systemd/nfs-client.target
@@ -5,8 +5,7 @@ Wants=remote-fs-pre.target
# Note: we don't "Wants=rpc-statd.service" as "mount.nfs" will arrange to
# start that on demand if needed.
-Wants=nfs-blkmap.service rpc-statd-notify.service
-After=nfs-blkmap.service
+Wants=rpc-statd-notify.service
# GSS services dependencies and ordering
Wants=auth-rpcgss-module.service
diff --git a/systemd/nfs-config.service b/systemd/nfs-config.service
index 64010e6..7f65305 100644
--- a/systemd/nfs-config.service
+++ b/systemd/nfs-config.service
@@ -1,5 +1,7 @@
[Unit]
Description=Preprocess NFS configuration
+After=local-fs.target
+DefaultDependencies=no
[Service]
Type=oneshot
diff --git a/systemd/nfs-idmapd.service b/systemd/nfs-idmapd.service
index e84f8c8..df3dd9d 100644
--- a/systemd/nfs-idmapd.service
+++ b/systemd/nfs-idmapd.service
@@ -1,7 +1,8 @@
[Unit]
Description=NFSv4 ID-name mapping service
+DefaultDependencies=no
Requires=var-lib-nfs-rpc_pipefs.mount
-After=var-lib-nfs-rpc_pipefs.mount
+After=var-lib-nfs-rpc_pipefs.mount local-fs.target
BindsTo=nfs-server.service
diff --git a/systemd/nfs-mountd.service b/systemd/nfs-mountd.service
index d908afe..8a39f3e 100644
--- a/systemd/nfs-mountd.service
+++ b/systemd/nfs-mountd.service
@@ -1,8 +1,9 @@
[Unit]
Description=NFS Mount Daemon
+DefaultDependencies=no
Requires=proc-fs-nfsd.mount
After=proc-fs-nfsd.mount
-After=network.target
+After=network.target local-fs.target
BindsTo=nfs-server.service
Wants=nfs-config.service
diff --git a/systemd/nfs-server.service b/systemd/nfs-server.service
index 8010aad..db801cb 100644
--- a/systemd/nfs-server.service
+++ b/systemd/nfs-server.service
@@ -1,10 +1,12 @@
[Unit]
Description=NFS server and services
+DefaultDependencies=no
Requires= network.target proc-fs-nfsd.mount rpcbind.target
Requires= nfs-mountd.service
Wants=rpc-statd.service nfs-idmapd.service
Wants=rpc-statd-notify.service
+After= local-fs.target
After= network.target proc-fs-nfsd.mount rpcbind.target nfs-mountd.service
After= nfs-idmapd.service rpc-statd.service
Before= rpc-statd-notify.service
@@ -13,6 +15,9 @@ Before= rpc-statd-notify.service
Wants=auth-rpcgss-module.service
After=rpc-gssd.service gssproxy.service rpc-svcgssd.service
+# start/stop server before/after client
+Before=remote-fs-pre.target
+
Wants=nfs-config.service
After=nfs-config.service
diff --git a/systemd/rpc-statd-notify.service b/systemd/rpc-statd-notify.service
index 941afe5..89ba36c 100644
--- a/systemd/rpc-statd-notify.service
+++ b/systemd/rpc-statd-notify.service
@@ -1,7 +1,8 @@
[Unit]
Description=Notify NFS peers of a restart
-Requires=network-online.target
-After=network-online.target nss-lookup.target
+DefaultDependencies=no
+Requires=network.target
+After=local-fs.target network.target nss-lookup.target
# if we run an nfs server, it needs to be running before we
# tell clients that it has restarted.
diff --git a/systemd/rpc-svcgssd.service b/systemd/rpc-svcgssd.service
index f7424b0..41177b6 100644
--- a/systemd/rpc-svcgssd.service
+++ b/systemd/rpc-svcgssd.service
@@ -1,7 +1,8 @@
[Unit]
Description=RPC security service for NFS server
+DefaultDependencies=no
Requires=var-lib-nfs-rpc_pipefs.mount
-After=var-lib-nfs-rpc_pipefs.mount
+After=var-lib-nfs-rpc_pipefs.mount local-fs.target
PartOf=nfs-server.service
PartOf=nfs-utils.service
diff --git a/tools/mountstats/mountstats.man b/tools/mountstats/mountstats.man
index bee3f86..a9df1e4 100644
--- a/tools/mountstats/mountstats.man
+++ b/tools/mountstats/mountstats.man
@@ -10,7 +10,7 @@ mountstats \- Displays various NFS client per-mount statistics
.RB [ \-v | \-\-version ]
.RB [ \-f | \-\-file
.IR infile ]
-.RB [ \-s | \-\-since
+.RB [ \-S | \-\-since
.IR sincefile ]
.\" .RB [ \-n | \-\-nfs | \-r | \-\-rpc | \-R | \-\-raw ]
.R [
@@ -27,7 +27,7 @@ mountstats \- Displays various NFS client per-mount statistics
.RB [ \-v | \-\-version ]
.RB [ \-f | \-\-file
.IR infile ]
-.RB [ \-s | \-\-since
+.RB [ \-S | \-\-since
.IR sincefile ]
.RI [ interval ]
.RI [ count ]
@@ -38,7 +38,7 @@ mountstats \- Displays various NFS client per-mount statistics
.RB [ \-v | \-\-version ]
.RB [ \-f | \-\-file
.IR infile ]
-.RB [ \-s | \-\-since
+.RB [ \-S | \-\-since
.IR sincefile ]
.RB [ \-3 ]
.RB [ \-4 ]
@@ -128,7 +128,7 @@ parameter is specified without the
parameter, the command generates reports continuously. This may not be used with the
.BR \-f | \-\-file
or
-.BR \-s | \-\-since
+.BR \-S | \-\-since
options.
.SS Options specific to the nfsstat sub-command
.IP "\fB\-3\fP"
diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
index fd73feb..38943eb 100644
--- a/tools/mountstats/mountstats.py
+++ b/tools/mountstats/mountstats.py
@@ -686,7 +686,7 @@ def mountstats_command(args):
"""Mountstats command
"""
mountstats = parse_stats_file(args.infile)
- mountpoints = args.mountpoints
+ mountpoints = [os.path.normpath(mp) for mp in args.mountpoints]
# make certain devices contains only NFS mount points
if len(mountpoints) > 0:
@@ -708,7 +708,7 @@ def mountstats_command(args):
mountpoints += [device]
if len(mountpoints) == 0:
print('No NFS mount points were found')
- return
+ return 1
if args.since:
old_mountstats = parse_stats_file(args.since)
@@ -729,12 +729,13 @@ def mountstats_command(args):
args.infile.close()
if args.since:
args.since.close()
+ return 0
def nfsstat_command(args):
"""nfsstat-like command for NFS mount points
"""
mountstats = parse_stats_file(args.infile)
- mountpoints = args.mountpoints
+ mountpoints = [os.path.normpath(mp) for mp in args.mountpoints]
v3stats = DeviceData()
v3stats.setup_accumulator(Nfsv3ops)
v4stats = DeviceData()
@@ -766,7 +767,7 @@ def nfsstat_command(args):
mountpoints += [device]
if len(mountpoints) == 0:
print('No NFS mount points were found')
- return
+ return 1
if args.since:
old_mountstats = parse_stats_file(args.since)
@@ -803,6 +804,7 @@ def nfsstat_command(args):
args.infile.close()
if args.since:
args.since.close()
+ return 0
def print_iostat_summary(old, new, devices, time):
for device in devices:
@@ -820,7 +822,7 @@ def iostat_command(args):
"""iostat-like command for NFS mount points
"""
mountstats = parse_stats_file(args.infile)
- devices = args.mountpoints
+ devices = [os.path.normpath(mp) for mp in args.mountpoints]
if args.since:
old_mountstats = parse_stats_file(args.since)
@@ -847,7 +849,7 @@ def iostat_command(args):
devices += [device]
if len(devices) == 0:
print('No NFS mount points were found')
- return
+ return 1
sample_time = 0
@@ -875,6 +877,7 @@ def iostat_command(args):
args.infile.close()
if args.since:
args.since.close()
+ return 0
class ICMAction(argparse.Action):
"""Custom action to deal with interval, count, and mountpoints.
@@ -986,7 +989,7 @@ try:
sys.stdout.close()
sys.stderr.close()
sys.exit(res)
-except (SystemExit, KeyboardInterrupt, RuntimeError):
+except (KeyboardInterrupt, RuntimeError):
sys.exit(1)
except IOError:
pass
diff --git a/utils/exportfs/exports.man b/utils/exportfs/exports.man
index 3d974d9..88d9fbe 100644
--- a/utils/exportfs/exports.man
+++ b/utils/exportfs/exports.man
@@ -218,16 +218,46 @@ This option can be very useful in some situations, but it should be
used with due care, and only after confirming that the client system
copes with the situation effectively.
-The option can be explicitly disabled with
+The option can be explicitly disabled for NFSv2 and NFSv3 with
.IR hide .
+
+This option is not relevant when NFSv4 is use. NFSv4 never hides
+subordinate filesystems. Any filesystem that is exported will be
+visible where expected when using NFSv4.
.TP
-.IR crossmnt
+.I crossmnt
This option is similar to
.I nohide
-but it makes it possible for clients to move from the filesystem marked
-with crossmnt to exported filesystems mounted on it. Thus when a child
-filesystem "B" is mounted on a parent "A", setting crossmnt on "A" has
-the same effect as setting "nohide" on B.
+but it makes it possible for clients to access all filesystems mounted
+on a filesystem marked with
+.IR crossmnt .
+Thus when a child filesystem "B" is mounted on a parent "A", setting
+crossmnt on "A" has a similar effect to setting "nohide" on B.
+
+With
+.I nohide
+the child filesystem needs to be explicitly exported. With
+.I crossmnt
+it need not. If a child of a
+.I crossmnt
+file is not explicitly exported, then it will be implicitly exported
+with the same export options as the parent, except for
+.IR fsid= .
+This makes it impossible to
+.B not
+export a child of a
+.I crossmnt
+filesystem. If some but not all subordinate filesystems of a parent
+are to be exported, then they must be explicitly exported and the
+parent should not have
+.I crossmnt
+set.
+
+The
+.I nocrossmnt
+option can explictly disable
+.I crossmnt
+if it was previously set. This is rarely useful.
.TP
.IR no_subtree_check
This option disables subtree checking, which has mild security
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index c23d384..7d250f9 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -376,7 +376,7 @@ static char *next_mnt(void **v, char *p)
*v = f;
} else
f = *v;
- while ((me = getmntent(f)) != NULL &&
+ while ((me = getmntent(f)) != NULL && l > 1 &&
(strncmp(me->mnt_dir, p, l) != 0 ||
me->mnt_dir[l] != '/'))
;
diff --git a/utils/statd/rmtcall.c b/utils/statd/rmtcall.c
index fd576d9..66a6eeb 100644
--- a/utils/statd/rmtcall.c
+++ b/utils/statd/rmtcall.c
@@ -221,6 +221,9 @@ process_reply(FD_SET_TYPE *rfds)
if (sockfd == -1 || !FD_ISSET(sockfd, rfds))
return 0;
+ /* Should not be processed again. */
+ FD_CLR (sockfd, rfds);
+
if (!(lp = recv_rply(&port)))
return 1;
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
index 60ce6d1..2b7a167 100644
--- a/utils/statd/statd.c
+++ b/utils/statd/statd.c
@@ -393,7 +393,7 @@ int main (int argc, char **argv)
simulator (--argc, ++argv); /* simulator() does exit() */
#endif
- daemon_init(!(run_mode & MODE_NODAEMON));
+ daemon_init((run_mode & MODE_NODAEMON));
if (run_mode & MODE_LOG_STDERR) {
xlog_syslog(0);