CAM problem

From: Andrew Thompson <thompsa_at_FreeBSD.org>
Date: Tue, 20 Oct 2009 13:40:55 +1300
Hi,


I have a cam problem that is noticeable with usb devices. It relates to
the ordering of xpt_release_device() and the CAM_DEV_UNCONFIGURED flag
when yanking a device that has stalled. This then causes a problem with
the usb explore thread which will end up waiting on simfree forever,
blocking any further usb attach/detach on the controller.

Hopefully my printfs can show the problem. I have replaced the pointers
returned from xpt_alloc_device() with pretty names, <dev3> is the one in
question.



ugen1.3: <KINGSTON> at usbus1
umass0: <KINGSTON DataTraveler 2.0, class 0/0, rev 2.00/2.00, addr 3> on usbus1
umass0:  SCSI over Bulk-Only; quirks = 0x0000
umass-sim0: ref 1++
xpt_find_bus: ref=1 -> 2
xpt_alloc_target: ref=2 -> 3
xpt_alloc_device: device = dev1
xpt_release_device dev1 OK 
xpt_release_target: xpt_release_bus
xpt_release_bus: ref=3 -> 2
xpt_release_path: xpt_release_bus
xpt_release_bus: ref=2 -> 1
umass0:0:0:-1: Attached to scbus0
xpt_find_bus: ref=1 -> 2
xpt_alloc_target: ref=2 -> 3
xpt_alloc_device: device = dev2
xpt_find_bus: ref=3 -> 4
xpt_alloc_target: ref=4 -> 5
xpt_alloc_device: device = dev3
xpt_find_bus: ref=5 -> 6
xpt_release_device dev3 failed, ref=1 unconf=1
xpt_release_path: xpt_release_bus
xpt_release_bus: ref=6 -> 5
xpt_find_bus: ref=5 -> 6
probedone: clr dev dev3 unconfigured

<...unplug...>

ugen1.3: <KINGSTON> at usbus1 (disconnected)
umass0: at uhub2, port 1, addr 3 (disconnected)
umass_detach:
usb_cam_action, device GONE
usb_cam_action, device GONE
usb_cam_action, device GONE
xpt_find_bus: ref=6 -> 7
usb_cam_action, device GONE
usb_cam_action, device GONE
xpt_release_device dev3 failed, ref=3 unconf=0
xpt_release_path: xpt_release_bus
xpt_release_bus: ref=7 -> 6
(da0:umass-sim0:0:0:0): got CAM status 0x39
(da0:umass-sim0:0:0:0): fatal error, failed to attach to device
(da0:umass-sim0:0:0:0): lost device
(da0:umass-sim0:0:0:0): removing device entry

 ^^^ USB disk had stalled on attach

xpt_release_device dev3 failed, ref=1 unconf=0
xpt_release_path: xpt_release_bus
xpt_release_bus: ref=6 -> 5
xpt_release_device dev3 failed, ref=0 unconf=0

 ^^^ last reference to dev3 dropped

xpt_release_path: xpt_release_bus
xpt_release_bus: ref=5 -> 4
xpt_release_device dev2 OK 
xpt_release_target: xpt_release_bus
xpt_release_bus: ref=4 -> 3
xpt_release_path: xpt_release_bus
xpt_release_bus: ref=3 -> 2
umass_cam_detach_sim: calling xpt_bus_deregister
xpt_find_bus: ref=2 -> 3
xpt_alloc_target: ref=3 -> 4
xpt_alloc_device: device = dev4
scsi_dev_async: set dev dev3 unconfigured

 ^^^ dev3 gets the CAM_DEV_UNCONFIGURED flag cleared here

xpt_bus_deregister: xpt_release_bus
xpt_release_bus: ref=4 -> 3
xpt_release_device dev4 OK 
xpt_release_target: xpt_release_bus
xpt_release_bus: ref=3 -> 2
xpt_release_path: xpt_release_bus
xpt_release_bus: ref=2 -> 1
umass_cam_detach_sim:
umass-sim0: waiting... ref = 1

 ^^^ wait on "simfree" forever.
Received on Mon Oct 19 2009 - 22:41:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:57 UTC