hotplug scsi.agent script avoid race on scsi type attribute
PATCH 1/1 hotplug scsi.agent script avoid race on scsi type attribute
Hi -
I'm not sure who is maintaining this, let me know if I'm sending to the wrong address.
This patch against hotplug-2004_01_05 avoids a race while trying to determine the type of scsi device found.
Without the patch, the automatic loading of upper level drivers sometimes fails, with errors like:
Feb 12 16:21:09 elm3b79 scsi.agent[3003]: how to add device type= at /devices/pci0000:01/0000:01:0c.0/host5/5:0:2:0 ??
etc/hotplug/scsi.agent +20 -1
@@ -18,7 +18,26 @@ add) exit 1 fi - TYPE=$(cat /sys/$DEVPATH/type) + TYPE_ATTR=/sys$DEVPATH/type + + # Possibly sleep here to try and avoid races with scsi attributes and block + # devices + count + while [ ! -f $TYPE_ATTR -a $count -gt 0 ] + do + # We seem to always hit this now, so don't output any message. + debug_mesg "waiting for $TYPE_ATTR" + sleep 1 + let count=count+1 + done + + if [ ! -f $TYPE_ATTR ] + then + mesg "Attribute $TYPE_ATTR does not exist" + exit 1 + fi + + TYPE=$(cat $TYPE_ATTR) case "$TYPE" in # 2.5.51 style attributes; <scsi/scsi.h> TYPE_* constants 0) TYPE=disk ; MODULE=sd_mod ;;
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel