Subject: Re: [PATCH 1b/2] tc: check for errors in gen_rate_estimator creation

From: Patrick McHardy <[email-masked]>
Date: Tue, 25 Nov 2008 20:19:29 +0100

Stephen Hemminger wrote:
> On Tue, 25 Nov 2008 20:05:46 +0100
> Patrick McHardy <[email-masked]> 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 <[email-masked]>
>>>
>>>
>>> ---
>>> --- 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.