[Bug 273289] smartpqi: fix panic on removal of SAS drive

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 27 Aug 2023 13:47:57 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273289

--- Comment #8 from John F. Carr <jfc@mit.edu> ---
Created attachment 244386
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=244386&action=edit
move free out of spinlock (new driver)

Because pqisrc_free_device has changed in the new driver a new patch is needed.
 I tested this by copying the new driver to 13.2-CURRENT, the version I am
running on my HPE server.  The new driver is very chatty, see below.  Instead
of a compile-time constant the variable logging_level in smartpqi_defines.h
should be a tunable and the default value should not include PQISRC_FLAGS_NOTE.

The driver appears to be trying to delete the drive twice.  See the "Invalid
device" note.

The following is the dmesg output triggered by removing and replacing a drive,
which would have caused a panic with the unpatched old driver.

[NOTE]:[ pqisrc_display_device_info ] [ 274 ]removed scsi BTL 0:8:0:  SEAGATE 
XS960SE70004     Physical     SSDSmartPathCap- En- Exp+ qd=65535
[NOTE]:[ pqisrc_remove_device ] [ 1443 ]vendor: SEAGATE XS960SE70004     model:
XS960SE70004     bus:0 target:8 lun:0 is_physical_device:0x1 expose_device:0x1
volume_offline 0x0 volume_status 0x0 
[WARN]:[67:655.0][0,8,0][CPU
0][pqisrc_wait_for_device_commands_to_complete][430]:Device Outstanding IO
count = 0
[NOTE]:[ pqisrc_free_device ] [ 1643 ]Giving back target 8 
[NOTE]:[ pqisrc_delete_softs_entry ] [ 363 ]Invalid device, either it was
already removed or never added
[NOTE]:[ pqisrc_free_device ] [ 1673 ]Removed memory for device : B 0: T 8: L 0
da7 at smartpqi0 bus 0 scbus0 target 8 lun 0
da7: <SEAGATE XS960SE70004 0003>  s/n HLJ03TL80000822150Z3 detached
(da7:smartpqi0:0:8:0): Periph destroyed
[NOTE]:[ pqisrc_add_softs_entry ] [ 288 ]Added device [7 of 10]: B 0: T 8: L 0
[NOTE]:[ pqisrc_add_device ] [ 1420 ]vendor: SEAGATE XS960SE70004     model:
XS960SE70004     bus:0 target:8 lun:0 is_physical_device:0x1 expose_device:0x1
volume_offline 0x0 volume_status 0x0 
[NOTE]:[ pqisrc_display_device_info ] [ 274 ]added scsi BTL 0:8:0:  SEAGATE 
XS960SE70004     Physical     SSDSmartPathCap- En- Exp+ qd=65535
ses0: da7,pass8 in 'ArrayElement0007', SAS Slot: 1 phys at slot 8
ses0:  phy 0: SAS device type 1 phy 7 Target ( SSP )
ses0:  phy 0: parent 51402ec013d6a5b4 addr 5000c5003e85f2bd
da7 at smartpqi0 bus 0 scbus0 target 8 lun 0
da7: <SEAGATE XS960SE70004 0003> Fixed Direct Access SPC-5 SCSI device

-- 
You are receiving this mail because:
You are the assignee for the bug.