chiark / gitweb /
[PATCH] reverse order of scanning of udevstart to look at class before block.
authorgreg@kroah.com <greg@kroah.com>
Sat, 26 Jun 2004 08:08:47 +0000 (01:08 -0700)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:36:21 +0000 (21:36 -0700)
this should fix the startup issue for lvm, hopefully...

udevstart.c

index 1d9b604..2d11ede 100644 (file)
@@ -87,8 +87,13 @@ static void udev_scan(void)
        DIR *dir;
        struct dirent *dent;
 
-       devpath = "block";
-       dir = opendir(SYSBLOCK);
+       /* 
+        * We want to scan the class tree first as lvm and dm needs to be able
+        * to have access to the char control device when probing the block
+        * devices.
+        */
+       devpath = "class";
+       dir = opendir(SYSCLASS);
        if (dir != NULL) {
                for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
                        char dirname[MAX_PATHLEN];
@@ -99,15 +104,12 @@ static void udev_scan(void)
                            (strcmp(dent->d_name, "..") == 0))
                                continue;
 
-                       snprintf(dirname, MAX_PATHLEN, "/block/%s", dent->d_name);
-                       dirname[MAX_PATHLEN-1] = '\0';
-                       udev_exec(dirname, "block");
-
-                       snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSBLOCK, dent->d_name);
+                       snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSCLASS, dent->d_name);
+                       dirname[MAX_PATHLEN] = '\0';
                        dir2 = opendir(dirname);
                        if (dir2 != NULL) {
                                for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) {
-                                       char dirname2[MAX_PATHLEN];
+                                       char dirname2[MAX_PATHLEN-1];
                                        DIR *dir3;
                                        struct dirent *dent3;
 
@@ -124,10 +126,10 @@ static void udev_scan(void)
                                                        char filename[MAX_PATHLEN];
 
                                                        if (strcmp(dent3->d_name, "dev") == 0) {
-                                                               snprintf(filename, MAX_PATHLEN, "/block/%s/%s",
+                                                               snprintf(filename, MAX_PATHLEN, "/class/%s/%s",
                                                                         dent->d_name, dent2->d_name);
                                                                filename[MAX_PATHLEN-1] = '\0';
-                                                               udev_exec(filename, "block");
+                                                               udev_exec(filename, dent->d_name);
                                                        }
                                                }
                                                closedir(dir3);
@@ -139,8 +141,8 @@ static void udev_scan(void)
                closedir(dir);
        }
 
-       devpath = "class";
-       dir = opendir(SYSCLASS);
+       devpath = "block";
+       dir = opendir(SYSBLOCK);
        if (dir != NULL) {
                for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
                        char dirname[MAX_PATHLEN];
@@ -151,12 +153,15 @@ static void udev_scan(void)
                            (strcmp(dent->d_name, "..") == 0))
                                continue;
 
-                       snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSCLASS, dent->d_name);
-                       dirname[MAX_PATHLEN] = '\0';
+                       snprintf(dirname, MAX_PATHLEN, "/block/%s", dent->d_name);
+                       dirname[MAX_PATHLEN-1] = '\0';
+                       udev_exec(dirname, "block");
+
+                       snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSBLOCK, dent->d_name);
                        dir2 = opendir(dirname);
                        if (dir2 != NULL) {
                                for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) {
-                                       char dirname2[MAX_PATHLEN-1];
+                                       char dirname2[MAX_PATHLEN];
                                        DIR *dir3;
                                        struct dirent *dent3;
 
@@ -173,10 +178,10 @@ static void udev_scan(void)
                                                        char filename[MAX_PATHLEN];
 
                                                        if (strcmp(dent3->d_name, "dev") == 0) {
-                                                               snprintf(filename, MAX_PATHLEN, "/class/%s/%s",
+                                                               snprintf(filename, MAX_PATHLEN, "/block/%s/%s",
                                                                         dent->d_name, dent2->d_name);
                                                                filename[MAX_PATHLEN-1] = '\0';
-                                                               udev_exec(filename, dent->d_name);
+                                                               udev_exec(filename, "block");
                                                        }
                                                }
                                                closedir(dir3);
@@ -189,7 +194,6 @@ static void udev_scan(void)
        }
 }
 
-
 int main(int argc, char *argv[], char *envp[])
 {
        init_logging("udevstart");