]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm/incremental: set sysfs name after assembling imsm array
authorXiao Ni <xni@redhat.com>
Sun, 25 Jan 2026 08:50:58 +0000 (16:50 +0800)
committerMariusz Tkaczyk <mtkaczyk@kernel.org>
Mon, 16 Feb 2026 16:05:12 +0000 (17:05 +0100)
The sysfs name is not set after assembling imsm array. So sysfs_uevent
can't send the change event. The raid device's state depends on the
genuine events from the kernel. If the kernel geniune event is sent
after udev_unblock, the raid can be ready on time. Then the it can be
mounted during boot rightly. If the kernel geniune event is sent
before udev_unblock, the mount will fail during boot.

Signed-off-by: <xni@redhat.com>
Incremental.c

index b05a52f602500edc199a774fd4bc6f845a13f0a5..28f95a7d5b5f6c6e085f966f96e4d76fb9796ee5 100644 (file)
@@ -1528,6 +1528,7 @@ static int Incremental_container(struct supertype *st, char *devname,
        for (ra = list ; ra ; ra = ra->next) {
                int mdfd = -1;
                char chosen_name[1024];
+               char *sysname;
                struct map_ent *mp;
                struct mddev_ident *match = NULL;
 
@@ -1620,6 +1621,8 @@ static int Incremental_container(struct supertype *st, char *devname,
                                           chosen_name, &result);
                map_free(map);
                map = NULL;
+               sysname = fd2devnm(mdfd);
+               strncpy(info.sys_name, sysname, sizeof(sysname) - 1);
                close_fd(&mdfd);
                udev_unblock();
                sysfs_uevent(&info, "change");