]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virnetdevmacvlan: Drop udev busy loop from virNetDevMacVLanTapOpen()
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 8 Apr 2026 11:57:37 +0000 (13:57 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 14 Apr 2026 08:02:19 +0000 (10:02 +0200)
Now that after previous commit the wait for udev to settle down
is done right after device creation, there's no need to have
additional wait in virNetDevMacVLanTapOpen(). It's effectively a
dead code. Remove it.

Tested-by: Johannes Segitz <jsegitz@suse.de>
Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/util/virnetdevmacvlan.c

index e7e27b57fd7f6a8aa4730a718b1718cc4710b02a..c981afad5a2cb74989c61ac0b052b57b68d5bb12 100644 (file)
@@ -160,7 +160,6 @@ virNetDevMacVLanTapOpen(const char *ifname,
                         int *tapfd,
                         size_t tapfdSize)
 {
-    int retries = 10;
     int ret = -1;
     int ifindex;
     size_t i = 0;
@@ -174,20 +173,13 @@ virNetDevMacVLanTapOpen(const char *ifname,
     for (i = 0; i < tapfdSize; i++) {
         int fd = -1;
 
-        while (fd < 0) {
-            if ((fd = open(tapname, O_RDWR)) >= 0) {
-                tapfd[i] = fd;
-            } else if (retries-- > 0) {
-                /* may need to wait for udev to be done */
-                g_usleep(20000);
-            } else {
-                /* However, if haven't succeeded, quit. */
-                virReportSystemError(errno,
-                                     _("cannot open macvtap tap device %1$s"),
-                                     tapname);
-                goto cleanup;
-            }
+        if ((fd = open(tapname, O_RDWR)) < 0) {
+            virReportSystemError(errno,
+                                 _("cannot open macvtap tap device %1$s"),
+                                 tapname);
+            goto cleanup;
         }
+        tapfd[i] = fd;
     }
 
     ret = 0;