From 9e34f8233b732a9c1e0adcf8512c6f7c61bacf7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Schmidt?= Date: Fri, 25 Aug 2006 09:33:56 +0000 Subject: [PATCH] Properly initialize and destroy the RAID lock. Also dont mess with RAID's thats not attached yet and avoid panic. --- sys/dev/ata/ata-raid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/ata/ata-raid.c b/sys/dev/ata/ata-raid.c index f659f3743f7f..78afd7b752b0 100644 --- a/sys/dev/ata/ata-raid.c +++ b/sys/dev/ata/ata-raid.c @@ -4087,7 +4087,8 @@ ata_raid_subdisk_detach(device_t dev) ars->raid[volume]->disks[ars->disk_number[volume]].flags &= ~(AR_DF_PRESENT | AR_DF_ONLINE); ars->raid[volume]->disks[ars->disk_number[volume]].dev = NULL; - ata_raid_config_changed(ars->raid[volume], 1); + if (mtx_initialized(&ars->raid[volume]->lock)) + ata_raid_config_changed(ars->raid[volume], 1); ars->raid[volume] = NULL; ars->disk_number[volume] = -1; } @@ -4149,6 +4150,8 @@ ata_raid_module_event_handler(module_t mod, int what, void *arg) if (!rdp || !rdp->status) continue; + if (mtx_initialized(&rdp->lock)) + mtx_destroy(&rdp->lock); if (rdp->disk) disk_destroy(rdp->disk); }