Skip to contentSkip to conversation

Only retry mapping pages when ENOENT is returned

PATCH In review Andres Lagar-Cavilla 2 participants 2 messages Jan 9, 2012 – Jan 10, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Only retry mapping pages when ENOENT is returned

 tools/libxc/xc_linux_osdep.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

If the return value from the ioctl() is not ENOENT, it's possible that err[i] will not be updated and libxc will just loop forever. Although it's unlikely that err[i] would not be updated after the ioctl() gets through at least once, it's better to be defensive.

tools/libxc/xc_linux_osdep.c +1 -1
diff -r 2a2f3597d156 -r 90f764bf02c3 tools/libxc/xc_linux_osdep.c
@@ -232,7 +232,7 @@ static void *linux_privcmd_map_foreign_b
             do {
                 usleep(100);
                 rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx);
-            } while ( rc < 0 && err[i] == -ENOENT );
+            } while ( rc < 0 && errno == ENOENT && err[i] == -ENOENT );
         }
     }
#1 lore raw

Andres Lagar-Cavilla writes ("[PATCH] Only retry mapping pages when ENOENT is returned"):

Quoted 4 lines

If the return value from the ioctl() is not ENOENT, it's possible that err[i] will not be updated and libxc will just loop forever. Although it's unlikely that err[i] would not be updated after the ioctl() gets through at least once, it's better to be defensive.