From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrick McHardy Subject: Re: [PATCH 1b/2] tc: check for errors in gen_rate_estimator creation Date: Tue, 25 Nov 2008 20:19:29 +0100 Message-ID: <492C4FC1.8080107@trash.net> References: <20081125101656.52348bdd@extreme> <492C43DF.1040703@trash.net> <20081125105850.7aa30a3d@extreme> <492C4C8A.9000202@trash.net> <20081125111423.0b953570@extreme> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: David Miller , netdev@vger.kernel.org To: Stephen Hemminger Return-path: Received: from stinky.trash.net ([213.144.137.162]:34627 "EHLO stinky.trash.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751597AbYKYTTl (ORCPT ); Tue, 25 Nov 2008 14:19:41 -0500 In-Reply-To: <20081125111423.0b953570@extreme> Sender: netdev-owner@vger.kernel.org List-ID: Stephen Hemminger wrote: > On Tue, 25 Nov 2008 20:05:46 +0100 > Patrick McHardy wrote: > >> Stephen Hemminger wrote: >>> The functions gen_new_estimator and gen_replace_estimator can return errors, >>> but they were being ignored. >>> >>> Signed-off-by: Stephen Hemminger >>> >>> >>> --- >>> --- a/net/sched/sch_api.c 2008-11-25 10:51:47.000000000 -0800 >>> +++ b/net/sched/sch_api.c 2008-11-25 10:54:16.000000000 -0800 >>> @@ -887,6 +887,14 @@ static int qdisc_change(struct Qdisc *sc >>> return err; >>> } >>> >>> + if (tca[TCA_RATE]) { >>> + err = gen_replace_estimator(&sch->bstats, &sch->rate_est, >>> + qdisc_root_sleeping_lock(sch), >>> + tca[TCA_RATE]); >>> + if (err) >>> + return err; >> This appears to have the same problem as in HFSC unless I missed more >> code movement - changes to the qdisc have already been performed. > > That is not fixable since both change and replace_estimator are non-unwindable, > and either one could fail. Could split checking and initialization out of gen_new_estimator, > but is it worth it?? Probably not. I'd suggest to not return the estimator error in this spot instead.