summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2002-10-05 03:07:23 +0000
committerrwatson <rwatson@FreeBSD.org>2002-10-05 03:07:23 +0000
commita648bd3f5356ec601d2e174ac00895ae37fa9bcb (patch)
tree685bf7ff916c93bc96ae55ad387dd4c232afd421
parent0419ba230a6ac38dddafcb9001eaa9f731b9f52d (diff)
downloadFreeBSD-src-a648bd3f5356ec601d2e174ac00895ae37fa9bcb.zip
FreeBSD-src-a648bd3f5356ec601d2e174ac00895ae37fa9bcb.tar.gz
Remove a panic on vinum module unload: make sure to destroy all mutexes
before freeing so that WITNESS doesn't dereference mutex data pointers and page fault. It's now possible to unload vinum.ko with a GENERIC kernel on 5.0-CURRENT without panic. Debugged/fixed with the aid of: jake, grog
-rw-r--r--sys/dev/vinum/vinumconfig.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/dev/vinum/vinumconfig.c b/sys/dev/vinum/vinumconfig.c
index d40c624..85c545d 100644
--- a/sys/dev/vinum/vinumconfig.c
+++ b/sys/dev/vinum/vinumconfig.c
@@ -726,6 +726,7 @@ return_drive_space(int driveno, int64_t offset, int length)
void
free_sd(int sdno)
{
+ struct plex *plex = &PLEX[sdno];
struct sd *sd;
sd = &SD[sdno];
@@ -735,7 +736,9 @@ free_sd(int sdno)
sd->driveoffset,
sd->sectors);
if (sd->plexno >= 0)
- PLEX[sd->plexno].subdisks--; /* one less subdisk */
+ plex->subdisks--; /* one less subdisk */
+ if (isstriped (plex))
+ mtx_destroy(&plex->lockmtx);
destroy_dev(sd->dev);
bzero(sd, sizeof(struct sd)); /* and clear it out */
sd->state = sd_unallocated;
OpenPOWER on IntegriCloud