All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Roy Vardi <royv@ezchip.com>
Cc: "stefanha@redhat.com" <stefanha@redhat.com>,
	"armbru@redhat.com" <armbru@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"lcapitulino@redhat.com" <lcapitulino@redhat.com>,
	Noam Camus <noamc@ezchip.com>,
	"aliguori@amazon.com" <aliguori@amazon.com>
Subject: Re: [Qemu-devel] [PATCH] net: Add persistent flag to -net tap option
Date: Sun, 04 Jan 2015 15:28:53 +0800	[thread overview]
Message-ID: <54A8EBB5.10508@redhat.com> (raw)
In-Reply-To: <AM2PR02MB05322F5222182C2E8F385DE9AA510@AM2PR02MB0532.eurprd02.prod.outlook.com>


On 12/29/2014 03:38 PM, Roy Vardi wrote:
>
>  
>
>  
>
> > -----Original Message-----
>
> > From: Jason Wang [mailto:jasowang@redhat.com]
>
> > Sent: Tuesday, December 23, 2014 11:13 AM
>
> > To: Roy Vardi
>
> > Cc: qemu-devel@nongnu.org; stefanha@redhat.com; Noam Camus;
>
> > armbru@redhat.com; aliguori@amazon.com; lcapitulino@redhat.com
>
> > Subject: Re: [Qemu-devel] [PATCH] net: Add persistent flag to -net
> tap option
>
> >
>
> >
>
> >
>
> > On Tue, Dec 23, 2014 at 4:44 PM, Roy Vardi <royv@ezchip.com
> <mailto:royv@ezchip.com>> wrote:
>
> > >
>
> > >
>
> > >>  -----Original Message-----
>
> > >>  From: Jason Wang [mailto:jasowang@redhat.com]
>
> > >>  Sent: Monday, December 22, 2014 8:33 AM
>
> > >>  To: Roy Vardi; qemu-devel@nongnu.org <mailto:qemu-devel@nongnu.org>
>
> > >>  Cc: aliguori@amazon.com <mailto:aliguori@amazon.com>;
> armbru@redhat.com <mailto:armbru@redhat.com>; lcapitulino@redhat.com
> <mailto:lcapitulino@redhat.com>;
>
> > >> Noam Camus; stefanha@redhat.com <mailto:stefanha@redhat.com>
>
> > >>  Subject: Re: [Qemu-devel] [PATCH] net: Add persistent flag to -net
>
> > >> tap option
>
> > >>
>
> > >>
>
> > >>  On 12/21/2014 03:48 PM, Roy Vardi wrote:
>
> > >>  > From: Roy Vardi <royv@ezchip.com <mailto:royv@ezchip.com>>
>
> > >>  >
>
> > >>  >     Add 'persistent' boolean flag to -net tap option.
>
> > >>  >     When set to off - tap interface will be released on shutdown
>
> > >>  >     When set to on\not specified - tap interface will remain
>
> > >>
>
> > >>  I'm interested of the user cases in the case. Usually, persistent
>
> > >> flag was used to  let privileged application to create/configure the
>
> > >> device and then it could be  used by non-privileged users. If qemu
>
> > >> has already had privilege, why need set  persistent in this case?
>
> > >
>
> > > We're running qemu as users, non-privilege...
>
> > > Our work flow includes:
>
> > > 1. Running an internal tool for opening a persistent tap interface 2.
>
> > > Running qemu with the tap interface we got from above Our environment
>
> > > includes a lot of such qemu runs, and we want to avoid "zombie" tap
>
> > > interfaces, and we achieve it with this new flag I've added.
>
> >
>
> > I get the case, thanks for the explaining. But qemu has already had
> method to
>
> > solve this. Try downscript for tap, this external script can do
> cleanup before
>
> > closing tap fd.
>
> >
>
> > E.g. in your case, you may need to run tunctl -d.
>
>  
>
> Thanks for the reference.
>
> I've checked the downscript option, but found it unsuitable for us:
> Qemu runs the downscript before closing the fd, so a script which
> removes the interface will fail due to busy device.
>

Right, tunctl needs another TUNSETIFF ioctl(). You may want to delete it
through ip link del link dev $1 in your qemu-ifdown.
>
> I've changed the order in the qemu code so that the script is called
> after the descriptor is closed and it works for us.
>
>  
>
> What do you think about the following patch:
>
>  
>

This change behaviour which may break existing down scripts.

Thanks
>
> --- a/net/tap.c
>
> +++ b/net/tap.c
>
> @@ -296,12 +296,11 @@ static void tap_cleanup(NetClientState *nc)
>
>      qemu_purge_queued_packets(nc);
>
> -    if (s->down_script[0])
>
> -        launch_script(s->down_script, s->down_script_arg, s->fd);
>
> -
>
>      tap_read_poll(s, false);
>
>      tap_write_poll(s, false);
>
>      close(s->fd);
>
> +    if (s->down_script[0])
>
> +        launch_script(s->down_script, s->down_script_arg, s->fd);
>
>      s->fd = -1;
>
> }
>
>  
>
> ?
>
>  
>
> Thanks,
>
> Roy Vardi
>

  reply	other threads:[~2015-01-04  7:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-21  7:48 [Qemu-devel] [PATCH] net: Add persistent flag to -net tap option Roy Vardi
2014-12-22  6:33 ` Jason Wang
2014-12-23  8:44   ` Roy Vardi
     [not found]     ` <AM2PR02MB0532BC1703B005CE79A141FCAA570@AM2PR02MB0532.eurprd02.prod.outlook .com>
2014-12-23  9:13       ` Jason Wang
2014-12-29  7:38         ` Roy Vardi
2015-01-04  7:28           ` Jason Wang [this message]
2015-01-18  9:42             ` Roy Vardi
2015-01-22 15:25 ` Eric Blake
  -- strict thread matches above, loose matches on Subject: below --
2014-12-15 12:05 Roy Vardi
2014-12-19 13:13 ` Stefan Hajnoczi
2014-12-19 13:18   ` Daniel P. Berrange
2014-12-21  7:17   ` Roy Vardi
2015-01-06 11:58     ` Stefan Hajnoczi
2014-12-19 15:29 ` Eric Blake

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=54A8EBB5.10508@redhat.com \
    --to=jasowang@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=noamc@ezchip.com \
    --cc=qemu-devel@nongnu.org \
    --cc=royv@ezchip.com \
    --cc=stefanha@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.