]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect-image: wait for udev for single filesystem images too
authorLuca Boccassi <luca.boccassi@microsoft.com>
Wed, 3 Jun 2020 18:47:39 +0000 (19:47 +0100)
committerLuca Boccassi <luca.boccassi@microsoft.com>
Mon, 8 Jun 2020 12:06:53 +0000 (13:06 +0100)
Single filesystem images are mounted from the /dev/block/X:Y symlink
rather than /dev/loopZ, so we need to wait for udev to create it or
mounting will be racy and occasionally fail.

src/shared/dissect-image.c

index 8decac94b2238fd74011a57a66ae1357aa4c77f9..8eb17c99997a553ddfbf54bb086bd484af81236a 100644 (file)
@@ -424,11 +424,11 @@ int dissect_image(
 
                         m->encrypted = streq_ptr(fstype, "crypto_LUKS");
 
-                        if (!streq(usage, "filesystem")) {
-                                r = loop_wait_for_partitions_to_appear(fd, d, 0, flags, &e);
-                                if (r < 0)
-                                        return r;
-                        }
+                        /* Even on a single partition we need to wait for udev to create the
+                         * /dev/block/X:Y symlink to /dev/loopZ */
+                        r = loop_wait_for_partitions_to_appear(fd, d, 0, flags, &e);
+                        if (r < 0)
+                                return r;
                         *ret = TAKE_PTR(m);
 
                         return 0;