[PATCH] network: Fix a race condition when shutdown & start vm at the same time

2020-06-11 Thread Bingsong Si
when shutdown vm, the qemuProcessStop cleanup virtual interface in two steps: 1. qemuProcessKill kill qemu process, and vif disappeared 2. ovs-vsctl del-port from the brige if start a vm in the middle of the two steps, the new vm will reused the vif, but removed from bridge by step 2 Signed-off-b

Re: [PATCH] network: Fix a race condition when shutdown & start vm at the same time

2020-06-15 Thread Daniel Henrique Barboza
On 6/11/20 6:58 AM, Bingsong Si wrote: when shutdown vm, the qemuProcessStop cleanup virtual interface in two steps: s/when/When 1. qemuProcessKill kill qemu process, and vif disappeared 2. ovs-vsctl del-port from the brige if start a vm in the middle of the two steps, the new vm will reu

Re: [PATCH] network: Fix a race condition when shutdown & start vm at the same time

2020-06-16 Thread Laine Stump
(BTW, this other patch is also trying to solve the same problem: https://www.redhat.com/archives/libvir-list/2020-June/msg00525.html I made comments there earlier, and have learned a bit more since then: https://www.redhat.com/archives/libvir-list/2020-June/msg00634.html On 6/15/20 2:36 PM

Re: [PATCH] network: Fix a race condition when shutdown & start vm at the same time

2020-06-17 Thread owen.si
Thanks for your detailed analysis, I will remake a patch 发件人: Laine Stump 发送时间: Wednesday, June 17, 2020 7:46 AM 收件人: libvir-list@redhat.com 抄送: Daniel Henrique Barboza; Bingsong Si; Wei Gong 主题: Re: [PATCH] network: Fix a race condition when shutdown & start vm at the same time (BTW,

Re: [PATCH] network: Fix a race condition when shutdown & start vm at the same time

2020-06-19 Thread Michal Privoznik
On 6/17/20 1:46 AM, Laine Stump wrote: What do I think should be done? Good question. Possibly we could: A) Call virNetDevTapReattachBridge() rather than virNetDevTapAttachBridge() in virNetDevTapCreateInBridgePort(). This would eliminate problem (2). B) Instead of checking if the tap de

Re: [PATCH] network: Fix a race condition when shutdown & start vm at the same time

2020-06-19 Thread Laine Stump
On 6/19/20 12:00 PM, Michal Privoznik wrote: On 6/17/20 1:46 AM, Laine Stump wrote: What do I think should be done? Good question. Possibly we could: A) Call virNetDevTapReattachBridge() rather than virNetDevTapAttachBridge() in virNetDevTapCreateInBridgePort(). This would eliminate proble

Re: [PATCH] network: Fix a race condition when shutdown & start vm at the same time

2020-06-19 Thread Daniel P . Berrangé
On Fri, Jun 19, 2020 at 12:19:05PM -0400, Laine Stump wrote: > > This would all be much simpler if the kernel would put a "FIN WAIT" state on > all tap device names so that they couldn't be re-used for a few seconds > after deletion, but it doesn't, so we have to work with what we've got. The pro

Re: [PATCH] network: Fix a race condition when shutdown & start vm at the same time

2020-06-19 Thread Laine Stump
On 6/19/20 12:26 PM, Daniel P. Berrangé wrote: On Fri, Jun 19, 2020 at 12:19:05PM -0400, Laine Stump wrote: This would all be much simpler if the kernel would put a "FIN WAIT" state on all tap device names so that they couldn't be re-used for a few seconds after deletion, but it doesn't, so we h

Re: [PATCH] network: Fix a race condition when shutdown & start vm at the same time

2020-06-19 Thread Daniel P . Berrangé
On Fri, Jun 19, 2020 at 01:06:33PM -0400, Laine Stump wrote: > On 6/19/20 12:26 PM, Daniel P. Berrangé wrote: > > Maintain a global "int nextTapID" counter, and just iterate on this. > > NIC names can be upto 16 bytes, so we'll create billions of devices > > before we have any chance of wrapping ar

Re: [PATCH] network: Fix a race condition when shutdown & start vm at the same time

2020-06-24 Thread Laine Stump
On 6/19/20 1:16 PM, Daniel P. Berrangé wrote: On Fri, Jun 19, 2020 at 01:06:33PM -0400, Laine Stump wrote: On 6/19/20 12:26 PM, Daniel P. Berrangé wrote: Maintain a global "int nextTapID" counter, and just iterate on this. NIC names can be upto 16 bytes, so we'll create billions of devices befo

回复: [PATCH] network: Fix a race condition when shutdown & start vm at the same time

2020-06-15 Thread owen.si
Thanks for your review, I will fix in version 2. 发件人: Daniel Henrique Barboza 发送时间: 2020年6月16日星期二 上午2:36 收件人: Bingsong Si; libvir-list@redhat.com 主题: Re: [PATCH] network: Fix a race condition when shutdown & start vm at the same time On 6/11/20 6:58 AM, Bingsong Si wrote: > when shut