mfi(4): Fix a bug in the disk initialization code.
authorSascha Wildner <saw@online.de>
Mon, 29 Aug 2011 03:19:54 +0000 (05:19 +0200)
committerSascha Wildner <saw@online.de>
Mon, 29 Aug 2011 03:20:46 +0000 (05:20 +0200)
This ultimately caused a panic when kldunloading.

Reported-by: Tomi Juvonen <tomi.juvonen@kenou.biz>
sys/dev/raid/mfi/mfi_disk.c
sys/dev/raid/mfi/mfi_syspd.c
sys/dev/raid/mfi/mfivar.h

index 57732ea..53534b1 100644 (file)
@@ -174,10 +174,9 @@ mfi_disk_attach(device_t dev)
            DEVSTAT_TYPE_STORARRAY | DEVSTAT_TYPE_IF_OTHER,
            DEVSTAT_PRIORITY_ARRAY);
 
-       sc->ld_disk.d_cdev = disk_create(sc->ld_unit, &sc->ld_disk,
-           &mfi_disk_ops);
-       sc->ld_disk.d_cdev->si_drv1 = sc;
-       sc->ld_disk.d_cdev->si_iosize_max =
+       sc->ld_dev_t = disk_create(sc->ld_unit, &sc->ld_disk, &mfi_disk_ops);
+       sc->ld_dev_t->si_drv1 = sc;
+       sc->ld_dev_t->si_iosize_max =
            min(sc->ld_controller->mfi_max_io * secsize,
                (sc->ld_controller->mfi_max_sge - 1) * PAGE_SIZE);
 
index 0a3fca2..3119f21 100644 (file)
@@ -129,10 +129,9 @@ mfi_syspd_attach(device_t dev)
            DEVSTAT_TYPE_STORARRAY | DEVSTAT_TYPE_IF_OTHER,
            DEVSTAT_PRIORITY_ARRAY);
 
-       sc->pd_disk.d_cdev = disk_create(sc->pd_unit, &sc->pd_disk,
-           &mfi_syspd_ops);
-       sc->pd_disk.d_cdev->si_drv1 = sc;
-       sc->pd_disk.d_cdev->si_iosize_max = sc->pd_controller->mfi_max_io *
+       sc->pd_dev_t = disk_create(sc->pd_unit, &sc->pd_disk, &mfi_syspd_ops);
+       sc->pd_dev_t->si_drv1 = sc;
+       sc->pd_dev_t->si_iosize_max = sc->pd_controller->mfi_max_io *
            secsize;
 
        bzero(&info, sizeof(info));
index 4ec8907..36664d5 100644 (file)
@@ -155,6 +155,7 @@ struct mfi_command {
 struct mfi_disk {
        TAILQ_ENTRY(mfi_disk)   ld_link;
        device_t        ld_dev;
+       cdev_t          ld_dev_t;
        int             ld_id;
        int             ld_unit;
        struct mfi_softc *ld_controller;
@@ -170,6 +171,7 @@ struct mfi_disk {
 struct mfi_system_pd {
        TAILQ_ENTRY(mfi_system_pd)      pd_link;
        device_t        pd_dev;
+       cdev_t          pd_dev_t;
        int             pd_id;
        int             pd_unit;
        struct mfi_softc *pd_controller;