qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mark McLoughlin <markmc@redhat.com>
To: Juergen Lock <nox@jelal.kn-bremen.de>
Cc: freebsd-emulation@freebsd.org, qemu-devel@nongnu.org
Subject: Re: close tapfd before running down_script [was Re: [Qemu-devel] ANNOUNCE: Release 0.11.0-rc2 of QEMU]
Date: Sun, 06 Sep 2009 13:50:25 +0100	[thread overview]
Message-ID: <1252241425.3191.81.camel@blaa> (raw)
In-Reply-To: <20090904201347.GA77929@triton8.kn-bremen.de>

On Fri, 2009-09-04 at 22:13 +0200, Juergen Lock wrote:

>  The second change is a small patch to tap_cleanup that makes it close
> the tap fd before calling the ifdown script instead of after, otherwise
> FreeBSD's tap driver may hit a KASSERT in case the ifdown script does
> something like an `ifconfig tap0 destroy'...
> 
> Index: qemu/net.c
> @@ -1643,12 +1643,13 @@ static void tap_cleanup(VLANClientState 
>  
>      qemu_purge_queued_packets(vc);
>  
> -    if (s->down_script[0])
> -        launch_script(s->down_script, s->down_script_arg, s->fd);
> -
>      tap_read_poll(s, 0);
>      tap_write_poll(s, 0);
>      close(s->fd);
> +
> +    if (s->down_script[0])
> +        launch_script(s->down_script, s->down_script_arg, -1);
> +
>      qemu_free(s);
>  }
>  
>  I don't know if there are use cases where the ifdown script needs the
> tap fd still open, otherwise I guess this can also be committed upstream.
> And in case you want to: :)
> 
>  Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>

I don't ever use the the down script myself, but a couple of things to
bear in mind:

  a) 0.9.1 never actually closed the tap fd and since 0.10.0 we've 
     been closing the fd after calling the script

  b) where qemu creates the tap interface, by closing the tap fd before 
     the script we'd be destroying the interface before passing the 
     interface name to the script

The current behaviour seems right to me. Could you explain your use case
a bit more? Maybe post the up and down scripts?

Cheers,
Mark.

  reply	other threads:[~2009-09-06 12:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-04 13:52 [Qemu-devel] ANNOUNCE: Release 0.11.0-rc2 of QEMU Anthony Liguori
2009-09-04 20:13 ` Juergen Lock
2009-09-06 12:50   ` Mark McLoughlin [this message]
2009-09-06 15:43     ` close tapfd before running down_script [was Re: [Qemu-devel] ANNOUNCE: Release 0.11.0-rc2 of QEMU] Juergen Lock
2009-09-06 15:47 ` [Qemu-devel] ANNOUNCE: Release 0.11.0-rc2 of QEMU Pasi Kärkkäinen

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=1252241425.3191.81.camel@blaa \
    --to=markmc@redhat.com \
    --cc=freebsd-emulation@freebsd.org \
    --cc=nox@jelal.kn-bremen.de \
    --cc=qemu-devel@nongnu.org \
    /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).