Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3]: src/usr.sbin/rpc.statd Pull up following revision(s) (request...



details:   https://anonhg.NetBSD.org/src/rev/81e8d772ec34
branches:  netbsd-3
changeset: 577402:81e8d772ec34
user:      riz <riz%NetBSD.org@localhost>
date:      Sat Oct 22 03:41:12 2005 +0000

description:
Pull up following revision(s) (requested by christos in ticket #905):
        usr.sbin/rpc.statd/statd.c: revision 1.24
PR/31502: John: rpc.statd doesn't save failed notifies in the database.
Tested by Martti Kuparinen.

diffstat:

 usr.sbin/rpc.statd/statd.c |  76 ++++++++++++++++++++++-----------------------
 1 files changed, 37 insertions(+), 39 deletions(-)

diffs (108 lines):

diff -r 48ff21b5e1b4 -r 81e8d772ec34 usr.sbin/rpc.statd/statd.c
--- a/usr.sbin/rpc.statd/statd.c        Fri Oct 21 18:59:04 2005 +0000
+++ b/usr.sbin/rpc.statd/statd.c        Sat Oct 22 03:41:12 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: statd.c,v 1.23 2004/01/14 10:29:46 yamt Exp $  */
+/*     $NetBSD: statd.c,v 1.23.6.1 2005/10/22 03:41:12 riz Exp $       */
 
 /*
  * Copyright (c) 1997 Christos Zoulas. All rights reserved.
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: statd.c,v 1.23 2004/01/14 10:29:46 yamt Exp $");
+__RCSID("$NetBSD: statd.c,v 1.23.6.1 2005/10/22 03:41:12 riz Exp $");
 #endif
 
 /* main() function for status monitor daemon.  Some of the code in this        */
@@ -459,54 +459,52 @@
        time_t now = *(time_t *) ptr;
        char *name = key->data;
        DBT data;
+       int error;
 
        if (hi->notifyReqd == 0 || hi->notifyReqd > now)
                return 0;
 
-       if (notify_one_host(name)) {
-give_up:
+       /*
+        * If one of the initial attempts fails, we wait
+        * for a while and have another go.  This is necessary
+        * because when we have crashed, (eg. a power outage)
+        * it is quite possible that we won't be able to
+        * contact all monitored hosts immediately on restart,
+        * either because they crashed too and take longer
+        * to come up (in which case the notification isn't
+        * really required), or more importantly if some
+        * router etc. needed to reach the monitored host
+        * has not come back up yet.  In this case, we will
+        * be a bit late in re-establishing locks (after the
+        * grace period) but that is the best we can do.  We
+        * try 10 times at 5 sec intervals, 10 more times at
+        * 1 minute intervals, then 24 more times at hourly
+        * intervals, finally giving up altogether if the
+        * host hasn't come back to life after 24 hours.
+        */
+       if (notify_one_host(name) || hi->attempts++ >= 44) {
+               error = 0;
                hi->notifyReqd = 0;
                hi->attempts = 0;
-               data.data = hi;
-               data.size = sizeof(*hi);
-               switch ((*db->put)(db, key, &data, 0)) {
-               case -1:
-                       syslog(LOG_ERR, "Error storing %s (%m)", name);
-               case 0:
-                       return 0;
-
-               default:
-                       abort();
-               }
-       }
-       else {
-               /*
-                * If one of the initial attempts fails, we wait
-                * for a while and have another go.  This is necessary
-                * because when we have crashed, (eg. a power outage)
-                * it is quite possible that we won't be able to
-                * contact all monitored hosts immediately on restart,
-                * either because they crashed too and take longer
-                * to come up (in which case the notification isn't
-                * really required), or more importantly if some
-                * router etc. needed to reach the monitored host
-                * has not come back up yet.  In this case, we will
-                * be a bit late in re-establishing locks (after the
-                * grace period) but that is the best we can do.  We
-                * try 10 times at 5 sec intervals, 10 more times at
-                * 1 minute intervals, then 24 more times at hourly
-                * intervals, finally giving up altogether if the
-                * host hasn't come back to life after 24 hours.
-                */
-               if (hi->attempts++ >= 44)
-                       goto give_up;
-               else if (hi->attempts < 10)
+       } else {
+               error = -1;
+               if (hi->attempts < 10)
                        hi->notifyReqd += 5;
                else if (hi->attempts < 20)
                        hi->notifyReqd += 60;
                else
                        hi->notifyReqd += 60 * 60;
-               return -1;
+       }
+       data.data = hi;
+       data.size = sizeof(*hi);
+       switch ((*db->put)(db, key, &data, 0)) {
+       case -1:
+               syslog(LOG_ERR, "Error storing %s (%m)", name);
+       case 0:
+               return error;
+
+       default:
+               abort();
        }
 }
 



Home | Main Index | Thread Index | Old Index