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

Daniel P. Berrangé berrange at redhat.com
Fri Jun 19 16:26:32 UTC 2020


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 problem is that the kernel reuses tap device names.

Can we just take the kernel out of the equation and do auto-assignment
of names ourselves.

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 around and risking a collision
with a concurrently shutting down guest.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list