tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: panic on mfii(4) vd removal



> I get a panic if I remove a virtual disk from an mfii(4) device.
That's another blunder in mfii(4). Patch (including the last) attached.
Index: sys/dev/pci/mfii.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/mfii.c,v
retrieving revision 1.3.2.7
diff -u -p -r1.3.2.7 mfii.c
--- sys/dev/pci/mfii.c	29 Sep 2022 14:41:43 -0000	1.3.2.7
+++ sys/dev/pci/mfii.c	22 Sep 2023 12:16:42 -0000
@@ -503,6 +503,8 @@ static const char *mfi_bbu_indicators[] 
 };
 #endif
 
+#define MFI_BBU_SENSORS 4
+
 static void	mfii_init_ld_sensor(struct mfii_softc *, envsys_data_t *, int);
 static void	mfii_refresh_ld_sensor(struct mfii_softc *, envsys_data_t *);
 static void	mfii_attach_sensor(struct mfii_softc *, envsys_data_t *);
@@ -1373,18 +1375,20 @@ mfii_aen_ld_update(struct mfii_softc *sc
 		if (old == -1 && nld != -1) {
 			printf("%s: logical drive %d added (target %d)\n",
 			    DEVNAME(sc), i, nld);
+			sc->sc_ld[i].ld_present = 1;
 
 			// XXX scsi_probe_target(sc->sc_scsibus, i);
 
-			mfii_init_ld_sensor(sc, &sc->sc_sensors[i], i);
-			mfii_attach_sensor(sc, &sc->sc_sensors[i]);
+			mfii_init_ld_sensor(sc, &sc->sc_sensors[i + MFI_BBU_SENSORS], i);
+			mfii_attach_sensor(sc, &sc->sc_sensors[i + MFI_BBU_SENSORS]);
 		} else if (nld == -1 && old != -1) {
 			printf("%s: logical drive %d removed (target %d)\n",
 			    DEVNAME(sc), i, old);
+			sc->sc_ld[i].ld_present = 0;
 
 			scsipi_target_detach(&sc->sc_chan, i, 0, DETACH_FORCE);
 			sysmon_envsys_sensor_detach(sc->sc_sme,
-			    &sc->sc_sensors[i]);
+			    &sc->sc_sensors[i + MFI_BBU_SENSORS]);
 		}
 	}
 
@@ -3716,8 +3720,6 @@ freeme:
 
 #endif /* NBIO > 0 */
 
-#define MFI_BBU_SENSORS 4
-
 static void
 mfii_bbu(struct mfii_softc *sc, envsys_data_t *edata)
 {


Home | Main Index | Thread Index | Old Index