diff -up nfs-utils-1.3.0/nfs.conf.orig nfs-utils-1.3.0/nfs.conf
--- nfs-utils-1.3.0/nfs.conf.orig 2019-03-15 11:06:31.295217191 -0400
+++ nfs-utils-1.3.0/nfs.conf 2019-03-15 11:07:37.178172631 -0400
@@ -63,6 +63,7 @@
# name=
# state-directory-path=/var/lib/nfs/statd
# ha-callout=
+# no-notify=0
#
#[sm-notify]
# debug=0
diff -up nfs-utils-1.3.0/utils/statd/statd.c.orig nfs-utils-1.3.0/utils/statd/statd.c
--- nfs-utils-1.3.0/utils/statd/statd.c.orig 2019-03-15 11:06:31.244216452 -0400
+++ nfs-utils-1.3.0/utils/statd/statd.c 2019-03-15 11:15:33.950086819 -0400
@@ -226,7 +226,8 @@ static void set_nlm_port(char *type, int
fd = open(pathbuf, O_WRONLY);
if (fd < 0 && errno == ENOENT) {
/* probably module not loaded */
- system("modprobe lockd");
+ if (system("modprobe lockd"))
+ {/* ignore return value */}
fd = open(pathbuf, O_WRONLY);
}
if (fd >= 0) {
@@ -237,6 +238,39 @@ static void set_nlm_port(char *type, int
} else
fprintf(stderr, "%s: failed to open %s: %m\n", name_p, pathbuf);
}
+int port = 0, out_port = 0;
+int nlm_udp = 0, nlm_tcp = 0;
+
+inline static void
+read_nfsconf(char **argv)
+{
+ char *s;
+
+ conf_init();
+ xlog_from_conffile("statd");
+
+ out_port = conf_get_num("statd", "outgoing-port", out_port);
+ port = conf_get_num("statd", "port", port);
+
+ MY_NAME = conf_get_str("statd", "name");
+ if (MY_NAME)
+ run_mode |= STATIC_HOSTNAME;
+
+ s = conf_get_str("statd", "state-directory-path");
+ if (s && !nsm_setup_pathnames(argv[0], s))
+ exit(1);
+
+ s = conf_get_str("statd", "ha-callout");
+ if (s)
+ ha_callout_prog = s;
+
+ nlm_tcp = conf_get_num("lockd", "port", nlm_tcp);
+ /* udp defaults to the same as tcp ! */
+ nlm_udp = conf_get_num("lockd", "udp-port", nlm_tcp);
+
+ if (conf_get_bool("statd", "no-notify", false))
+ run_mode |= MODE_NO_NOTIFY;
+}
/*
* Entry routine/main loop.
@@ -244,11 +278,8 @@ static void set_nlm_port(char *type, int
int main (int argc, char **argv)
{
extern char *optarg;
- char *s;
int pid;
int arg;
- int port = 0, out_port = 0;
- int nlm_udp = 0, nlm_tcp = 0;
struct rlimit rlim;
char *env;
@@ -273,23 +304,8 @@ int main (int argc, char **argv)
/* Set hostname */
MY_NAME = NULL;
- conf_init();
- xlog_from_conffile("statd");
- out_port = conf_get_num("statd", "outgoing-port", out_port);
- port = conf_get_num("statd", "port", port);
- MY_NAME = conf_get_str("statd", "name");
- if (MY_NAME)
- run_mode |= STATIC_HOSTNAME;
- s = conf_get_str("statd", "state-directory-path");
- if (s && !nsm_setup_pathnames(argv[0], s))
- exit(1);
- s = conf_get_str("statd", "ha-callout");
- if (s)
- ha_callout_prog = s;
-
- nlm_tcp = conf_get_num("lockd", "port", nlm_tcp);
- /* udp defaults to the same as tcp ! */
- nlm_udp = conf_get_num("lockd", "udp-port", nlm_tcp);
+ /* Read nfs.conf */
+ read_nfsconf(argv);
/* Process command line switches */
while ((arg = getopt_long(argc, argv, "h?vVFNH:dn:p:o:P:LT:U:", longopts, NULL)) != EOF) {