On Thu, 9 Mar 2023 22:47:27 +0800 miaoguanqin <miaoguanqin@xxxxxxxxxx> wrote: > After the /dev/mdx is created,we can see that /dev/mdx file is > created.When we reboot machines,we found /dev/md/x will be created, > and map file will be rebuild and changed. > > During RAID rebuild after the reboot, we found /dev/md/x is created > with high priority. To consistent behavior, we think that /dev/md/x > should also be created when creating devices. > > We modified the logic for creating /dev/mdx,creating /dev/md/x at > the same time. > > Signed-off-by: miaoguanqin <miaoguanqin@xxxxxxxxxx> > Signed-off-by: Lixiaokeng <lixiaokeng@xxxxxxxxxx> > --- > mdopen.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/mdopen.c b/mdopen.c > index 98c54e4..d128396 100644 > --- a/mdopen.c > +++ b/mdopen.c > @@ -373,11 +373,12 @@ int create_mddev(char *dev, char *name, int autof, > int trustworthy, > > sprintf(devname, "/dev/%s", devnm); > > - if (dev && dev[0] == '/') > - strcpy(chosen, dev); > - else if (cname[0] == 0) > - strcpy(chosen, devname); > - > + if (strncmp(chosen, "/dev/md/", 8) != 0) { > + if (dev && dev[0] == '/') > + strcpy(chosen, dev); > + else if (cname[0] == 0) > + strcpy(chosen, devname); > + } > /* We have a device number and name. > * If we cannot detect udev, we need to make > * devices and links ourselves. Hi miaoguanqin, Could you please share command used to create? If you are using: #mdadm --create /dev/mdX Then it is know issue (at least for me). Please use: #mdadm --create /dev/md/X I know that the interface is not consistent but I don't see you solution are good fix. The create_mddev() is over complicated. Did you run this test: https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/tests/00createnames I think that it didn't passed- so we could have a regression. BTW. I believe that "miaoguanqin" it is your real name, why lowercase? Thanks, Mariusz