Index | Thread | Search

From:
joshua stein <jcs@jcs.org>
Subject:
detach nvme properly
To:
tech@openbsd.org
Date:
Mon, 18 Nov 2024 18:03:37 -0600

Download raw body.

Thread
  • joshua stein:

    detach nvme properly

Unplugging a Thunderbolt NVMe enclosure causes a panic:

ppb3 at pci2 dev 0 function 0 "Intel JHL6240 Thunderbolt 3" rev 0x01
pci4 at ppb3 bus 33
ppb4 at pci4 dev 1 function 0 "Intel JHL6240 Thunderbolt 3" rev 0x01: msi
pci5 at ppb4 bus 34
nvme1 at pci5 dev 0 function 0 "SanDisk PC SN740" rev 0x01: msix, NVMe 1.4
nvme1: WD PC SN740 SDDPTQE-2T00, firmware 73116000, serial 2345A6404751
scsibus4 at nvme1: 2 targets, initiator 0
sd2 at scsibus4 targ 1 lun 0: <NVMe, WD PC SN740 SDDP, 7311>
sd2: 1953514MB, 512 bytes/sector, 4000797360 sectors
[unplug]
config_detach: scsibus4 attached at nvme1
panic: config_detach: detached device (nvme1) has children


diff --git sys/dev/pci/nvme_pci.c sys/dev/pci/nvme_pci.c
index d827b5405da..b7370666175 100644
--- sys/dev/pci/nvme_pci.c
+++ sys/dev/pci/nvme_pci.c
@@ -131,7 +131,7 @@ unmap:
 int
 nvme_pci_detach(struct device *self, int flags)
 {
-	return (0);
+	return config_detach_children(self, flags);
 }
 
 int