This patch is for you, I hope that usb devs suggests to merge it into
mainline kernel:
===== drivers/usb/storage/scsiglue.c 1.84 vs edited =====
--- 1.84/drivers/usb/storage/scsiglue.c 2004-09-13 08:11:34 -04:00
+++ edited/drivers/usb/storage/scsiglue.c 2004-09-30 16:07:33 -04:00
@@ -175,7 +175,7 @@
US_DEBUGP("%s called\n", __FUNCTION__);
srb->host_scribble = (unsigned char *)us;
- /* enqueue the command */
+ /* check for state-transition errors */
if (us->sm_state != US_STATE_IDLE || us->srb != NULL) {
printk(KERN_ERR USB_STORAGE "Error in %s: "
"state = %d, us->srb = %p\n",
@@ -183,10 +183,17 @@
return SCSI_MLQUEUE_HOST_BUSY;
}
+ /* fail the command if we are disconnecting */
+ if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) {
+ US_DEBUGP("Fail command during disconnect\n");
+ srb->result = DID_NO_CONNECT << 16;
+ done(srb);
+ return 0;
+ }
+
+ /* enqueue the command and wake up the control thread */
srb->scsi_done = done;
us->srb = srb;
-
- /* wake up the process task */
up(&(us->sema));
return 0;
Wolfgang Rohdewald wrote:
and later on shutdown hangs while unmounting local file systems.
It seems that scsi_device_cancel is called for a device that has already
been destroyed.
This kernel is compiled with preempt.
I added some debug output. 1515870810 is the integer value of sdev->sdev_state.
Oct 24 01:58:02 mm kernel: ehci_hcd 0000:00:03.3: GetStatus port 1 status 001002 POWER
sig=se0 CSC
Oct 24 01:58:02 mm kernel: hub 3-0:1.0: port 1, status 0100, change 0001, 12 Mb/s
Oct 24 01:58:03 mm kernel: hub 3-0:1.0: debounce: port 1: total 100ms stable 100ms
status 0x100
Oct 24 01:58:03 mm kernel: ohci_hcd 0000:00:03.0: GetStatus roothub.portstatus [0] =
0x00030100 PESC CSC PPS
Oct 24 01:58:03 mm kernel: hub 1-0:1.0: port 1, status 0100, change 0003, 12 Mb/s
Oct 24 01:58:03 mm kernel: usb 1-1: USB disconnect, address 2
Oct 24 01:58:03 mm kernel: usb 1-1: usb_disable_device nuking all URBs
Oct 24 01:58:03 mm kernel: usb 1-1: unregistering interface 1-1:1.0
Oct 24 01:58:03 mm kernel: usb-storage: storage_disconnect() called
Oct 24 01:58:03 mm kernel: usb-storage: usb_stor_stop_transport called
Oct 24 01:58:03 mm kernel: sd 0:0:0:0: scsi_remove_device cancels
Oct 24 01:58:03 mm kernel: sd 0:0:0:0: State transition running->cancel
Oct 24 01:58:03 mm kernel: 0:0:0:0: scsi_remove_device between device_del and
scsi_device_set_state
Oct 24 01:58:03 mm kernel: 0:0:0:0: State transition cancel->deleted
Oct 24 01:58:03 mm kernel: target0:0:0: scsi_device_cancel called with state 1515870810 /
<NULL>
Oct 24 01:58:03 mm kernel: target0:0:0: Illegal state transition <NULL>->cancel
Oct 24 01:58:03 mm kernel: Badness in scsi_device_set_state at
drivers/scsi/scsi_lib.c:1717
Oct 24 01:58:03 mm kernel: EIP: 0060:[vsnprintf+779/1167] Not tainted VLI
Oct 24 01:58:03 mm kernel: EFLAGS: 00010097 (2.6.10-rc1)
Oct 24 01:58:03 mm kernel: EIP is at vsnprintf+0x30b/0x48f
Oct 24 01:58:03 mm kernel: eax: 6b6b6b6b ebx: 0000000a ecx: 6b6b6b6b edx:
fffffffe
Oct 24 01:58:03 mm kernel: esi: c044a4a4 edi: 00000000 ebp: ddecbce4 esp:
ddecbcac
Oct 24 01:58:03 mm kernel: ds: 007b es: 007b ss: 0068
Oct 24 01:58:03 mm kernel: Process khubd (pid: 26, threadinfo=ddeca000 task=dde94aa0)
Oct 24 01:58:03 mm kernel: Stack: c044a494 c044a87f 00000485 00000000 0000000a
fffffff8 00000003 00000002
Oct 24 01:58:03 mm kernel: ffffffff ffffffff c044a87f 00000400 00000046
00000000 ddecbd00 c020ed34
Oct 24 01:58:03 mm kernel: c044a480 00000400 deb63ff2 ddecbd58 c044a480
ddecbd30 c012309a c044a480
Oct 24 01:58:03 mm kernel: Call Trace:
Oct 24 01:58:03 mm kernel: [show_stack+128/150] show_stack+0x80/0x96
Oct 24 01:58:03 mm kernel: [show_registers+346/446] show_registers+0x15a/0x1be
Oct 24 01:58:03 mm kernel: [die+349/720] die+0x15d/0x2d0
Oct 24 01:58:03 mm kernel: [do_page_fault+606/1599] do_page_fault+0x25e/0x63f
Oct 24 01:58:03 mm kernel: [error_code+45/56] error_code+0x2d/0x38
Oct 24 01:58:03 mm kernel: [vscnprintf+41/56] vscnprintf+0x29/0x38
Oct 24 01:58:03 mm kernel: [vprintk+176/828] vprintk+0xb0/0x33c
Oct 24 01:58:03 mm kernel: [printk+24/28] printk+0x18/0x1c
Oct 24 01:58:03 mm kernel: [pg0+510575152/1069110272] scsi_device_cancel+0x2a7/0x2ac
[scsi_mod]
Oct 24 01:58:03 mm kernel: [device_for_each_child+76/123]
device_for_each_child+0x4c/0x7b
Oct 24 01:58:03 mm kernel: [pg0+510575301/1069110272] scsi_host_cancel+0x31/0xb3
[scsi_mod]
Oct 24 01:58:03 mm kernel: [pg0+510575467/1069110272] scsi_remove_host+0x24/0x68
[scsi_mod]
Oct 24 01:58:03 mm kernel: [pg0+510731353/1069110272] storage_disconnect+0xa4/0xb9
[usb_storage]
Oct 24 01:58:03 mm kernel: [usb_unbind_interface+134/136]
usb_unbind_interface+0x86/0x88
Oct 24 01:58:03 mm kernel: [device_release_driver+98/100]
device_release_driver+0x62/0x64
Oct 24 01:58:03 mm kernel: [bus_remove_device+126/191] bus_remove_device+0x7e/0xbf
Oct 24 01:58:03 mm kernel: [device_del+110/163] device_del+0x6e/0xa3
Oct 24 01:58:03 mm kernel: [usb_disable_device+204/365] usb_disable_device+0xcc/0x16d
Oct 24 01:58:03 mm kernel: [usb_disconnect+200/791] usb_disconnect+0xc8/0x317
Oct 24 01:58:03 mm kernel: [hub_port_connect_change+1807/1854]
hub_port_connect_change+0x70f/0x73e
Oct 24 01:58:03 mm kernel: [hub_events+1214/1743] hub_events+0x4be/0x6cf
Oct 24 01:58:03 mm kernel: [hub_thread+50/283] hub_thread+0x32/0x11b
Oct 24 01:58:03 mm kernel: [kernel_thread_helper+5/11] kernel_thread_helper+0x5/0xb
Oct 24 01:58:03 mm kernel: Code: ff c7 45 ec 08 00 00 00 83 cf 01 eb b9 8b 45 14 8b 55
e8 83 45 14 04 8b 08 b8 88 57 37 c0 81
f9 ff 0f 00 00 0f 46 c8 89 c8 eb 06 <80> 38 00 74 07 40 4a 83 fa ff 75 f4 29 c8 83 e7
10 89 c3 75 21
Oct 24 01:58:03 mm kernel: <6>note: khubd[26] exited with preempt_count 2
Oct 24 02:02:28 mm kernel: Slab corruption: start=da986750, len=512
Oct 24 02:02:28 mm kernel: Redzone: 0x5a2cf071/0x5a2cf071.
Oct 24 02:02:28 mm kernel: Last user: [elevator_exit+117/119](elevator_exit+0x75/0x77)
Oct 24 02:02:28 mm kernel: 090: 6b 6b 6b 6b 6b 6b 6b 6b 6a 6b 6b 6b 6b 6b 6b 6b
Oct 24 02:02:28 mm kernel: Prev obj: start=da986544, len=512
Oct 24 02:02:28 mm kernel: Redzone: 0x5a2cf071/0x5a2cf071.
Oct 24 02:02:28 mm kernel: Last user: [kfree_skbmem+20/44](kfree_skbmem+0x14/0x2c)
Oct 24 02:02:28 mm kernel: 000: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b
Oct 24 02:02:28 mm kernel: 010: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b
Oct 24 02:02:28 mm kernel: Next obj: start=da98695c, len=512
Oct 24 02:02:28 mm kernel: Redzone: 0x170fc2a5/0x170fc2a5.
Oct 24 02:02:28 mm kernel: Last user:
[pg0+510619908/1069110272](scsi_sysfs_target_initialize+0x1d7/0x436 [scsi_mod])
Oct 24 02:02:28 mm kernel: 000: 00 00 00 00 58 c4 e1 d6 58 c4 e1 d6 68 69 98 da
Oct 24 02:02:28 mm kernel: 010: 68 69 98 da 70 69 98 da 70 69 98 da 78 69 98 da
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel