|
|
5fd2c0 |
diff --git a/.gitignore b/.gitignore
|
|
|
5fd2c0 |
index 3d9640d..d26f4be 100644
|
|
|
5fd2c0 |
--- a/.gitignore
|
|
|
5fd2c0 |
+++ b/.gitignore
|
|
|
5fd2c0 |
@@ -70,6 +70,8 @@ tests/nsm_client/nlm_sm_inter_svc.c
|
|
|
5fd2c0 |
tests/nsm_client/nlm_sm_inter_xdr.c
|
|
|
5fd2c0 |
utils/nfsidmap/nfsidmap
|
|
|
5fd2c0 |
systemd/nfs-server-generator
|
|
|
5fd2c0 |
+systemd/rpc-pipefs-generator
|
|
|
5fd2c0 |
+systemd/rpc-gssd.service
|
|
|
5fd2c0 |
# cscope database files
|
|
|
5fd2c0 |
cscope.*
|
|
|
5fd2c0 |
# generic editor backup et al
|
|
|
5fd2c0 |
diff --git a/configure.ac b/configure.ac
|
|
|
5fd2c0 |
index 3bce774..fce0e15 100644
|
|
|
5fd2c0 |
--- a/configure.ac
|
|
|
5fd2c0 |
+++ b/configure.ac
|
|
|
5fd2c0 |
@@ -498,8 +498,14 @@ AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
|
|
|
5fd2c0 |
# Make sure that $ACLOCAL_FLAGS are used during a rebuild
|
|
|
5fd2c0 |
AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"])
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
+# make _sysconfdir available for substituion in config files
|
|
|
5fd2c0 |
+# 2 "evals" needed late to expand variable names.
|
|
|
5fd2c0 |
+AC_SUBST([_sysconfdir])
|
|
|
5fd2c0 |
+AC_CONFIG_COMMANDS_PRE([eval eval _sysconfdir=$sysconfdir])
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
AC_CONFIG_FILES([
|
|
|
5fd2c0 |
Makefile
|
|
|
5fd2c0 |
+ systemd/rpc-gssd.service
|
|
|
5fd2c0 |
linux-nfs/Makefile
|
|
|
5fd2c0 |
support/Makefile
|
|
|
5fd2c0 |
support/export/Makefile
|
|
|
5fd2c0 |
diff --git a/nfs.conf b/nfs.conf
|
|
|
5fd2c0 |
index c907de6..89cf386 100644
|
|
|
5fd2c0 |
--- a/nfs.conf
|
|
|
5fd2c0 |
+++ b/nfs.conf
|
|
|
5fd2c0 |
@@ -1,7 +1,10 @@
|
|
|
5fd2c0 |
#
|
|
|
5fd2c0 |
-# This is a general conifguration for the
|
|
|
5fd2c0 |
+# This is a general configuration for the
|
|
|
5fd2c0 |
# NFS daemons and tools
|
|
|
5fd2c0 |
#
|
|
|
5fd2c0 |
+#[general]
|
|
|
5fd2c0 |
+# pipefs-directory=/var/lib/nfs/rpc_pipefs
|
|
|
5fd2c0 |
+#
|
|
|
5fd2c0 |
#[exportfs]
|
|
|
5fd2c0 |
# debug=0
|
|
|
5fd2c0 |
#
|
|
|
5fd2c0 |
@@ -12,7 +15,6 @@
|
|
|
5fd2c0 |
# limit-to-legacy-enctypes=0
|
|
|
5fd2c0 |
# context-timeout=0
|
|
|
5fd2c0 |
# rpc-timeout=5
|
|
|
5fd2c0 |
-# pipefs-directory=/var/lib/nfs/rpc_pipefs
|
|
|
5fd2c0 |
# keytab-file=/etc/krb5.keytab
|
|
|
5fd2c0 |
# cred-cache-directory=
|
|
|
5fd2c0 |
# preferred-realm=
|
|
|
5fd2c0 |
diff --git a/support/include/xcommon.h b/support/include/xcommon.h
|
|
|
5fd2c0 |
index d1a4b18..23c9a13 100644
|
|
|
5fd2c0 |
--- a/support/include/xcommon.h
|
|
|
5fd2c0 |
+++ b/support/include/xcommon.h
|
|
|
5fd2c0 |
@@ -17,6 +17,12 @@
|
|
|
5fd2c0 |
#include <stdlib.h>
|
|
|
5fd2c0 |
#include <string.h>
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
+#ifdef MAJOR_IN_MKDEV
|
|
|
5fd2c0 |
+#include <sys/mkdev.h>
|
|
|
5fd2c0 |
+#elif defined(MAJOR_IN_SYSMACROS)
|
|
|
5fd2c0 |
+#include <sys/sysmacros.h>
|
|
|
5fd2c0 |
+#endif
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
#define streq(s, t) (strcmp ((s), (t)) == 0)
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
/* Functions in sundries.c that are used in mount.c and umount.c */
|
|
|
5fd2c0 |
diff --git a/support/nfs/nfsexport.c b/support/nfs/nfsexport.c
|
|
|
5fd2c0 |
index f129fd2..c1c736e 100644
|
|
|
5fd2c0 |
--- a/support/nfs/nfsexport.c
|
|
|
5fd2c0 |
+++ b/support/nfs/nfsexport.c
|
|
|
5fd2c0 |
@@ -18,6 +18,7 @@
|
|
|
5fd2c0 |
#include <fcntl.h>
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
#include "nfslib.h"
|
|
|
5fd2c0 |
+#include "xcommon.h"
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
/* if /proc/net/rpc/... exists, then
|
|
|
5fd2c0 |
* write to it, as that interface is more stable.
|
|
|
5fd2c0 |
diff --git a/systemd/Makefile.am b/systemd/Makefile.am
|
|
|
5fd2c0 |
index b789916..54a3b64 100644
|
|
|
5fd2c0 |
--- a/systemd/Makefile.am
|
|
|
5fd2c0 |
+++ b/systemd/Makefile.am
|
|
|
5fd2c0 |
@@ -8,6 +8,7 @@ unit_files = \
|
|
|
5fd2c0 |
nfs-blkmap.service \
|
|
|
5fd2c0 |
nfs-config.service \
|
|
|
5fd2c0 |
nfs-idmapd.service \
|
|
|
5fd2c0 |
+ rpc_pipefs.target \
|
|
|
5fd2c0 |
nfs-mountd.service \
|
|
|
5fd2c0 |
nfs-server.service \
|
|
|
5fd2c0 |
nfs-utils.service \
|
|
|
5fd2c0 |
@@ -24,14 +25,23 @@ EXTRA_DIST = $(unit_files) $(man5_MANS) $(man7_MANS)
|
|
|
5fd2c0 |
unit_dir = /usr/lib/systemd/system
|
|
|
5fd2c0 |
generator_dir = /usr/lib/systemd/system-generators
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
-EXTRA_PROGRAMS = nfs-server-generator
|
|
|
5fd2c0 |
+EXTRA_PROGRAMS = nfs-server-generator rpc-pipefs-generator
|
|
|
5fd2c0 |
genexecdir = $(generator_dir)
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+COMMON_SRCS = systemd.c systemd.h
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+nfs_server_generator_SOURCES = $(COMMON_SRCS) nfs-server-generator.c
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+rpc_pipefs_generator_SOURCES = $(COMMON_SRCS) rpc-pipefs-generator.c
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
nfs_server_generator_LDADD = ../support/export/libexport.a \
|
|
|
5fd2c0 |
../support/nfs/libnfs.a \
|
|
|
5fd2c0 |
../support/misc/libmisc.a
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
+rpc_pipefs_generator_LDADD = ../support/nfs/libnfs.a
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
if INSTALL_SYSTEMD
|
|
|
5fd2c0 |
-genexec_PROGRAMS = nfs-server-generator
|
|
|
5fd2c0 |
+genexec_PROGRAMS = nfs-server-generator rpc-pipefs-generator
|
|
|
5fd2c0 |
install-data-hook: $(unit_files)
|
|
|
5fd2c0 |
mkdir -p $(DESTDIR)/$(unitdir)
|
|
|
5fd2c0 |
cp $(unit_files) $(DESTDIR)/$(unitdir)
|
|
|
5fd2c0 |
diff --git a/systemd/nfs-blkmap.service b/systemd/nfs-blkmap.service
|
|
|
5fd2c0 |
index ddbf4e9..c844e2d 100644
|
|
|
5fd2c0 |
--- a/systemd/nfs-blkmap.service
|
|
|
5fd2c0 |
+++ b/systemd/nfs-blkmap.service
|
|
|
5fd2c0 |
@@ -2,8 +2,8 @@
|
|
|
5fd2c0 |
Description=pNFS block layout mapping daemon
|
|
|
5fd2c0 |
DefaultDependencies=no
|
|
|
5fd2c0 |
Conflicts=umount.target
|
|
|
5fd2c0 |
-After=var-lib-nfs-rpc_pipefs.mount
|
|
|
5fd2c0 |
-Requires=var-lib-nfs-rpc_pipefs.mount
|
|
|
5fd2c0 |
+After=rpc_pipefs.target
|
|
|
5fd2c0 |
+Requires=rpc_pipefs.target
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
PartOf=nfs-utils.service
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
diff --git a/systemd/nfs-idmapd.service b/systemd/nfs-idmapd.service
|
|
|
5fd2c0 |
index df3dd9d..38685b6 100644
|
|
|
5fd2c0 |
--- a/systemd/nfs-idmapd.service
|
|
|
5fd2c0 |
+++ b/systemd/nfs-idmapd.service
|
|
|
5fd2c0 |
@@ -1,8 +1,8 @@
|
|
|
5fd2c0 |
[Unit]
|
|
|
5fd2c0 |
Description=NFSv4 ID-name mapping service
|
|
|
5fd2c0 |
DefaultDependencies=no
|
|
|
5fd2c0 |
-Requires=var-lib-nfs-rpc_pipefs.mount
|
|
|
5fd2c0 |
-After=var-lib-nfs-rpc_pipefs.mount local-fs.target
|
|
|
5fd2c0 |
+Requires=rpc_pipefs.target
|
|
|
5fd2c0 |
+After=rpc_pipefs.target local-fs.target
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
BindsTo=nfs-server.service
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
diff --git a/systemd/nfs-server-generator.c b/systemd/nfs-server-generator.c
|
|
|
5fd2c0 |
index 4aa6509..737f109 100644
|
|
|
5fd2c0 |
--- a/systemd/nfs-server-generator.c
|
|
|
5fd2c0 |
+++ b/systemd/nfs-server-generator.c
|
|
|
5fd2c0 |
@@ -29,6 +29,7 @@
|
|
|
5fd2c0 |
#include "misc.h"
|
|
|
5fd2c0 |
#include "nfslib.h"
|
|
|
5fd2c0 |
#include "exportfs.h"
|
|
|
5fd2c0 |
+#include "systemd.h"
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
/* A simple "set of strings" to remove duplicates
|
|
|
5fd2c0 |
* found in /etc/exports
|
|
|
5fd2c0 |
@@ -55,35 +56,6 @@ static int is_unique(struct list **lp, char *path)
|
|
|
5fd2c0 |
return 1;
|
|
|
5fd2c0 |
}
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
-/* We need to convert a path name to a systemd unit
|
|
|
5fd2c0 |
- * name. This requires some translation ('/' -> '-')
|
|
|
5fd2c0 |
- * and some escaping.
|
|
|
5fd2c0 |
- */
|
|
|
5fd2c0 |
-static void systemd_escape(FILE *f, char *path)
|
|
|
5fd2c0 |
-{
|
|
|
5fd2c0 |
- while (*path == '/')
|
|
|
5fd2c0 |
- path++;
|
|
|
5fd2c0 |
- if (!*path) {
|
|
|
5fd2c0 |
- /* "/" becomes "-", otherwise leading "/" is ignored */
|
|
|
5fd2c0 |
- fputs("-", f);
|
|
|
5fd2c0 |
- return;
|
|
|
5fd2c0 |
- }
|
|
|
5fd2c0 |
- while (*path) {
|
|
|
5fd2c0 |
- char c = *path++;
|
|
|
5fd2c0 |
-
|
|
|
5fd2c0 |
- if (c == '/') {
|
|
|
5fd2c0 |
- /* multiple non-trailing slashes become '-' */
|
|
|
5fd2c0 |
- while (*path == '/')
|
|
|
5fd2c0 |
- path++;
|
|
|
5fd2c0 |
- if (*path)
|
|
|
5fd2c0 |
- fputs("-", f);
|
|
|
5fd2c0 |
- } else if (isalnum(c) || c == ':' || c == '.')
|
|
|
5fd2c0 |
- fputc(c, f);
|
|
|
5fd2c0 |
- else
|
|
|
5fd2c0 |
- fprintf(f, "\\x%02x", c & 0xff);
|
|
|
5fd2c0 |
- }
|
|
|
5fd2c0 |
-}
|
|
|
5fd2c0 |
-
|
|
|
5fd2c0 |
static int has_noauto_flag(char *path)
|
|
|
5fd2c0 |
{
|
|
|
5fd2c0 |
FILE *fstab;
|
|
|
5fd2c0 |
@@ -108,7 +80,7 @@ static int has_noauto_flag(char *path)
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
int main(int argc, char *argv[])
|
|
|
5fd2c0 |
{
|
|
|
5fd2c0 |
- char *path;
|
|
|
5fd2c0 |
+ char *path, *spath;
|
|
|
5fd2c0 |
char dirbase[] = "/nfs-server.service.d";
|
|
|
5fd2c0 |
char filebase[] = "/order-with-mounts.conf";
|
|
|
5fd2c0 |
nfs_export *exp;
|
|
|
5fd2c0 |
@@ -167,9 +139,15 @@ int main(int argc, char *argv[])
|
|
|
5fd2c0 |
if (strcmp(mnt->mnt_type, "nfs") != 0 &&
|
|
|
5fd2c0 |
strcmp(mnt->mnt_type, "nfs4") != 0)
|
|
|
5fd2c0 |
continue;
|
|
|
5fd2c0 |
- fprintf(f, "Before= ");
|
|
|
5fd2c0 |
- systemd_escape(f, mnt->mnt_dir);
|
|
|
5fd2c0 |
- fprintf(f, ".mount\n");
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ spath = systemd_escape(mnt->mnt_dir, ".mount");
|
|
|
5fd2c0 |
+ if (!spath) {
|
|
|
5fd2c0 |
+ fprintf(stderr,
|
|
|
5fd2c0 |
+ "nfs-server-generator: convert path failed: %s\n",
|
|
|
5fd2c0 |
+ mnt->mnt_dir);
|
|
|
5fd2c0 |
+ continue;
|
|
|
5fd2c0 |
+ }
|
|
|
5fd2c0 |
+ fprintf(f, "Before=%s\n", spath);
|
|
|
5fd2c0 |
}
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
fclose(fstab);
|
|
|
5fd2c0 |
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
|
|
|
5fd2c0 |
index 938b970..9700586 100644
|
|
|
5fd2c0 |
--- a/systemd/nfs.conf.man
|
|
|
5fd2c0 |
+++ b/systemd/nfs.conf.man
|
|
|
5fd2c0 |
@@ -96,6 +96,18 @@ value, which can be one or more from the list
|
|
|
5fd2c0 |
.BR all .
|
|
|
5fd2c0 |
When a list is given, the members should be comma-separated.
|
|
|
5fd2c0 |
.TP
|
|
|
5fd2c0 |
+.B general
|
|
|
5fd2c0 |
+Recognized values:
|
|
|
5fd2c0 |
+.BR pipefs-directory .
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+See
|
|
|
5fd2c0 |
+.BR blkmapd (8),
|
|
|
5fd2c0 |
+.BR rpc.idmapd (8),
|
|
|
5fd2c0 |
+and
|
|
|
5fd2c0 |
+.BR rpc.gssd (8)
|
|
|
5fd2c0 |
+for details.
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+.TP
|
|
|
5fd2c0 |
.B nfsdcltrack
|
|
|
5fd2c0 |
Recognized values:
|
|
|
5fd2c0 |
.BR storagedir .
|
|
|
5fd2c0 |
@@ -198,7 +210,6 @@ Recognized values:
|
|
|
5fd2c0 |
.BR limit-to-legacy-enctypes ,
|
|
|
5fd2c0 |
.BR context-timeout ,
|
|
|
5fd2c0 |
.BR rpc-timeout ,
|
|
|
5fd2c0 |
-.BR pipefs-directory ,
|
|
|
5fd2c0 |
.BR keytab-file ,
|
|
|
5fd2c0 |
.BR cred-cache-directory ,
|
|
|
5fd2c0 |
.BR preferred-realm .
|
|
|
5fd2c0 |
diff --git a/systemd/rpc-gssd.service b/systemd/rpc-gssd.service
|
|
|
5fd2c0 |
deleted file mode 100644
|
|
|
5fd2c0 |
index 5d6d09f..0000000
|
|
|
5fd2c0 |
--- a/systemd/rpc-gssd.service
|
|
|
5fd2c0 |
+++ /dev/null
|
|
|
5fd2c0 |
@@ -1,19 +0,0 @@
|
|
|
5fd2c0 |
-[Unit]
|
|
|
5fd2c0 |
-Description=RPC security service for NFS client and server
|
|
|
5fd2c0 |
-DefaultDependencies=no
|
|
|
5fd2c0 |
-Conflicts=umount.target
|
|
|
5fd2c0 |
-Requires=var-lib-nfs-rpc_pipefs.mount
|
|
|
5fd2c0 |
-After=var-lib-nfs-rpc_pipefs.mount gssproxy.service
|
|
|
5fd2c0 |
-
|
|
|
5fd2c0 |
-ConditionPathExists=/etc/krb5.keytab
|
|
|
5fd2c0 |
-
|
|
|
5fd2c0 |
-PartOf=nfs-utils.service
|
|
|
5fd2c0 |
-
|
|
|
5fd2c0 |
-Wants=nfs-config.service
|
|
|
5fd2c0 |
-After=nfs-config.service
|
|
|
5fd2c0 |
-
|
|
|
5fd2c0 |
-[Service]
|
|
|
5fd2c0 |
-EnvironmentFile=-/run/sysconfig/nfs-utils
|
|
|
5fd2c0 |
-
|
|
|
5fd2c0 |
-Type=forking
|
|
|
5fd2c0 |
-ExecStart=/usr/sbin/rpc.gssd $GSSDARGS
|
|
|
5fd2c0 |
diff --git a/systemd/rpc-gssd.service.in b/systemd/rpc-gssd.service.in
|
|
|
5fd2c0 |
new file mode 100644
|
|
|
5fd2c0 |
index 0000000..c75ccbd
|
|
|
5fd2c0 |
--- /dev/null
|
|
|
5fd2c0 |
+++ b/systemd/rpc-gssd.service.in
|
|
|
5fd2c0 |
@@ -0,0 +1,19 @@
|
|
|
5fd2c0 |
+[Unit]
|
|
|
5fd2c0 |
+Description=RPC security service for NFS client and server
|
|
|
5fd2c0 |
+DefaultDependencies=no
|
|
|
5fd2c0 |
+Conflicts=umount.target
|
|
|
5fd2c0 |
+Requires=rpc_pipefs.target
|
|
|
5fd2c0 |
+After=rpc_pipefs.target gssproxy.service
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ConditionPathExists=@_sysconfdir@/krb5.keytab
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+PartOf=nfs-utils.service
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+Wants=nfs-config.service
|
|
|
5fd2c0 |
+After=nfs-config.service
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+[Service]
|
|
|
5fd2c0 |
+EnvironmentFile=-/run/sysconfig/nfs-utils
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+Type=forking
|
|
|
5fd2c0 |
+ExecStart=/usr/sbin/rpc.gssd $GSSDARGS
|
|
|
5fd2c0 |
diff --git a/systemd/rpc-pipefs-generator.c b/systemd/rpc-pipefs-generator.c
|
|
|
5fd2c0 |
new file mode 100644
|
|
|
5fd2c0 |
index 0000000..66addb9
|
|
|
5fd2c0 |
--- /dev/null
|
|
|
5fd2c0 |
+++ b/systemd/rpc-pipefs-generator.c
|
|
|
5fd2c0 |
@@ -0,0 +1,138 @@
|
|
|
5fd2c0 |
+/*
|
|
|
5fd2c0 |
+ * rpc-pipefs-generator:
|
|
|
5fd2c0 |
+ * systemd generator to create ordering dependencies between
|
|
|
5fd2c0 |
+ * nfs services and the rpc_pipefs mountpoint
|
|
|
5fd2c0 |
+ */
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+#ifdef HAVE_CONFIG_H
|
|
|
5fd2c0 |
+#include <config.h>
|
|
|
5fd2c0 |
+#endif
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+#include <sys/stat.h>
|
|
|
5fd2c0 |
+#include <sys/types.h>
|
|
|
5fd2c0 |
+#include <unistd.h>
|
|
|
5fd2c0 |
+#include <stdlib.h>
|
|
|
5fd2c0 |
+#include <string.h>
|
|
|
5fd2c0 |
+#include <ctype.h>
|
|
|
5fd2c0 |
+#include <stdio.h>
|
|
|
5fd2c0 |
+#include <mntent.h>
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+#include "nfslib.h"
|
|
|
5fd2c0 |
+#include "conffile.h"
|
|
|
5fd2c0 |
+#include "systemd.h"
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+#define RPC_PIPEFS_DEFAULT "/var/lib/nfs/rpc_pipefs"
|
|
|
5fd2c0 |
+char *conf_path = NFS_CONFFILE;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+static int generate_mount_unit(const char *pipefs_path, const char *pipefs_unit,
|
|
|
5fd2c0 |
+ const char *dirname)
|
|
|
5fd2c0 |
+{
|
|
|
5fd2c0 |
+ char *path;
|
|
|
5fd2c0 |
+ FILE *f;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ path = malloc(strlen(dirname) + 1 + strlen(pipefs_unit));
|
|
|
5fd2c0 |
+ if (!path)
|
|
|
5fd2c0 |
+ return 1;
|
|
|
5fd2c0 |
+ sprintf(path, "%s/%s", dirname, pipefs_unit);
|
|
|
5fd2c0 |
+ f = fopen(path, "w");
|
|
|
5fd2c0 |
+ if (!f)
|
|
|
5fd2c0 |
+ return 1;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ fprintf(f, "# Automatically generated by rpc-pipefs-generator\n\n[Unit]\n");
|
|
|
5fd2c0 |
+ fprintf(f, "Description=RPC Pipe File System\n");
|
|
|
5fd2c0 |
+ fprintf(f, "DefaultDependencies=no\n");
|
|
|
5fd2c0 |
+ fprintf(f, "After=systemd-tmpfiles-setup.service\n");
|
|
|
5fd2c0 |
+ fprintf(f, "Conflicts=umount.target\n");
|
|
|
5fd2c0 |
+ fprintf(f, "\n[Mount]\n");
|
|
|
5fd2c0 |
+ fprintf(f, "What=sunrpc\n");
|
|
|
5fd2c0 |
+ fprintf(f, "Where=%s\n", pipefs_path);
|
|
|
5fd2c0 |
+ fprintf(f, "Type=rpc_pipefs\n");
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ fclose(f);
|
|
|
5fd2c0 |
+ return 0;
|
|
|
5fd2c0 |
+}
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+static
|
|
|
5fd2c0 |
+int generate_target(char *pipefs_path, const char *dirname)
|
|
|
5fd2c0 |
+{
|
|
|
5fd2c0 |
+ char *path;
|
|
|
5fd2c0 |
+ char filebase[] = "/rpc_pipefs.target";
|
|
|
5fd2c0 |
+ char *pipefs_unit;
|
|
|
5fd2c0 |
+ FILE *f;
|
|
|
5fd2c0 |
+ int ret = 0;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ pipefs_unit = systemd_escape(pipefs_path, ".mount");
|
|
|
5fd2c0 |
+ if (!pipefs_unit)
|
|
|
5fd2c0 |
+ return 1;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ ret = generate_mount_unit(pipefs_path, pipefs_unit, dirname);
|
|
|
5fd2c0 |
+ if (ret)
|
|
|
5fd2c0 |
+ return ret;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ path = malloc(strlen(dirname) + 1 + sizeof(filebase));
|
|
|
5fd2c0 |
+ if (!path)
|
|
|
5fd2c0 |
+ return 2;
|
|
|
5fd2c0 |
+ sprintf(path, "%s", dirname);
|
|
|
5fd2c0 |
+ mkdir(path, 0755);
|
|
|
5fd2c0 |
+ strcat(path, filebase);
|
|
|
5fd2c0 |
+ f = fopen(path, "w");
|
|
|
5fd2c0 |
+ if (!f)
|
|
|
5fd2c0 |
+ return 1;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ fprintf(f, "# Automatically generated by rpc-pipefs-generator\n\n[Unit]\n");
|
|
|
5fd2c0 |
+ fprintf(f, "Requires=%s\n", pipefs_unit);
|
|
|
5fd2c0 |
+ fprintf(f, "After=%s\n", pipefs_unit);
|
|
|
5fd2c0 |
+ fclose(f);
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ return 0;
|
|
|
5fd2c0 |
+}
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+static int is_non_pipefs_mountpoint(char *path)
|
|
|
5fd2c0 |
+{
|
|
|
5fd2c0 |
+ FILE *mtab;
|
|
|
5fd2c0 |
+ struct mntent *mnt;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ mtab = setmntent("/etc/mtab", "r");
|
|
|
5fd2c0 |
+ if (!mtab)
|
|
|
5fd2c0 |
+ return 0;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ while ((mnt = getmntent(mtab)) != NULL) {
|
|
|
5fd2c0 |
+ if (strlen(mnt->mnt_dir) != strlen(path))
|
|
|
5fd2c0 |
+ continue;
|
|
|
5fd2c0 |
+ if (strncmp(mnt->mnt_dir, path, strlen(mnt->mnt_dir)))
|
|
|
5fd2c0 |
+ continue;
|
|
|
5fd2c0 |
+ if (strncmp(mnt->mnt_type, "rpc_pipefs", strlen(mnt->mnt_type)))
|
|
|
5fd2c0 |
+ break;
|
|
|
5fd2c0 |
+ }
|
|
|
5fd2c0 |
+ fclose(mtab);
|
|
|
5fd2c0 |
+ return mnt != NULL;
|
|
|
5fd2c0 |
+}
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+int main(int argc, char *argv[])
|
|
|
5fd2c0 |
+{
|
|
|
5fd2c0 |
+ int ret;
|
|
|
5fd2c0 |
+ char *s;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ /* Avoid using any external services */
|
|
|
5fd2c0 |
+ xlog_syslog(0);
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ if (argc != 4 || argv[1][0] != '/') {
|
|
|
5fd2c0 |
+ fprintf(stderr, "rpc-pipefs-generator: create systemd dependencies for nfs services\n");
|
|
|
5fd2c0 |
+ fprintf(stderr, "Usage: normal-dir early-dir late-dir\n");
|
|
|
5fd2c0 |
+ exit(1);
|
|
|
5fd2c0 |
+ }
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ conf_init();
|
|
|
5fd2c0 |
+ s = conf_get_str("general", "pipefs-directory");
|
|
|
5fd2c0 |
+ if (!s)
|
|
|
5fd2c0 |
+ exit(0);
|
|
|
5fd2c0 |
+ if (strlen(s) == strlen(RPC_PIPEFS_DEFAULT) &&
|
|
|
5fd2c0 |
+ strcmp(s, RPC_PIPEFS_DEFAULT) == 0)
|
|
|
5fd2c0 |
+ exit(0);
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ if (is_non_pipefs_mountpoint(s))
|
|
|
5fd2c0 |
+ exit(1);
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ ret = generate_target(s, argv[1]);
|
|
|
5fd2c0 |
+ exit(ret);
|
|
|
5fd2c0 |
+}
|
|
|
5fd2c0 |
diff --git a/systemd/rpc-svcgssd.service b/systemd/rpc-svcgssd.service
|
|
|
5fd2c0 |
index 41177b6..a3a555c 100644
|
|
|
5fd2c0 |
--- a/systemd/rpc-svcgssd.service
|
|
|
5fd2c0 |
+++ b/systemd/rpc-svcgssd.service
|
|
|
5fd2c0 |
@@ -1,8 +1,7 @@
|
|
|
5fd2c0 |
[Unit]
|
|
|
5fd2c0 |
Description=RPC security service for NFS server
|
|
|
5fd2c0 |
DefaultDependencies=no
|
|
|
5fd2c0 |
-Requires=var-lib-nfs-rpc_pipefs.mount
|
|
|
5fd2c0 |
-After=var-lib-nfs-rpc_pipefs.mount local-fs.target
|
|
|
5fd2c0 |
+After=local-fs.target
|
|
|
5fd2c0 |
PartOf=nfs-server.service
|
|
|
5fd2c0 |
PartOf=nfs-utils.service
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
diff --git a/systemd/rpc_pipefs.target b/systemd/rpc_pipefs.target
|
|
|
5fd2c0 |
new file mode 100644
|
|
|
5fd2c0 |
index 0000000..01d4d27
|
|
|
5fd2c0 |
--- /dev/null
|
|
|
5fd2c0 |
+++ b/systemd/rpc_pipefs.target
|
|
|
5fd2c0 |
@@ -0,0 +1,3 @@
|
|
|
5fd2c0 |
+[Unit]
|
|
|
5fd2c0 |
+Requires=var-lib-nfs-rpc_pipefs.mount
|
|
|
5fd2c0 |
+After=var-lib-nfs-rpc_pipefs.mount
|
|
|
5fd2c0 |
diff --git a/systemd/systemd.c b/systemd/systemd.c
|
|
|
5fd2c0 |
new file mode 100644
|
|
|
5fd2c0 |
index 0000000..17820d4
|
|
|
5fd2c0 |
--- /dev/null
|
|
|
5fd2c0 |
+++ b/systemd/systemd.c
|
|
|
5fd2c0 |
@@ -0,0 +1,133 @@
|
|
|
5fd2c0 |
+/*
|
|
|
5fd2c0 |
+ * Helper functions for systemd generators in nfs-utils.
|
|
|
5fd2c0 |
+ *
|
|
|
5fd2c0 |
+ * Currently just systemd_escape().
|
|
|
5fd2c0 |
+ */
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+#include <stdio.h>
|
|
|
5fd2c0 |
+#include <stdlib.h>
|
|
|
5fd2c0 |
+#include <ctype.h>
|
|
|
5fd2c0 |
+#include <string.h>
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+static const char hex[16] =
|
|
|
5fd2c0 |
+{
|
|
|
5fd2c0 |
+ '0', '1', '2', '3', '4', '5', '6', '7',
|
|
|
5fd2c0 |
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
|
|
|
5fd2c0 |
+};
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+/*
|
|
|
5fd2c0 |
+ * determine length of the string that systemd_escape() needs to allocate
|
|
|
5fd2c0 |
+ */
|
|
|
5fd2c0 |
+static int systemd_len(char *path)
|
|
|
5fd2c0 |
+{
|
|
|
5fd2c0 |
+ char *p;
|
|
|
5fd2c0 |
+ int len = 0;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ p = path;
|
|
|
5fd2c0 |
+ while (*p == '/')
|
|
|
5fd2c0 |
+ /* multiple leading "/" are ignored */
|
|
|
5fd2c0 |
+ p++;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ if (!*p)
|
|
|
5fd2c0 |
+ /* root directory "/" becomes is encoded as a single "-" */
|
|
|
5fd2c0 |
+ return 1;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ if (*p == '.')
|
|
|
5fd2c0 |
+ /*
|
|
|
5fd2c0 |
+ * replace "." with "\x2d" escape sequence if
|
|
|
5fd2c0 |
+ * it's the first character in escaped path
|
|
|
5fd2c0 |
+ * */
|
|
|
5fd2c0 |
+ len += 4;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ while (*p) {
|
|
|
5fd2c0 |
+ unsigned char c = *p++;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ if (c == '/') {
|
|
|
5fd2c0 |
+ /* multiple non-trailing slashes become '-' */
|
|
|
5fd2c0 |
+ while (*p == '/')
|
|
|
5fd2c0 |
+ p++;
|
|
|
5fd2c0 |
+ if (*p)
|
|
|
5fd2c0 |
+ len++;
|
|
|
5fd2c0 |
+ } else if (isalnum(c) || c == ':' || c == '.' || c == '_')
|
|
|
5fd2c0 |
+ /* these characters are not replaced */
|
|
|
5fd2c0 |
+ len++;
|
|
|
5fd2c0 |
+ else
|
|
|
5fd2c0 |
+ /* replace with "\x2d" escape sequence */
|
|
|
5fd2c0 |
+ len += 4;
|
|
|
5fd2c0 |
+ }
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ return len;
|
|
|
5fd2c0 |
+}
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+/*
|
|
|
5fd2c0 |
+ * convert c to "\x2d" escape sequence and append to string
|
|
|
5fd2c0 |
+ * at position p, advancing p
|
|
|
5fd2c0 |
+ */
|
|
|
5fd2c0 |
+static char *hexify(unsigned char c, char *p)
|
|
|
5fd2c0 |
+{
|
|
|
5fd2c0 |
+ *p++ = '\\';
|
|
|
5fd2c0 |
+ *p++ = 'x';
|
|
|
5fd2c0 |
+ *p++ = hex[c >> 4];
|
|
|
5fd2c0 |
+ *p++ = hex[c & 0xf];
|
|
|
5fd2c0 |
+ return p;
|
|
|
5fd2c0 |
+}
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+/*
|
|
|
5fd2c0 |
+ * convert a path to a unit name according to the logic in systemd.unit(5):
|
|
|
5fd2c0 |
+ *
|
|
|
5fd2c0 |
+ * Basically, given a path, "/" is replaced by "-", and all other
|
|
|
5fd2c0 |
+ * characters which are not ASCII alphanumerics are replaced by C-style
|
|
|
5fd2c0 |
+ * "\x2d" escapes (except that "_" is never replaced and "." is only
|
|
|
5fd2c0 |
+ * replaced when it would be the first character in the escaped path).
|
|
|
5fd2c0 |
+ * The root directory "/" is encoded as single dash, while otherwise the
|
|
|
5fd2c0 |
+ * initial and ending "/" are removed from all paths during
|
|
|
5fd2c0 |
+ * transformation.
|
|
|
5fd2c0 |
+ *
|
|
|
5fd2c0 |
+ * NB: Although the systemd.unit(5) doesn't mention it, the ':' character
|
|
|
5fd2c0 |
+ * is not escaped.
|
|
|
5fd2c0 |
+ */
|
|
|
5fd2c0 |
+char *systemd_escape(char *path, char *suffix)
|
|
|
5fd2c0 |
+{
|
|
|
5fd2c0 |
+ char *result;
|
|
|
5fd2c0 |
+ char *p;
|
|
|
5fd2c0 |
+ int len;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ len = systemd_len(path);
|
|
|
5fd2c0 |
+ result = malloc(len + strlen(suffix) + 1);
|
|
|
5fd2c0 |
+ p = result;
|
|
|
5fd2c0 |
+ while (*path == '/')
|
|
|
5fd2c0 |
+ /* multiple leading "/" are ignored */
|
|
|
5fd2c0 |
+ path++;
|
|
|
5fd2c0 |
+ if (!*path) {
|
|
|
5fd2c0 |
+ /* root directory "/" becomes is encoded as a single "-" */
|
|
|
5fd2c0 |
+ *p++ = '-';
|
|
|
5fd2c0 |
+ goto out;
|
|
|
5fd2c0 |
+ }
|
|
|
5fd2c0 |
+ if (*path == '.')
|
|
|
5fd2c0 |
+ /*
|
|
|
5fd2c0 |
+ * replace "." with "\x2d" escape sequence if
|
|
|
5fd2c0 |
+ * it's the first character in escaped path
|
|
|
5fd2c0 |
+ * */
|
|
|
5fd2c0 |
+ p = hexify(*path++, p);
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ while (*path) {
|
|
|
5fd2c0 |
+ unsigned char c = *path++;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ if (c == '/') {
|
|
|
5fd2c0 |
+ /* multiple non-trailing slashes become '-' */
|
|
|
5fd2c0 |
+ while (*path == '/')
|
|
|
5fd2c0 |
+ path++;
|
|
|
5fd2c0 |
+ if (*path)
|
|
|
5fd2c0 |
+ *p++ = '-';
|
|
|
5fd2c0 |
+ } else if (isalnum(c) || c == ':' || c == '.' || c == '_')
|
|
|
5fd2c0 |
+ /* these characters are not replaced */
|
|
|
5fd2c0 |
+ *p++ = c;
|
|
|
5fd2c0 |
+ else
|
|
|
5fd2c0 |
+ /* replace with "\x2d" escape sequence */
|
|
|
5fd2c0 |
+ p = hexify(c, p);
|
|
|
5fd2c0 |
+ }
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+out:
|
|
|
5fd2c0 |
+ sprintf(p, "%s", suffix);
|
|
|
5fd2c0 |
+ return result;
|
|
|
5fd2c0 |
+}
|
|
|
5fd2c0 |
diff --git a/systemd/systemd.h b/systemd/systemd.h
|
|
|
5fd2c0 |
new file mode 100644
|
|
|
5fd2c0 |
index 0000000..25235ec
|
|
|
5fd2c0 |
--- /dev/null
|
|
|
5fd2c0 |
+++ b/systemd/systemd.h
|
|
|
5fd2c0 |
@@ -0,0 +1,6 @@
|
|
|
5fd2c0 |
+#ifndef SYSTEMD_H
|
|
|
5fd2c0 |
+#define SYSTEMD_H
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+char *systemd_escape(char *path, char *suffix);
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+#endif /* SYSTEMD_H */
|
|
|
5fd2c0 |
diff --git a/utils/blkmapd/blkmapd.man b/utils/blkmapd/blkmapd.man
|
|
|
5fd2c0 |
index 914b80f..4b3d3f0 100644
|
|
|
5fd2c0 |
--- a/utils/blkmapd/blkmapd.man
|
|
|
5fd2c0 |
+++ b/utils/blkmapd/blkmapd.man
|
|
|
5fd2c0 |
@@ -43,9 +43,24 @@ Performs device discovery only then exits.
|
|
|
5fd2c0 |
Runs
|
|
|
5fd2c0 |
.B blkmapd
|
|
|
5fd2c0 |
in the foreground and sends output to stderr (as opposed to syslogd)
|
|
|
5fd2c0 |
+.SH CONFIGURATION FILE
|
|
|
5fd2c0 |
+The
|
|
|
5fd2c0 |
+.B blkmapd
|
|
|
5fd2c0 |
+daemon recognizes the following value from the
|
|
|
5fd2c0 |
+.B [general]
|
|
|
5fd2c0 |
+section of the
|
|
|
5fd2c0 |
+.I /etc/nfs.conf
|
|
|
5fd2c0 |
+configuration file:
|
|
|
5fd2c0 |
+.TP
|
|
|
5fd2c0 |
+.B pipefs-directory
|
|
|
5fd2c0 |
+Tells
|
|
|
5fd2c0 |
+.B blkmapd
|
|
|
5fd2c0 |
+where to look for the rpc_pipefs filesystem. The default value is
|
|
|
5fd2c0 |
+.IR /var/lib/nfs/rpc_pipefs .
|
|
|
5fd2c0 |
.SH SEE ALSO
|
|
|
5fd2c0 |
.BR nfs (5),
|
|
|
5fd2c0 |
-.BR dmsetup (8)
|
|
|
5fd2c0 |
+.BR dmsetup (8),
|
|
|
5fd2c0 |
+.BR nfs.conf (5)
|
|
|
5fd2c0 |
.sp
|
|
|
5fd2c0 |
RFC 5661 for the NFS version 4.1 specification.
|
|
|
5fd2c0 |
.br
|
|
|
5fd2c0 |
diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
|
|
|
5fd2c0 |
index b010628..a419947 100644
|
|
|
5fd2c0 |
--- a/utils/blkmapd/device-discovery.c
|
|
|
5fd2c0 |
+++ b/utils/blkmapd/device-discovery.c
|
|
|
5fd2c0 |
@@ -50,19 +50,36 @@
|
|
|
5fd2c0 |
#include <errno.h>
|
|
|
5fd2c0 |
#include <libdevmapper.h>
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
+#ifdef HAVE_CONFIG_H
|
|
|
5fd2c0 |
+#include "config.h"
|
|
|
5fd2c0 |
+#endif /* HAVE_CONFIG_H */
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
#include "device-discovery.h"
|
|
|
5fd2c0 |
+#include "xcommon.h"
|
|
|
5fd2c0 |
+#include "nfslib.h"
|
|
|
5fd2c0 |
+#include "conffile.h"
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
#define EVENT_SIZE (sizeof(struct inotify_event))
|
|
|
5fd2c0 |
#define EVENT_BUFSIZE (1024 * EVENT_SIZE)
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
-#define BL_PIPE_FILE "/var/lib/nfs/rpc_pipefs/nfs/blocklayout"
|
|
|
5fd2c0 |
-#define NFSPIPE_DIR "/var/lib/nfs/rpc_pipefs/nfs"
|
|
|
5fd2c0 |
#define RPCPIPE_DIR "/var/lib/nfs/rpc_pipefs"
|
|
|
5fd2c0 |
#define PID_FILE "/var/run/blkmapd.pid"
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
+#define CONF_SAVE(w, f) do { \
|
|
|
5fd2c0 |
+ char *p = f; \
|
|
|
5fd2c0 |
+ if (p != NULL) \
|
|
|
5fd2c0 |
+ (w) = p; \
|
|
|
5fd2c0 |
+} while (0)
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+static char bl_pipe_file[PATH_MAX];
|
|
|
5fd2c0 |
+static char nfspipe_dir[PATH_MAX];
|
|
|
5fd2c0 |
+static char rpcpipe_dir[PATH_MAX];
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
struct bl_disk *visible_disk_list;
|
|
|
5fd2c0 |
int bl_watch_fd, bl_pipe_fd, nfs_pipedir_wfd, rpc_pipedir_wfd;
|
|
|
5fd2c0 |
int pidfd = -1;
|
|
|
5fd2c0 |
+char *conf_path = NULL;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
struct bl_disk_path *bl_get_path(const char *filepath,
|
|
|
5fd2c0 |
struct bl_disk_path *paths)
|
|
|
5fd2c0 |
@@ -357,8 +374,8 @@ static void bl_rpcpipe_cb(void)
|
|
|
5fd2c0 |
continue;
|
|
|
5fd2c0 |
if (event->mask & IN_CREATE) {
|
|
|
5fd2c0 |
BL_LOG_WARNING("nfs pipe dir created\n");
|
|
|
5fd2c0 |
- bl_watch_dir(NFSPIPE_DIR, &nfs_pipedir_wfd);
|
|
|
5fd2c0 |
- bl_pipe_fd = open(BL_PIPE_FILE, O_RDWR);
|
|
|
5fd2c0 |
+ bl_watch_dir(nfspipe_dir, &nfs_pipedir_wfd);
|
|
|
5fd2c0 |
+ bl_pipe_fd = open(bl_pipe_file, O_RDWR);
|
|
|
5fd2c0 |
} else if (event->mask & IN_DELETE) {
|
|
|
5fd2c0 |
BL_LOG_WARNING("nfs pipe dir deleted\n");
|
|
|
5fd2c0 |
inotify_rm_watch(bl_watch_fd, nfs_pipedir_wfd);
|
|
|
5fd2c0 |
@@ -371,7 +388,7 @@ static void bl_rpcpipe_cb(void)
|
|
|
5fd2c0 |
continue;
|
|
|
5fd2c0 |
if (event->mask & IN_CREATE) {
|
|
|
5fd2c0 |
BL_LOG_WARNING("blocklayout pipe file created\n");
|
|
|
5fd2c0 |
- bl_pipe_fd = open(BL_PIPE_FILE, O_RDWR);
|
|
|
5fd2c0 |
+ bl_pipe_fd = open(bl_pipe_file, O_RDWR);
|
|
|
5fd2c0 |
if (bl_pipe_fd < 0)
|
|
|
5fd2c0 |
BL_LOG_ERR("open %s failed: %s\n",
|
|
|
5fd2c0 |
event->name, strerror(errno));
|
|
|
5fd2c0 |
@@ -437,6 +454,19 @@ int main(int argc, char **argv)
|
|
|
5fd2c0 |
int opt, dflag = 0, fg = 0, ret = 1;
|
|
|
5fd2c0 |
struct stat statbuf;
|
|
|
5fd2c0 |
char pidbuf[64];
|
|
|
5fd2c0 |
+ char *xrpcpipe_dir = NULL;
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ strncpy(rpcpipe_dir, RPCPIPE_DIR, sizeof(rpcpipe_dir));
|
|
|
5fd2c0 |
+ conf_path = NFS_CONFFILE;
|
|
|
5fd2c0 |
+ conf_init();
|
|
|
5fd2c0 |
+ CONF_SAVE(xrpcpipe_dir, conf_get_str("general", "pipefs-directory"));
|
|
|
5fd2c0 |
+ if (xrpcpipe_dir != NULL)
|
|
|
5fd2c0 |
+ strlcpy(rpcpipe_dir, xrpcpipe_dir, sizeof(rpcpipe_dir));
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ strncpy(nfspipe_dir, rpcpipe_dir, sizeof(nfspipe_dir));
|
|
|
5fd2c0 |
+ strlcat(nfspipe_dir, "/nfs", sizeof(nfspipe_dir));
|
|
|
5fd2c0 |
+ strncpy(bl_pipe_file, rpcpipe_dir, sizeof(bl_pipe_file));
|
|
|
5fd2c0 |
+ strlcat(bl_pipe_file, "/nfs/blocklayout", sizeof(bl_pipe_file));
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
while ((opt = getopt(argc, argv, "hdf")) != -1) {
|
|
|
5fd2c0 |
switch (opt) {
|
|
|
5fd2c0 |
@@ -501,12 +531,12 @@ int main(int argc, char **argv)
|
|
|
5fd2c0 |
}
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
/* open pipe file */
|
|
|
5fd2c0 |
- bl_watch_dir(RPCPIPE_DIR, &rpc_pipedir_wfd);
|
|
|
5fd2c0 |
- bl_watch_dir(NFSPIPE_DIR, &nfs_pipedir_wfd);
|
|
|
5fd2c0 |
+ bl_watch_dir(rpcpipe_dir, &rpc_pipedir_wfd);
|
|
|
5fd2c0 |
+ bl_watch_dir(nfspipe_dir, &nfs_pipedir_wfd);
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
- bl_pipe_fd = open(BL_PIPE_FILE, O_RDWR);
|
|
|
5fd2c0 |
+ bl_pipe_fd = open(bl_pipe_file, O_RDWR);
|
|
|
5fd2c0 |
if (bl_pipe_fd < 0)
|
|
|
5fd2c0 |
- BL_LOG_ERR("open pipe file %s failed: %s\n", BL_PIPE_FILE, strerror(errno));
|
|
|
5fd2c0 |
+ BL_LOG_ERR("open pipe file %s failed: %s\n", bl_pipe_file, strerror(errno));
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
while (1) {
|
|
|
5fd2c0 |
/* discover device when needed */
|
|
|
5fd2c0 |
diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
|
|
|
5fd2c0 |
index c5c03fb..10d50d3 100644
|
|
|
5fd2c0 |
--- a/utils/gssd/gssd.c
|
|
|
5fd2c0 |
+++ b/utils/gssd/gssd.c
|
|
|
5fd2c0 |
@@ -857,6 +857,10 @@ read_gss_conf(void)
|
|
|
5fd2c0 |
s = conf_get_str("gssd", "pipefs-directory");
|
|
|
5fd2c0 |
if (!s)
|
|
|
5fd2c0 |
s = conf_get_str("general", "pipefs-directory");
|
|
|
5fd2c0 |
+ else
|
|
|
5fd2c0 |
+ printerr(0, "WARNING: Specifying pipefs-directory in the [gssd] "
|
|
|
5fd2c0 |
+ "section of %s is deprecated. Use the [general] "
|
|
|
5fd2c0 |
+ "section instead.", NFS_CONFFILE);
|
|
|
5fd2c0 |
if (s)
|
|
|
5fd2c0 |
pipefs_path = s;
|
|
|
5fd2c0 |
s = conf_get_str("gssd", "keytab-file");
|
|
|
5fd2c0 |
diff --git a/utils/gssd/gssd.man b/utils/gssd/gssd.man
|
|
|
5fd2c0 |
index 87eef02..e620f0d 100644
|
|
|
5fd2c0 |
--- a/utils/gssd/gssd.man
|
|
|
5fd2c0 |
+++ b/utils/gssd/gssd.man
|
|
|
5fd2c0 |
@@ -335,10 +335,6 @@ Equivalent to
|
|
|
5fd2c0 |
Equivalent to
|
|
|
5fd2c0 |
.BR -t .
|
|
|
5fd2c0 |
.TP
|
|
|
5fd2c0 |
-.B pipefs-directory
|
|
|
5fd2c0 |
-Equivalent to
|
|
|
5fd2c0 |
-.BR -p .
|
|
|
5fd2c0 |
-.TP
|
|
|
5fd2c0 |
.B keytab-file
|
|
|
5fd2c0 |
Equivalent to
|
|
|
5fd2c0 |
.BR -k .
|
|
|
5fd2c0 |
@@ -350,6 +346,14 @@ Equivalent to
|
|
|
5fd2c0 |
.B preferred-realm
|
|
|
5fd2c0 |
Equivalent to
|
|
|
5fd2c0 |
.BR -R .
|
|
|
5fd2c0 |
+.P
|
|
|
5fd2c0 |
+In addtion, the following value is recognized from the
|
|
|
5fd2c0 |
+.B [general]
|
|
|
5fd2c0 |
+section:
|
|
|
5fd2c0 |
+.TP
|
|
|
5fd2c0 |
+.B pipefs-directory
|
|
|
5fd2c0 |
+Equivalent to
|
|
|
5fd2c0 |
+.BR -p .
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
.SH SEE ALSO
|
|
|
5fd2c0 |
.BR rpc.svcgssd (8),
|
|
|
5fd2c0 |
diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
|
|
|
5fd2c0 |
index f55d2e1..03efbea 100644
|
|
|
5fd2c0 |
--- a/utils/idmapd/idmapd.c
|
|
|
5fd2c0 |
+++ b/utils/idmapd/idmapd.c
|
|
|
5fd2c0 |
@@ -166,7 +166,7 @@ static uid_t nobodyuid;
|
|
|
5fd2c0 |
static gid_t nobodygid;
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
/* Used by conffile.c in libnfs.a */
|
|
|
5fd2c0 |
-char *conf_path;
|
|
|
5fd2c0 |
+char *conf_path = NULL;
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
static int
|
|
|
5fd2c0 |
flush_nfsd_cache(char *path, time_t now)
|
|
|
5fd2c0 |
@@ -220,7 +220,6 @@ main(int argc, char **argv)
|
|
|
5fd2c0 |
int ret;
|
|
|
5fd2c0 |
char *progname;
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
- conf_path = _PATH_IDMAPDCONF;
|
|
|
5fd2c0 |
nobodyuser = NFS4NOBODY_USER;
|
|
|
5fd2c0 |
nobodygroup = NFS4NOBODY_GROUP;
|
|
|
5fd2c0 |
strlcpy(pipefsdir, PIPEFS_DIR, sizeof(pipefsdir));
|
|
|
5fd2c0 |
@@ -234,8 +233,11 @@ main(int argc, char **argv)
|
|
|
5fd2c0 |
#define GETOPTSTR "hvfd:p:U:G:c:CS"
|
|
|
5fd2c0 |
opterr=0; /* Turn off error messages */
|
|
|
5fd2c0 |
while ((opt = getopt(argc, argv, GETOPTSTR)) != -1) {
|
|
|
5fd2c0 |
- if (opt == 'c')
|
|
|
5fd2c0 |
+ if (opt == 'c') {
|
|
|
5fd2c0 |
+ warnx("-c is deprecated and may be removed in the "
|
|
|
5fd2c0 |
+ "future. See idmapd(8).");
|
|
|
5fd2c0 |
conf_path = optarg;
|
|
|
5fd2c0 |
+ }
|
|
|
5fd2c0 |
if (opt == '?') {
|
|
|
5fd2c0 |
if (strchr(GETOPTSTR, optopt))
|
|
|
5fd2c0 |
warnx("'-%c' option requires an argument.", optopt);
|
|
|
5fd2c0 |
@@ -247,17 +249,33 @@ main(int argc, char **argv)
|
|
|
5fd2c0 |
}
|
|
|
5fd2c0 |
optind = 1;
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
- if (stat(conf_path, &sb) == -1 && (errno == ENOENT || errno == EACCES)) {
|
|
|
5fd2c0 |
- warn("Skipping configuration file \"%s\"", conf_path);
|
|
|
5fd2c0 |
- conf_path = NULL;
|
|
|
5fd2c0 |
+ if (conf_path) { /* deprecated -c option was specified */
|
|
|
5fd2c0 |
+ if (stat(conf_path, &sb) == -1 && (errno == ENOENT || errno == EACCES)) {
|
|
|
5fd2c0 |
+ warn("Skipping configuration file \"%s\"", conf_path);
|
|
|
5fd2c0 |
+ conf_path = NULL;
|
|
|
5fd2c0 |
+ } else {
|
|
|
5fd2c0 |
+ conf_init();
|
|
|
5fd2c0 |
+ verbose = conf_get_num("General", "Verbosity", 0);
|
|
|
5fd2c0 |
+ cache_entry_expiration = conf_get_num("General",
|
|
|
5fd2c0 |
+ "Cache-Expiration", DEFAULT_IDMAP_CACHE_EXPIRY);
|
|
|
5fd2c0 |
+ CONF_SAVE(xpipefsdir, conf_get_str("General", "Pipefs-Directory"));
|
|
|
5fd2c0 |
+ if (xpipefsdir != NULL)
|
|
|
5fd2c0 |
+ strlcpy(pipefsdir, xpipefsdir, sizeof(pipefsdir));
|
|
|
5fd2c0 |
+ CONF_SAVE(nobodyuser, conf_get_str("Mapping", "Nobody-User"));
|
|
|
5fd2c0 |
+ CONF_SAVE(nobodygroup, conf_get_str("Mapping", "Nobody-Group"));
|
|
|
5fd2c0 |
+ }
|
|
|
5fd2c0 |
} else {
|
|
|
5fd2c0 |
+ conf_path = NFS_CONFFILE;
|
|
|
5fd2c0 |
conf_init();
|
|
|
5fd2c0 |
- verbose = conf_get_num("General", "Verbosity", 0);
|
|
|
5fd2c0 |
- cache_entry_expiration = conf_get_num("General",
|
|
|
5fd2c0 |
- "Cache-Expiration", DEFAULT_IDMAP_CACHE_EXPIRY);
|
|
|
5fd2c0 |
CONF_SAVE(xpipefsdir, conf_get_str("General", "Pipefs-Directory"));
|
|
|
5fd2c0 |
if (xpipefsdir != NULL)
|
|
|
5fd2c0 |
strlcpy(pipefsdir, xpipefsdir, sizeof(pipefsdir));
|
|
|
5fd2c0 |
+
|
|
|
5fd2c0 |
+ conf_path = _PATH_IDMAPDCONF;
|
|
|
5fd2c0 |
+ conf_init();
|
|
|
5fd2c0 |
+ verbose = conf_get_num("General", "Verbosity", 0);
|
|
|
5fd2c0 |
+ cache_entry_expiration = conf_get_num("General",
|
|
|
5fd2c0 |
+ "cache-expiration", DEFAULT_IDMAP_CACHE_EXPIRY);
|
|
|
5fd2c0 |
CONF_SAVE(nobodyuser, conf_get_str("Mapping", "Nobody-User"));
|
|
|
5fd2c0 |
CONF_SAVE(nobodygroup, conf_get_str("Mapping", "Nobody-Group"));
|
|
|
5fd2c0 |
}
|
|
|
5fd2c0 |
diff --git a/utils/idmapd/idmapd.man b/utils/idmapd/idmapd.man
|
|
|
5fd2c0 |
index b9200c7..fb5fc1e 100644
|
|
|
5fd2c0 |
--- a/utils/idmapd/idmapd.man
|
|
|
5fd2c0 |
+++ b/utils/idmapd/idmapd.man
|
|
|
5fd2c0 |
@@ -50,11 +50,28 @@ The default value is \&"/var/lib/nfs/rpc_pipefs\&".
|
|
|
5fd2c0 |
.It Fl c Ar path
|
|
|
5fd2c0 |
Use configuration file
|
|
|
5fd2c0 |
.Ar path .
|
|
|
5fd2c0 |
+This option is deprecated.
|
|
|
5fd2c0 |
.It Fl C
|
|
|
5fd2c0 |
Client-only: perform no idmapping for any NFS server, even if one is detected.
|
|
|
5fd2c0 |
.It Fl S
|
|
|
5fd2c0 |
Server-only: perform no idmapping for any NFS client, even if one is detected.
|
|
|
5fd2c0 |
.El
|
|
|
5fd2c0 |
+.Sh CONFIGURATION FILES
|
|
|
5fd2c0 |
+.Nm
|
|
|
5fd2c0 |
+recognizes the following value from the
|
|
|
5fd2c0 |
+.Sy [general]
|
|
|
5fd2c0 |
+section of the
|
|
|
5fd2c0 |
+.Pa /etc/nfs.conf
|
|
|
5fd2c0 |
+configuration file:
|
|
|
5fd2c0 |
+.Bl -tag -width Ds_imagedir
|
|
|
5fd2c0 |
+.It Sy pipefs-directory
|
|
|
5fd2c0 |
+Equivalent to
|
|
|
5fd2c0 |
+.Sy -p .
|
|
|
5fd2c0 |
+.El
|
|
|
5fd2c0 |
+.Pp
|
|
|
5fd2c0 |
+All other settings related to id mapping are found in the
|
|
|
5fd2c0 |
+.Pa /etc/idmapd.conf
|
|
|
5fd2c0 |
+configuration file.
|
|
|
5fd2c0 |
.Sh EXAMPLES
|
|
|
5fd2c0 |
.Cm rpc.idmapd -f -vvv
|
|
|
5fd2c0 |
.Pp
|
|
|
5fd2c0 |
@@ -71,9 +88,11 @@ messages to console, and with a verbosity level of 3.
|
|
|
5fd2c0 |
.\" This next request is for sections 1, 6, 7 & 8 only.
|
|
|
5fd2c0 |
.\" .Sh ENVIRONMENT
|
|
|
5fd2c0 |
.Sh FILES
|
|
|
5fd2c0 |
-.Pa /etc/idmapd.conf
|
|
|
5fd2c0 |
+.Pa /etc/idmapd.conf ,
|
|
|
5fd2c0 |
+.Pa /etc/nfs.conf
|
|
|
5fd2c0 |
.Sh SEE ALSO
|
|
|
5fd2c0 |
.Xr idmapd.conf 5 ,
|
|
|
5fd2c0 |
+.Xr nfs.conf 5 ,
|
|
|
5fd2c0 |
.Xr nfsidmap 8
|
|
|
5fd2c0 |
.\".Sh SEE ALSO
|
|
|
5fd2c0 |
.\".Xr nylon.conf 4
|
|
|
5fd2c0 |
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
|
|
|
5fd2c0 |
index 3bc13ca..f23fb5a 100644
|
|
|
5fd2c0 |
--- a/utils/mountd/cache.c
|
|
|
5fd2c0 |
+++ b/utils/mountd/cache.c
|
|
|
5fd2c0 |
@@ -31,6 +31,7 @@
|
|
|
5fd2c0 |
#include "mountd.h"
|
|
|
5fd2c0 |
#include "fsloc.h"
|
|
|
5fd2c0 |
#include "pseudoflavors.h"
|
|
|
5fd2c0 |
+#include "xcommon.h"
|
|
|
5fd2c0 |
|
|
|
5fd2c0 |
#ifdef USE_BLKID
|
|
|
5fd2c0 |
#include "blkid/blkid.h"
|