netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH 1b/2] tc: check for errors in gen_rate_estimator creation
Date: Tue, 25 Nov 2008 20:05:46 +0100	[thread overview]
Message-ID: <492C4C8A.9000202@trash.net> (raw)
In-Reply-To: <20081125105850.7aa30a3d@extreme>

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 <shemminger@vyatta.com>
> 
> 
> ---
> --- 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.

> --- a/net/sched/sch_hfsc.c	2008-11-25 10:51:47.000000000 -0800
> +++ b/net/sched/sch_hfsc.c	2008-11-25 10:54:16.000000000 -0800
> @@ -1018,6 +1018,14 @@ hfsc_change_class(struct Qdisc *sch, u32
>  		}
>  		cur_time = psched_get_time();
>  
> +		if (tca[TCA_RATE]) {
> +			err = gen_replace_estimator(&cl->bstats, &cl->rate_est,
> +					      qdisc_root_sleeping_lock(sch),
> +					      tca[TCA_RATE]);
> +			if (err)
> +				return err;
> +		}
> +
>  		sch_tree_lock(sch);
>  		if (rsc != NULL)
>  			hfsc_change_rsc(cl, rsc, cur_time);
> @@ -1034,10 +1042,6 @@ hfsc_change_class(struct Qdisc *sch, u32
>  		}
>  		sch_tree_unlock(sch);
>  
> -		if (tca[TCA_RATE])
> -			gen_replace_estimator(&cl->bstats, &cl->rate_est,
> -					      qdisc_root_sleeping_lock(sch),
> -					      tca[TCA_RATE]);
>  		return 0;
>  	}

There's a gen_new_estimator() a few lines below that is still unchecked.

The remaining ones look fine.

  reply	other threads:[~2008-11-25 19:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-25 18:16 [PATCH 1/2] tc: check for errors from gen_replace_estimator Stephen Hemminger
2008-11-25 18:21 ` [PATCH 2/2] tc: policing requires a rate estimator Stephen Hemminger
2008-11-25 18:32   ` Patrick McHardy
2008-11-25 18:33     ` Stephen Hemminger
2008-11-25 18:38       ` Patrick McHardy
2008-11-26  5:14   ` David Miller
2008-11-26 11:10   ` [PATCH] pkt_sched: gen_estimator: Optimize gen_estimator_active() Jarek Poplawski
2008-11-26 16:29     ` Stephen Hemminger
2008-11-26 23:24     ` David Miller
2008-11-25 18:28 ` [PATCH 1/2] tc: check for errors from gen_replace_estimator Patrick McHardy
2008-11-25 18:57   ` [PATCH 1a/2] tc: propogate errors from tcf_hash_create Stephen Hemminger
2008-11-26  5:12     ` David Miller
2008-11-25 18:58   ` [PATCH 1b/2] tc: check for errors in gen_rate_estimator creation Stephen Hemminger
2008-11-25 19:05     ` Patrick McHardy [this message]
2008-11-25 19:14       ` Stephen Hemminger
2008-11-25 19:19         ` Patrick McHardy
2008-11-25 19:25           ` Stephen Hemminger
2008-11-26  5:13             ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=492C4C8A.9000202@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).