Re: Processes not waiting for kerneld (patch included)

Michael Nonweiler (mrn20@cam.ac.uk)
Wed, 1 May 1996 17:27:08 +0100 (BST)


On Wed, 1 May 1996, Michael Meskes wrote:

> It appears that mount isn't waiting for kerneld anymore. I don't know if
> this is a bug in mount or in the kernel. However, it did work with an older
> version of both.
>
> What happens is that trying to mount a WIN95 or UMSDOS or simply MSDOS
> partition doesn't work at the first try. However, kerneld does load the
> modules and trying for the second time the mount works well, unless of
> course I wait too long and the module has been removed already.

I also had this problem. It is caused by a bug in the modprobe program.
When the mount system call looks for a filesystem, if it can't find it in
memory, it will call kerneld. Kerneld then forks and runs modprobe.

With normal operation kerneld would then pass modprobe's return value on to
the kernel. "sys_mount" waits for this return value. If it is non-zero,
(failure) the kernel gives up, and the mount fails. If kerneld returns
zero, the kernel rescans the list of filesystems.

Recent versions of modprobe have started to return -1 with successful
module loading, and this causes the problem you describe.

The following patch to modules-1.3.69f/depmod/modprobe.c fixes this:
--CUT HERE--
--- depmod/modprobe.c.orig Wed May 1 16:11:50 1996
+++ depmod/modprobe.c Wed May 1 16:43:51 1996
@@ -390,7 +390,8 @@
const char *type,
int loadall)
{
- int ret = -1;
+ int ret = -1; /* reset (to 0) after a successful load */
+ int failed = 0; /* set after a failed load */
int i;
for (i=0; i<nb; i++){
NODE *newin_kernel = NULL;
@@ -411,17 +412,23 @@
int nbl = config_locate (list[i],tbpath,type);
if (nbl == 0){
depmod_error ("Can't locate module %s",list[i]);
+ failed = 1;
}else{
int m;
- for (m=0; m<nbl; m++)
- if (dep.insmod (tbpath[m],&newin_kernel,&list[i]) == 0)
+ for (m=0; m<nbl; m++) {
+ if (dep.insmod (tbpath[m],&newin_kernel,&list[i]) == 0) {
+ ret = 0;
if (!loadall) break;
+ } else
+ failed = 1;
+ }
tbstr_free (tbpath,nbl);
}
}
delete newin_kernel;
if (ret == 0 && !loadall) break;
}
+ if (failed && loadall) ret = -1;
return ret;
}
/*
--CUT HERE--

PS. To the maintainers:
The "clean" target in kerneld/Makefile should rm "$(UTILS)".

PPS. Michael: A "rm -r debian-tmp" would be a nice addition to the
start of the binary target in your debian.rules file :) - cheers!

--
Michael Nonweiler <mrn20@cam.ac.uk>
Trinity College, Cambridge, England.