On Sat, Nov 05, 2005 at 06:31:04PM +0100, Kay Sievers wrote:
> I've got these messages several times on the experimental SUSE too,
> but can't reproduce it so far, even without Rusty's patch to modprobe
> they have disappeared. See here for the details:
>   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=333052


Just to let you know, I've also met this problem (on another distro), 
and did not know about this bugreport until now.
So I've done another workaround: modprobe already parses /proc/modules 
to check whether the modules needed are already loaded, and this file 
also shows us the state of the modules, being "Loading", "Live" or 
"Unloading".

With my patch, modprobe waits until the needed modules come out of the 
"Loading" or "Unloading" state.


-- 
pozsy


--- module-init-tools-3.2-pre4.orig/modprobe.c  2005-05-08 09:38:52.000000000 
+0200
+++ module-init-tools-3.2-pre4/modprobe.c       2005-10-24 13:19:39.000000000 
+0200
@@ -363,6 +363,7 @@
        FILE *proc_modules;
        char *line;
 
+start:
        /* Might not be mounted yet.  Don't fail. */
        proc_modules = fopen("/proc/modules", "r");
        if (!proc_modules)
@@ -373,12 +374,31 @@
 
                if (entry && strcmp(entry, modname) == 0) {
                        /* If it exists, usecount is the third entry. */
-                       if (usecount) {
-                               entry = strtok(NULL, " \n");
-                               if (entry
-                                   && (entry = strtok(NULL, " \n")) != NULL)
+                       if (!(entry = strtok(NULL, " \n")))
+                               goto out;
+
+                       if (!(entry = strtok(NULL, " \n"))) /* usecount */
+                               goto out;
+                       else
+                               if (usecount)
                                        *usecount = atoi(entry);
+
+                       if (!(entry = strtok(NULL, " \n"))) /* "-" */
+                               goto out;
+
+                       if (!(entry = strtok(NULL, " \n"))) /* status */
+                               goto out;
+                       else {
+                               if (!strcmp(entry, "Loading") || !strcmp(entry, 
"Unloading")) {
+                                       usleep(100000);
+                                       free(line);
+                                       fclose(proc_modules);
+                                       goto start;
+                               }
+                               goto out;
                        }
+
+               out:
                        free(line);
                        fclose(proc_modules);
                        return 1;


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to