netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] ip link: don't stop batch processing
@ 2018-08-03 17:49 Matteo Croce
  2018-08-03 18:08 ` Dave Taht
  2018-08-08 16:27 ` Stephen Hemminger
  0 siblings, 2 replies; 4+ messages in thread
From: Matteo Croce @ 2018-08-03 17:49 UTC (permalink / raw)
  To: netdev, stephen

When 'ip link show dev DEVICE' is processed in a batch mode, ip exits
and stop processing further commands.
This because ipaddr_list_flush_or_save() calls exit() to avoid printing
the link information twice.
Replace the exit with a classic goto out instruction.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
---
 ip/ipaddress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 6c306ab7..b7b78f6e 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1920,7 +1920,7 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
 			exit(1);
 		}
 		delete_json_obj();
-		exit(0);
+		goto out;
 	}
 
 	if (filter.family != AF_PACKET) {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2] ip link: don't stop batch processing
  2018-08-03 17:49 [PATCH iproute2] ip link: don't stop batch processing Matteo Croce
@ 2018-08-03 18:08 ` Dave Taht
  2018-08-08 16:26   ` Stephen Hemminger
  2018-08-08 16:27 ` Stephen Hemminger
  1 sibling, 1 reply; 4+ messages in thread
From: Dave Taht @ 2018-08-03 18:08 UTC (permalink / raw)
  To: mcroce; +Cc: Linux Kernel Network Developers, Stephen Hemminger

On Fri, Aug 3, 2018 at 10:50 AM Matteo Croce <mcroce@redhat.com> wrote:
>
> When 'ip link show dev DEVICE' is processed in a batch mode, ip exits
> and stop processing further commands.
> This because ipaddr_list_flush_or_save() calls exit() to avoid printing
> the link information twice.
> Replace the exit with a classic goto out instruction.
>
> Signed-off-by: Matteo Croce <mcroce@redhat.com>

one thing I noticed in iproute2-next last week is that

( echo qdisc show dev eno1; sleep 5; echo qdisc show dev eno1; ) | tc -b -

batches the whole thing up to emerge on exit, only.

It didn't used to do that, the output of every command came out as it
completed. I used to use that to timestamp and save the overhead of
invoking the tc utility on openwrt while monitoring qdisc stats in
https://github.com/tohojo/flent/blob/master/misc/tc_iterate.c

alternatively adding timed/timestamped output to tc like -c count or
-I interval would be useful.

> ---
>  ip/ipaddress.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> index 6c306ab7..b7b78f6e 100644
> --- a/ip/ipaddress.c
> +++ b/ip/ipaddress.c
> @@ -1920,7 +1920,7 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
>                         exit(1);
>                 }
>                 delete_json_obj();
> -               exit(0);
> +               goto out;
>         }
>
>         if (filter.family != AF_PACKET) {
> --
> 2.17.1
>


-- 

Dave Täht
CEO, TekLibre, LLC
http://www.teklibre.com
Tel: 1-669-226-2619

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2] ip link: don't stop batch processing
  2018-08-03 18:08 ` Dave Taht
@ 2018-08-08 16:26   ` Stephen Hemminger
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2018-08-08 16:26 UTC (permalink / raw)
  To: Dave Taht; +Cc: mcroce, Linux Kernel Network Developers

On Fri, 3 Aug 2018 11:08:58 -0700
Dave Taht <dave.taht@gmail.com> wrote:

> On Fri, Aug 3, 2018 at 10:50 AM Matteo Croce <mcroce@redhat.com> wrote:
> >
> > When 'ip link show dev DEVICE' is processed in a batch mode, ip exits
> > and stop processing further commands.
> > This because ipaddr_list_flush_or_save() calls exit() to avoid printing
> > the link information twice.
> > Replace the exit with a classic goto out instruction.
> >
> > Signed-off-by: Matteo Croce <mcroce@redhat.com>  
> 
> one thing I noticed in iproute2-next last week is that
> 
> ( echo qdisc show dev eno1; sleep 5; echo qdisc show dev eno1; ) | tc -b -
> 
> batches the whole thing up to emerge on exit, only.
> 
> It didn't used to do that, the output of every command came out as it
> completed. I used to use that to timestamp and save the overhead of
> invoking the tc utility on openwrt while monitoring qdisc stats in
> https://github.com/tohojo/flent/blob/master/misc/tc_iterate.c

There used to be lots of fflush(stdout) in each sub command but lots of these
got dropped in JSON updates.

I just added one back in after each batch command that should fix what you are seeing.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2] ip link: don't stop batch processing
  2018-08-03 17:49 [PATCH iproute2] ip link: don't stop batch processing Matteo Croce
  2018-08-03 18:08 ` Dave Taht
@ 2018-08-08 16:27 ` Stephen Hemminger
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2018-08-08 16:27 UTC (permalink / raw)
  To: Matteo Croce; +Cc: netdev

On Fri,  3 Aug 2018 19:49:33 +0200
Matteo Croce <mcroce@redhat.com> wrote:

> When 'ip link show dev DEVICE' is processed in a batch mode, ip exits
> and stop processing further commands.
> This because ipaddr_list_flush_or_save() calls exit() to avoid printing
> the link information twice.
> Replace the exit with a classic goto out instruction.
> 
> Signed-off-by: Matteo Croce <mcroce@redhat.com>
> ---
>  ip/ipaddress.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> index 6c306ab7..b7b78f6e 100644
> --- a/ip/ipaddress.c
> +++ b/ip/ipaddress.c
> @@ -1920,7 +1920,7 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
>  			exit(1);
>  		}
>  		delete_json_obj();
> -		exit(0);
> +		goto out;
>  	}
>  
>  	if (filter.family != AF_PACKET) {

Applied

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-08 18:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-03 17:49 [PATCH iproute2] ip link: don't stop batch processing Matteo Croce
2018-08-03 18:08 ` Dave Taht
2018-08-08 16:26   ` Stephen Hemminger
2018-08-08 16:27 ` Stephen Hemminger

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).