Skip to contentSkip to conversation

2.6: races between modprobe and depmod in rc.sysinit

PATCH In review Andrey Borzenkov 2 participants 5 messages Jul 31, 2003 – Aug 8, 2003

lore
Share & tools
lore
#0 lore raw

This started when I noticed that coldplugging of my USB flash did not work. I added call to /etc/hotplug/usb.rc in rc.sysinit but it still did not work because scsi.agent was not ready for 2.6. I fixed scsi.agent to work for 2.6
- and it still did not work with nice message "sd_mod not found". I added strace to scsi.agent - and wow! it opens /lib/modules/uname -r/modules.dep and reads 0 bytes ... it adds /lib/modules/uname -r/modules.alias -and read 0 bytes ...

the only reason I can imagine is that it hits depmod -A that runs in rc.sysinit and does

truncate /lib/modules/uname -r/modules.*
scan modules
write files

So, quesitons

- would anybody (Rusty?) object if I change depmod to do build temp name
move temp name into original

to avoid such races?

- Chmouel, Fred - is depmod on every boot really neccessary? When people install modules they are expected to run it actually ...

-andrey

#1 lore raw

In message <[email protected]> you write:

Quoted 7 lines

the only reason I can imagine is that it hits depmod -A that runs in rc.sysinit and does

truncate /lib/modules/uname -r/modules.*
scan modules
write files

Quoted 5 lines

So, quesitons

- would anybody (Rusty?) object if I change depmod to do build temp name
move temp name into original

No, that's definitely my preferred method anyway: please send patch. Although I double this causes your problem here.

Quoted 2 lines

- Chmouel, Fred - is depmod on every boot really neccessary? When people install modules they are expected to run it actually ...

People get it wrong, and you still want them to boot. Increasingly we can live without depmod though: I might fix this in a near-future version to live without it.

Cheers,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

#2 lore raw

PATCH 1/1 2.6: races between modprobe and depmod in rc.sysinit

Quoted 8 lines · Rusty Russell

In message <[email protected]> you write:

Quoted 7 lines

the only reason I can imagine is that it hits depmod -A that runs in rc.sysinit and does

truncate /lib/modules/uname -r/modules.*
scan modules
write files

Quoted 9 lines
Quoted 5 lines

So, quesitons

- would anybody (Rusty?) object if I change depmod to do build temp name
move temp name into original

No, that's definitely my preferred method anyway: please send patch. Although I double this causes your problem here.

this does :) I have seen even more incredible races during boot recently. It affects other modules as well, like input loaded by hotplug triggered by USB load. depmod on current 2.6 takes some not negligible time.

anyway here is patch against 0.9.13-pre that makes depmod output in temp file and rename it after. It fixed the problem for sure for me (like commenting out depmod in rc.sysinit did but most people seem to object to it).

Quoted 7 lines
Quoted 2 lines

- Chmouel, Fred - is depmod on every boot really neccessary? When people install modules they are expected to run it actually ...

People get it wrong, and you still want them to boot. Increasingly we can live without depmod though: I might fix this in a near-future version to live without it.

would be nice.

-andrey

#3 lore raw

In message <[email protected]> you write:

Quoted 3 lines

anyway here is patch against 0.9.13-pre that makes depmod output in temp file and rename it after. It fixed the problem for sure for me (like commenting out depmod in rc.sysinit did but most people seem to object to it).

Thanks, I've applied this with a fix (you left the declaration of skipchars in main(), so it shadowed the new global one).

I also repaired the testsuite after this patch (and found another bug along the way), which also would have caught the mistake (Hint hint!).

I've put the lot up in the usual place, masquerading as 0.9.13-pre2.

	http://www.kernel.org/pub/linux/kernel/people/rusty/modules/module-init-tools-0.9.13-pre2.tar.gz

Feedback welcome!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

#4 lore raw
Quoted 6 lines · Rusty Russell

In message <[email protected]> you write:

Quoted 4 lines

anyway here is patch against 0.9.13-pre that makes depmod output in temp file and rename it after. It fixed the problem for sure for me (like commenting out depmod in rc.sysinit did but most people seem to object to it).

Quoted 6 lines

Thanks, I've applied this with a fix (you left the declaration of skipchars in main(), so it shadowed the new global one).

I also repaired the testsuite after this patch (and found another bug along the way), which also would have caught the mistake (Hint hint!).

thank you :)

Quoted 6 lines

I've put the lot up in the usual place, masquerading as 0.9.13-pre2.

http://www.kernel.org/pub/linux/kernel/people/rusty/modules/module-init-to
ols-0.9.13-pre2.tar.gz

Feedback welcome!

runs just fine. May I humbly ask for consistent naming scheme in future? Jumping from "pre" to "pre2" does not make packaging task easier :)

-andrey