tech-kern archive

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

Re: crash in rn_walktree on reboot/shutdown



dyoung%pobox.com@localhost said:
> I suspect that an occasional side-effect of if_rt_walktree() deleting
> a leaf is to delete the next leaf that rn_walktree() precomputed.

Here is what I'm having in my tree for many months. I did this
originally to compensate for some bug introduced elsewhere,
but while it certainly has the potential to hide bugs it
makes the code more robust.

best regards
Matthias



------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
#
# old_revision [e7e99d7bd1a7ec16f632f9d489a3bfda6ac02d4d]
#
# patch "sys/net/if.c"
#  from [2f764544bedf58fa053320c517941791147f12c3]
#    to [f1d6674f5866d890c5126dcc93b75eb0116590bf]
# 
# patch "sys/net/radix.c"
#  from [f18791be726cd29df4eadf23233c63ab529b8f29]
#    to [da46876ad1655520145e39dc80adf1bb7e32d7c0]
#
============================================================
--- sys/net/if.c        2f764544bedf58fa053320c517941791147f12c3
+++ sys/net/if.c        f1d6674f5866d890c5126dcc93b75eb0116590bf
@@ -904,7 +904,7 @@ if_rt_walktree(struct rtentry *rt, void 
        if (error != 0)
                printf("%s: warning: unable to delete rtentry @ %p, "
                    "error = %d\n", ifp->if_xname, rt, error);
-       return 0;
+       return (-1);
 }
 
 /*
============================================================
--- sys/net/radix.c     f18791be726cd29df4eadf23233c63ab529b8f29
+++ sys/net/radix.c     da46876ad1655520145e39dc80adf1bb7e32d7c0
@@ -987,6 +987,7 @@ rn_walktree(
         * while applying the function f to it, so we need to calculate
         * the successor node in advance.
         */
+again:
        rn = rn_walkfirst(h->rnh_treetop, NULL, NULL);
        for (;;) {
                base = rn;
@@ -994,8 +995,13 @@ rn_walktree(
                /* Process leaves */
                while ((rn = base) != NULL) {
                        base = rn->rn_dupedkey;
-                       if (!(rn->rn_flags & RNF_ROOT) && (error = (*f)(rn, w)))
-                               return error;
+                       if (!(rn->rn_flags & RNF_ROOT)
+                           && (error = (*f)(rn, w))) {
+                               if (error == -1)
+                                       goto again;
+                               else
+                                       return error;
+                       }
                }
                rn = next;
                if (rn->rn_flags & RNF_ROOT)


Home | Main Index | Thread Index | Old Index