How are hardware changes automatically detected by the kernel?
I realise that this thread has not been updated since 2008 so I'm not sure if anyone will see the question I have below, but if so, any helpful information would be very much appreciated please...
Apart from manually calling or running the rescan-scsi-bus.sh script mentioned in this thread, do most Linux distros automatically scan the PCI and SCSI buses at periodic intervals? I'm trying to get an understanding of exactly what happens when device disappears and reappears on the system.
I have my node attached by fiber to an EMC SAN (via a QLogic HBA with qla2xxx driver). If I pull the fiber cables out, I can see udev entries in /var/log/messages, telling me that the devices (sdb, sdc...) have been removed. Similarly, if I put the fiber cables back in, I can see udev entries in /var/log/messages, telling me that some devices have been added. The problem I'm actually having is that they are appearing with new (different) device names, so I'm trying to figure out how this detection is working at a relatively low level in the kernel.
Could you please help me to understand exactly what initiates the process that informs the kernel that the devices have been removed/added?
Is the PCI or SCSI subsystem periodically scanning for changes on the bus? My understanding (which may be quite incorrect) is that the PCI subsystem scans for devices on the bus. When it finds one it will register the new device with the device core and a kobject will be created in the kernel. Then the list of drivers for the PCI (or SCSI) subsystem will be queried until a matching driver for the new device is found. Then the driver will initialize the new device and the reference counter in the device's associated kobject will be incremented, at which time a uevent will be sent to udev.
Or, is it the driver that is responsible for detecting these changes and informing the device core in the kernel?
I'd eventually like to understand why different names are assigned to the devices when the cables are re-attached, but considering the topic of this thread, I'd very much like to know what informs the kernel of device status changes if the rescan-scsi-bus.sh script is not explicitly being run by me.
Thanks and regards,
Last edited by boy_named_suse; 09-23-2011 at 02:50 PM.
Reason: Update Title