Blame SOURCES/nfs-utils-2.3.3-statd-no-notify.patch

6d7591
commit 5394f939b591e65fec37a6bee826c13620d3f39b
6d7591
Author: Justin Mitchell <jumitche@redhat.com>
6d7591
Date:   Mon Mar 4 11:53:09 2019 -0500
6d7591
6d7591
    Add nfs.conf equivalent for the statd --no-notify cmdline option
6d7591
    
6d7591
    Also cleaned up how nfs.conf is read.
6d7591
    
6d7591
    Signed-off-by: Justin Mitchell <jumitche@redhat.com>
6d7591
    Signed-off-by: Steve Dickson <steved@redhat.com>
6d7591
6d7591
diff --git a/nfs.conf b/nfs.conf
6d7591
index f1ebfdb..d332375 100644
6d7591
--- a/nfs.conf
6d7591
+++ b/nfs.conf
6d7591
@@ -62,6 +62,7 @@
6d7591
 # name=
6d7591
 # state-directory-path=/var/lib/nfs/statd
6d7591
 # ha-callout=
6d7591
+# no-notify=0
6d7591
 #
6d7591
 [sm-notify]
6d7591
 # debug=0
6d7591
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
6d7591
index 2cc6cf3..1467380 100644
6d7591
--- a/utils/statd/statd.c
6d7591
+++ b/utils/statd/statd.c
6d7591
@@ -238,6 +238,39 @@ static void set_nlm_port(char *type, int port)
6d7591
 		fprintf(stderr, "%s: failed to open %s: %s\n", 
6d7591
 			name_p, pathbuf, strerror(errno));
6d7591
 }
6d7591
+int port = 0, out_port = 0;
6d7591
+int nlm_udp = 0, nlm_tcp = 0;
6d7591
+
6d7591
+inline static void 
6d7591
+read_nfsconf(char **argv)
6d7591
+{
6d7591
+	char *s;
6d7591
+
6d7591
+	conf_init_file(NFS_CONFFILE);
6d7591
+	xlog_from_conffile("statd");
6d7591
+
6d7591
+	out_port = conf_get_num("statd", "outgoing-port", out_port);
6d7591
+	port = conf_get_num("statd", "port", port);
6d7591
+
6d7591
+	MY_NAME = conf_get_str("statd", "name");
6d7591
+	if (MY_NAME)
6d7591
+		run_mode |= STATIC_HOSTNAME;
6d7591
+
6d7591
+	s = conf_get_str("statd", "state-directory-path");
6d7591
+	if (s && !nsm_setup_pathnames(argv[0], s))
6d7591
+		exit(1);
6d7591
+
6d7591
+	s = conf_get_str("statd", "ha-callout");
6d7591
+	if (s)
6d7591
+		ha_callout_prog = s;
6d7591
+
6d7591
+	nlm_tcp = conf_get_num("lockd", "port", nlm_tcp);
6d7591
+	/* udp defaults to the same as tcp ! */
6d7591
+	nlm_udp = conf_get_num("lockd", "udp-port", nlm_tcp);
6d7591
+
6d7591
+	if (conf_get_bool("statd", "no-notify", false))
6d7591
+		run_mode |= MODE_NO_NOTIFY;
6d7591
+}
6d7591
 
6d7591
 /*
6d7591
  * Entry routine/main loop.
6d7591
@@ -245,11 +278,8 @@ static void set_nlm_port(char *type, int port)
6d7591
 int main (int argc, char **argv)
6d7591
 {
6d7591
 	extern char *optarg;
6d7591
-	char *s;
6d7591
 	int pid;
6d7591
 	int arg;
6d7591
-	int port = 0, out_port = 0;
6d7591
-	int nlm_udp = 0, nlm_tcp = 0;
6d7591
 	struct rlimit rlim;
6d7591
 	int notify_sockfd;
6d7591
 	char *env;
6d7591
@@ -275,23 +305,8 @@ int main (int argc, char **argv)
6d7591
 	/* Set hostname */
6d7591
 	MY_NAME = NULL;
6d7591
 
6d7591
-	conf_init_file(NFS_CONFFILE);
6d7591
-	xlog_from_conffile("statd");
6d7591
-	out_port = conf_get_num("statd", "outgoing-port", out_port);
6d7591
-	port = conf_get_num("statd", "port", port);
6d7591
-	MY_NAME = conf_get_str("statd", "name");
6d7591
-	if (MY_NAME)
6d7591
-		run_mode |= STATIC_HOSTNAME;
6d7591
-	s = conf_get_str("statd", "state-directory-path");
6d7591
-	if (s && !nsm_setup_pathnames(argv[0], s))
6d7591
-		exit(1);
6d7591
-	s = conf_get_str("statd", "ha-callout");
6d7591
-	if (s)
6d7591
-		ha_callout_prog = s;
6d7591
-
6d7591
-	nlm_tcp = conf_get_num("lockd", "port", nlm_tcp);
6d7591
-	/* udp defaults to the same as tcp ! */
6d7591
-	nlm_udp = conf_get_num("lockd", "udp-port", nlm_tcp);
6d7591
+	/* Read nfs.conf */
6d7591
+	read_nfsconf(argv);
6d7591
 
6d7591
 	/* Process command line switches */
6d7591
 	while ((arg = getopt_long(argc, argv, "h?vVFNH:dn:p:o:P:LT:U:", longopts, NULL)) != EOF) {