Re: OOPS: Multipath routing 2.4.17

From: Julian Anastasov (ja@ssi.bg)
Date: Fri Mar 01 2002 - 19:27:40 EST


        Hello,

Kain wrote:

> impossible 888
> divide error: 0000

> > > EIP; c024c5ea <fib_select_multipath+5a/a0> <=====
> Trace; c02232e8 <ip_route_output_slow+318/670>

        There is no write locking in fib_select_multipath,
combined with high rate of route resolutions and ... boom,
fi->fib_power is 0:

w = jiffies % fi->fib_power;

        What about a different algorithm to apply weighted
round robin (idea mostly from LVS), something like
this code (entirely not tested) where fi->fib_power is not used
and where fib_sync_up and fib_sync_down don't need to play
with nh_power on nh_flags change:

void fib_select_multipath(const struct rt_key *key, struct fib_result *res)
{
        struct fib_info *fi = res->fi;
        int w = -1, sel = 0;

        write_lock(&fib_info_lock);

        repeat:

        change_nexthops(fi) {
                if (nh->nh_power > w && !(nh->nh_flags&RTNH_F_DEAD)) {
                        w = nh->nh_power;
                        sel = nhsel;
                }
        } endfor_nexthops(fi);
        if (w > 0) {
                fi->fib_nh[sel].nh_power--;
                write_unlock(&fib_info_lock);
                res->nh_sel = sel;
                return;
        }

        if (!w) {
                change_nexthops(fi) {
                        if (!(nh->nh_flags&RTNH_F_DEAD)) {
                                nh->nh_power = nh->nh_weight;
                        }
                } endfor_nexthops(fi);
                w = -1;
                goto repeat;
        }

        write_unlock(&fib_info_lock);

#if 1
        printk(KERN_CRIT "impossible 888\n");
#endif
        return;
}

Regards

--
Julian Anastasov <ja@ssi.bg>

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Mar 07 2002 - 21:00:20 EST