* [PATCH] hotplug scsi.agent script avoid race on scsi type attribute
@ 2004-02-13 1:13 Patrick Mansfield
0 siblings, 0 replies; only message in thread
From: Patrick Mansfield @ 2004-02-13 1:13 UTC (permalink / raw)
To: linux-hotplug
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 ??
diff -uprN -X /home/patman/dontdiff hotplug-2004_01_05-orig/etc/hotplug/scsi.agent hotplug-2004_01_05/etc/hotplug/scsi.agent
--- hotplug-2004_01_05-orig/etc/hotplug/scsi.agent Wed Dec 11 14:05:06 2002
+++ hotplug-2004_01_05/etc/hotplug/scsi.agent Thu Feb 12 16:23:22 2004
@@ -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\x10
+ 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_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-02-13 1:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-13 1:13 [PATCH] hotplug scsi.agent script avoid race on scsi type attribute Patrick Mansfield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).