ieee1394/sbp2: fix for hot-unplug
I wrote to [email protected]:
Quoted 1 line
4th update: some more paranoia in
sbp2scsi_queuecommand
(The rest of that posting is here: http://www.linux1394.org/pipermail/svn-commits/2005-August/000411.html )
I can't believe it. I connected a FireWire CD-ROM, it was detected as such by scsi's inquiry, sr_mod issued Test Unit Ready and Mode Sense which were failing and aborted for unknown reason. While the commands and aborts were repeated, I ran "modprobe -r sbp2" which hung in D state at scsi_wait_req.
I guess sr_mod can't shut down before it did not fully finish whatever it is trying to do when a CD-ROM was added.
Quoted 22 lines
Aug 18 01:05:45 shuttle kernel: ieee1394: sbp2: Logged into SBP-2 device Aug 18 01:05:45 shuttle kernel: ieee1394: Node 1-01:1023: Max speed [S400] - Max payload [2048] Aug 18 01:05:50 shuttle kernel: ieee1394: sbp2: aborting sbp2 command Aug 18 01:05:50 shuttle kernel: scsi26 : destination target 0, lun 0 Aug 18 01:05:50 shuttle kernel: command: Inquiry: 12 00 00 00 24 00 Aug 18 01:05:56 shuttle kernel: ieee1394: sbp2: aborting sbp2 command Aug 18 01:05:56 shuttle kernel: scsi26 : destination target 0, lun 0 Aug 18 01:05:56 shuttle kernel: command: Inquiry: 12 00 00 00 60 00 Aug 18 01:05:56 shuttle kernel: Vendor: PLEXTOR Model: DVDR PX-716A Rev: 1.08 Aug 18 01:05:56 shuttle kernel: Type: CD-ROM ANSI SCSI revision: 02 Aug 18 01:05:56 shuttle scsi.agent: cdrom at /devices/pci0000:00/0000:00:0c.0/fw-host1/0030e005003b00c8/0030e005003b00c8-0/host26/target26:0:0/26:0:0:0 Aug 18 01:06:26 shuttle kernel: ieee1394: sbp2: aborting sbp2 command Aug 18 01:06:26 shuttle kernel: scsi26 : destination target 0, lun 0 Aug 18 01:06:26 shuttle kernel: command: Test Unit Ready: 00 00 00 00 00 00 Aug 18 01:06:56 shuttle kernel: ieee1394: sbp2: aborting sbp2 command Aug 18 01:06:56 shuttle kernel: scsi26 : destination target 0, lun 0 Aug 18 01:06:56 shuttle kernel: command: Mode Sense (10): 5a 00 2a 00 00 00 00 00 80 00 Aug 18 01:07:26 shuttle kernel: ieee1394: sbp2: aborting sbp2 command Aug 18 01:07:26 shuttle kernel: scsi26 : destination target 0, lun 0 Aug 18 01:07:26 shuttle kernel: command: Mode Sense (10): 5a 00 2a 00 00 00 00 00 80 00 Aug 18 01:07:36 shuttle kernel: ieee1394: sbp2: aborting sbp2 command Aug 18 01:07:36 shuttle kernel: scsi26 : destination target 0, lun 0
Quoted 8 lines
Aug 18 01:07:36 shuttle kernel: command: Test Unit Ready: 00 00 00 00 00 00 Aug 18 01:07:36 shuttle kernel: ieee1394: sbp2: reset requested Aug 18 01:07:36 shuttle kernel: ieee1394: sbp2: Generating sbp2 fetch agent reset Aug 18 01:07:46 shuttle kernel: ieee1394: sbp2: aborting sbp2 command Aug 18 01:07:46 shuttle kernel: scsi26 : destination target 0, lun 0 Aug 18 01:07:46 shuttle kernel: command: Test Unit Ready: 00 00 00 00 00 00 Aug 18 01:07:46 shuttle kernel: ieee1394: sbp2: reset requested Aug 18 01:07:46 shuttle kernel: ieee1394: sbp2: Generating sbp2 fetch agent reset
Roughly at this point I ran "modprobe -r sbp2", which hung at scsi_wait_req.
Quoted 6 lines
Aug 18 01:08:06 shuttle kernel: ieee1394: sbp2: aborting sbp2 command Aug 18 01:08:06 shuttle kernel: scsi26 : destination target 0, lun 0 Aug 18 01:08:06 shuttle kernel: command: Test Unit Ready: 00 00 00 00 00 00 Aug 18 01:08:06 shuttle kernel: ieee1394: sbp2: reset requested Aug 18 01:08:06 shuttle kernel: ieee1394: sbp2: Generating sbp2 fetch agent reset Aug 18 01:08:26 shuttle kernel: ieee1394: sbp2: aborting sbp2 command
Quoted 8 lines
Aug 18 01:08:26 shuttle kernel: scsi26 : destination target 0, lun 0 Aug 18 01:08:26 shuttle kernel: command: Test Unit Ready: 00 00 00 00 00 00 Aug 18 01:08:26 shuttle kernel: scsi: Device offlined - not ready after error recovery: host 26 channel 0 id 0 lun 0 Aug 18 01:08:56 shuttle kernel: ieee1394: sbp2: aborting sbp2 command Aug 18 01:08:56 shuttle kernel: scsi26 : destination target 0, lun 0 Aug 18 01:08:56 shuttle kernel: command: Mode Sense (10): 5a 00 2a 00 00 00 00 00 80 00 Aug 18 01:08:59 shuttle kernel: ieee1394: Node changed: 1-02:1023 -> 1-01:1023 Aug 18 01:08:59 shuttle kernel: ieee1394: Node suspended: ID:BUS[1-01:1023] GUID[0030e005003b00c8]
Here I physically unplugged the CD-ROM.
Quoted 8 lines
Aug 18 01:09:06 shuttle kernel: ieee1394: sbp2: aborting sbp2 command Aug 18 01:09:06 shuttle kernel: scsi26 : destination target 0, lun 0 Aug 18 01:09:06 shuttle kernel: command: Test Unit Ready: 00 00 00 00 00 00 Aug 18 01:09:06 shuttle kernel: ieee1394: sbp2: hpsb_node_write failed. Aug 18 01:09:06 shuttle kernel: Aug 18 01:09:06 shuttle kernel: ieee1394: sbp2: reset requested Aug 18 01:09:06 shuttle kernel: ieee1394: sbp2: Generating sbp2 fetch agent reset Aug 18 01:09:06 shuttle kernel: ieee1394: sbp2: hpsb_node_write failed.
Well, here is a flaw in sbp2's eh_device_reset_handler. It is not necessary to try to reset a node which isn't there anymore. But this is of course not related to the deadlock.
Quoted 8 lines
Aug 18 01:09:06 shuttle kernel: Aug 18 01:09:16 shuttle kernel: ieee1394: sbp2: reset requested Aug 18 01:09:16 shuttle kernel: ieee1394: sbp2: Generating sbp2 fetch agent reset Aug 18 01:09:16 shuttle kernel: ieee1394: sbp2: hpsb_node_write failed. Aug 18 01:09:16 shuttle kernel: Aug 18 01:09:26 shuttle kernel: scsi: Device offlined - not ready after error recovery: host 26 channel 0 id 0 lun 0 Aug 18 01:09:26 shuttle kernel: sr0: scsi3-mmc drive: 0x/0x caddy Aug 18 01:09:26 shuttle kernel: Attached scsi CD-ROM sr0 at scsi26, channel 0, id 0, lun 0
Device 26,0,0,0 offlined - Attached scsi CD-ROM at 26,0,0,0. WTF?
The "modprobe -r sbp2" from a minute ago still hangs at this point. In fact it will keep hanging until I will reboot.
Who knows how many more different kinds of deadlocks during LLD removal or device removal might be possible. It's frustrating.
Signature · 3 lines
Stefan Richter -=====-=-=-= =--- =--=- http://arcgraph.de/sr/