]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Allow rpc.statd to *not* run sm-notify.
authorNeil Brown <neilb@suse.de>
Mon, 19 Mar 2007 23:13:00 +0000 (10:13 +1100)
committerNeil Brown <neilb@suse.de>
Mon, 19 Mar 2007 23:13:00 +0000 (10:13 +1100)
With -L (for Listen-only) or --no-notify, statd will not run
sm-notify.

utils/statd/statd.c
utils/statd/statd.h
utils/statd/statd.man

index 62009111edd5a0a594c823c3dc62972fa58f2193..17e2947b35f0b8021fb2b170e854dbe8156c92a4 100644 (file)
@@ -70,6 +70,7 @@ static struct option longopts[] =
        { "state-directory-path", 1, 0, 'P' },
        { "notify-mode", 0, 0, 'N' },
        { "ha-callout", 1, 0, 'H' },
        { "state-directory-path", 1, 0, 'P' },
        { "notify-mode", 0, 0, 'N' },
        { "ha-callout", 1, 0, 'H' },
+       { "no-notify", 0, 0, 'L' },
        { NULL, 0, 0, 0 }
 };
 
        { NULL, 0, 0, 0 }
 };
 
@@ -158,6 +159,7 @@ usage()
        fprintf(stderr,"      -n, --name           Specify a local hostname.\n");
        fprintf(stderr,"      -P                   State directory path.\n");
        fprintf(stderr,"      -N                   Run in notify only mode.\n");
        fprintf(stderr,"      -n, --name           Specify a local hostname.\n");
        fprintf(stderr,"      -P                   State directory path.\n");
        fprintf(stderr,"      -N                   Run in notify only mode.\n");
+       fprintf(stderr,"      -L, --no-notify      Do not perform any notification.\n");
        fprintf(stderr,"      -H                   Specify a high-availability callout program.\n");
 }
 
        fprintf(stderr,"      -H                   Specify a high-availability callout program.\n");
 }
 
@@ -274,7 +276,7 @@ int main (int argc, char **argv)
        MY_NAME = NULL;
 
        /* Process command line switches */
        MY_NAME = NULL;
 
        /* Process command line switches */
-       while ((arg = getopt_long(argc, argv, "h?vVFNH:dn:p:o:P:", longopts, NULL)) != EOF) {
+       while ((arg = getopt_long(argc, argv, "h?vVFNH:dn:p:o:P:L", longopts, NULL)) != EOF) {
                switch (arg) {
                case 'V':       /* Version */
                case 'v':
                switch (arg) {
                case 'V':       /* Version */
                case 'v':
@@ -286,6 +288,9 @@ int main (int argc, char **argv)
                case 'N':
                        run_mode |= MODE_NOTIFY_ONLY;
                        break;
                case 'N':
                        run_mode |= MODE_NOTIFY_ONLY;
                        break;
+               case 'L': /* Listen only */
+                       run_mode |= MODE_NO_NOTIFY;
+                       break;
                case 'd':       /* No daemon only - log to stderr */
                        run_mode |= MODE_LOG_STDERR;
                        break;
                case 'd':       /* No daemon only - log to stderr */
                        run_mode |= MODE_LOG_STDERR;
                        break;
@@ -458,15 +463,16 @@ int main (int argc, char **argv)
        create_pidfile();
        atexit(truncate_pidfile);
 
        create_pidfile();
        atexit(truncate_pidfile);
 
-       switch (pid = fork()) {
-       case 0:
-               run_sm_notify(out_port);
-               break;
-       case -1:
-               break;
-       default:
-               waitpid(pid, NULL, 0);
-       }
+       if (! (run_mode & MODE_NO_NOTIFY))
+               switch (pid = fork()) {
+               case 0:
+                       run_sm_notify(out_port);
+                       break;
+               case -1:
+                       break;
+               default:
+                       waitpid(pid, NULL, 0);
+               }
 
        drop_privs();
 
 
        drop_privs();
 
@@ -496,15 +502,17 @@ int main (int argc, char **argv)
                 * responding to SM_SIMU_CRASH is an important use cases to
                 * get perfect.
                 */
                 * responding to SM_SIMU_CRASH is an important use cases to
                 * get perfect.
                 */
-               switch (pid = fork()) {
-               case 0:
-                       run_sm_notify(out_port);
-                       break;
-               case -1:
-                       break;
-               default:
-                       waitpid(pid, NULL, 0);
-               }
+               if (! (run_mode & MODE_NO_NOTIFY))
+                       switch (pid = fork()) {
+                       case 0:
+                               run_sm_notify(out_port);
+                               break;
+                       case -1:
+                               break;
+                       default:
+                               waitpid(pid, NULL, 0);
+                       }
+
        }
        return 0;
 }
        }
        return 0;
 }
