Skip to contentSkip to conversation

udev/modprobe issue

DISCUSSION Nico Schottelius 3 participants 3 messages Sep 29, 2005 – Oct 2, 2005

lore
Share & tools
lore
#0 lore raw

Good morning everybody!

I've a small problem with loading the sata_sil module, but it could be a general issue: We use this sata-kontroller with sata-harddisks to backup our systems. The harddisk is exchanged (while the system is running) every day. So we load/unload sata_sil in our backup scripts, so 'hotplugging' is possible.

My problem is, that modprobe returns earlier than the attached device is usable:

----------------------------------------------------------------------

srwali01:/# modprobe sata_sil; mount /dev/sda1 /mnt/hdbackup/
mount: you must specify the filesystem type
srwali01:/# rmmod sata_sil
srwali01:/# modprobe sata_sil; ls -l /dev/sda1               
ls: /dev/sda1: No such file or directory
----------------------------------------------------------------------

So I have to do

----------------------------------------------------------------------

srwali01:/# modprobe sata_sil
srwali01:/# sleep 2
srwali01:/# mount /dev/sda1 /mnt/hdbackup
----------------------------------------------------------------------

The problem is most likely that udev is too slow or that modprobe does not know/wait for udev:

----------------------------------------------------------------------

srwali01:/# mount | grep tmpfs | grep -v /dev/shm
tmpfs on /dev type tmpfs (rw,size=10M,mode=0755)
srwali01:/# cat /proc/sys/kernel/hotplug 
/sbin/udevsend
----------------------------------------------------------------------

My questions:

- Should modprobe wait for whatever current hotplug is so that the system can definitly use the device after modprobe?
- Or should there be a command-line switch to modprobe to tell it to wait for hotplug?
- Is the 'wait for hotplug'-idea possible to do or would it have to be a dirty hack in the kernel?
- Is there clean solution to wait exactly as long as
it needs to load sata_sil and create /dev/sda*?
Using while+ls monitoring /dev/sda* is not a solution imho.

Greetings,

Nico

P.S.: Sorry for crossposting, I am not really sure which list would have been
the correct one to ask.

Signature · 2 lines
Latest project: cconfig (http://nico.schotteli.us/papers/linux/cconfig/)
Open Source nutures open minds and free, creative developers.
#1 lore raw
Quoted 35 lines · Nico Schottelius

Good morning everybody!

I've a small problem with loading the sata_sil module, but it could be a general issue: We use this sata-kontroller with sata-harddisks to backup our systems. The harddisk is exchanged (while the system is running) every day. So we load/unload sata_sil in our backup scripts, so 'hotplugging' is possible.

My problem is, that modprobe returns earlier than the attached device is usable:

----------------------------------------------------------------------

srwali01:/# modprobe sata_sil; mount /dev/sda1 /mnt/hdbackup/
mount: you must specify the filesystem type
srwali01:/# rmmod sata_sil
srwali01:/# modprobe sata_sil; ls -l /dev/sda1               
ls: /dev/sda1: No such file or directory
----------------------------------------------------------------------

So I have to do

----------------------------------------------------------------------

srwali01:/# modprobe sata_sil
srwali01:/# sleep 2
srwali01:/# mount /dev/sda1 /mnt/hdbackup
----------------------------------------------------------------------

The problem is most likely that udev is too slow or that modprobe does not know/wait for udev:

----------------------------------------------------------------------

srwali01:/# mount | grep tmpfs | grep -v /dev/shm
tmpfs on /dev type tmpfs (rw,sizeM,mode55)
srwali01:/# cat /proc/sys/kernel/hotplug 
/sbin/udevsend
----------------------------------------------------------------------
Quoted 4 lines

My questions:

- Should modprobe wait for whatever current hotplug is so that the system can definitly use the device after modprobe?

No.

Quoted 2 lines

- Or should there be a command-line switch to modprobe to tell it to wait for hotplug?

No.

Quoted 2 lines

- Is the 'wait for hotplug'-idea possible to do or would it have to be a dirty hack in the kernel?

Not possible.

Quoted 3 lines

- Is there clean solution to wait exactly as long as it needs to load sata_sil and create /dev/sda*? Using while+ls monitoring /dev/sda* is not a solution imho.

Wait for the node, or use the device event the kernel generates for the device you're looking for. You can catch it with a udev rule.

Kay

-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Nico Schottelius

Kay Sievers [Fri, Sep 30, 2005 at 07:12:26PM +0200]:

Quoted 7 lines

[...]

Quoted 3 lines

- Is there clean solution to wait exactly as long as it needs to load sata_sil and create /dev/sda*? Using while+ls monitoring /dev/sda* is not a solution imho.

Wait for the node, or use the device event the kernel generates for the device you're looking for. You can catch it with a udev rule.

Could you throw some RTFM to me so I know which device to listen to and howto implement that in a shell script?

Nico

Signature · 2 lines
Latest project: cconfig (http://nico.schotteli.us/papers/linux/cconfig/)
Open Source nutures open minds and free, creative developers.