Fix race in losetup Retry acquiring a loop device if set_loop failed with EBUSY Signed-Off-By: Matthias Koenig <mkoenig@xxxxxxx> Index: util-linux-devel/mount/lomount.c =================================================================== --- util-linux-devel.orig/mount/lomount.c +++ util-linux-devel/mount/lomount.c @@ -558,6 +558,7 @@ main(int argc, char **argv) { usage(); } +retry_find_loop: if (all) return show_used_loop_devices(); else if (find) { @@ -591,6 +592,11 @@ main(int argc, char **argv) { res = set_loop(device, file, off, encryption, pfd, &ro); if (res == 0 && showdev && find) { printf("%s\n", device); + } else if (res == 2 && find) { + if (verbose) + printf("stolen loop=%s...trying again\n", + device); + goto retry_find_loop; } } return res; - To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html