index 13c80da4edccad86c1cce5247c08a717efd1892a..441eaaa60b00b0490e74e6511df6fc976ee8609c 100644 (file)
@@ -82,7 +82,7 @@ extern int run_mode;
  * that just came back up, for ex, when failing over a HA service to
  * another host.... */
 #define STATIC_HOSTNAME 8      /* Always use the hostname set by -n */
  * that just came back up, for ex, when failing over a HA service to
  * another host.... */
 #define STATIC_HOSTNAME 8      /* Always use the hostname set by -n */
-
+#define        MODE_NO_NOTIFY  16      /* Don't notify peers of a reboot */
 /*
  * Program name and version pointers -- See statd.c for the reasoning
  * as to why they're global.
 /*
  * Program name and version pointers -- See statd.c for the reasoning
  * as to why they're global.
index ce29dfdfba200a7540fd5448d8e963b28e6d5dc9..e8be9f3b4fb12d1035f3898050eb7710c321617b 100644 (file)
@@ -9,7 +9,7 @@
 .SH NAME
 rpc.statd \- NSM status monitor
 .SH SYNOPSIS
 .SH NAME
 rpc.statd \- NSM status monitor
 .SH SYNOPSIS
-.B "rpc.statd [-F] [-d] [-?] [-n " name "] [-o " port "] [-p " port "] [-H " prog "] [-V]"
+.B "rpc.statd [-FNL] [-d] [-?] [-n " name "] [-o " port "] [-p " port "] [-H " prog "] [-V]"
 .SH DESCRIPTION
 The
 .B rpc.statd
 .SH DESCRIPTION
 The
 .B rpc.statd
@@ -25,7 +25,9 @@ For each NFS client or server machine to be monitored,
 .B rpc.statd
 creates a file in
 .BR /var/lib/nfs/sm .
 .B rpc.statd
 creates a file in
 .BR /var/lib/nfs/sm .
-When starting, it iterates through these files and notifies the
+When starting, it normally runs
+.B sm-notify
+to iterate through these files and notify the
 peer
 .B rpc.statd
 on those machines.
 peer
 .B rpc.statd
 on those machines.
@@ -101,6 +103,21 @@ Causes statd to run in the notify-only mode. When started in this mode, the
 statd program will check its state directory, send notifications to any
 monitored nodes, and exit once the notifications have been sent. This mode is
 used to enable Highly Available NFS implementations (i.e. HA-NFS).
 statd program will check its state directory, send notifications to any
 monitored nodes, and exit once the notifications have been sent. This mode is
 used to enable Highly Available NFS implementations (i.e. HA-NFS).
+This mode is deprecated \-
+.B sm-notify
+should be used directly instead.
+.TP
+.BR -L , " --no-notify
+Inhibits the running of
+.BR sm-notify .
+If
+.B sm-notify
+is run by some other script at boot time, there is no need for
+.B statd
+to start sm-notify itself.  This can be appropriate if starting of
+statd needs to be delayed until it is actually need.  In such cases
+.B sm-notify
+should still be run at boot time.
 .TP
 .BI "\-H, " "" " \-\-ha-callout " prog
 Specify a high availability callout program, which will receive callouts
 .TP
 .BI "\-H, " "" " \-\-ha-callout " prog
 Specify a high availability callout program, which will receive callouts