From 4a82b086a3a9345f4cc8ac7ccf9ceaeaa4f144ac Mon Sep 17 00:00:00 2001 From: oster Date: Sat, 10 Apr 2004 05:52:33 +0000 Subject: Allocating emergency buffer space is all fine and well, but one should really remember to return the memory when unconfiguring the array. Same thing goes for the pool elements used to build the list! --- sys/dev/raidframe/rf_driver.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'sys/dev/raidframe') diff --git a/sys/dev/raidframe/rf_driver.c b/sys/dev/raidframe/rf_driver.c index eba58b6f105..3b0713f98e3 100644 --- a/sys/dev/raidframe/rf_driver.c +++ b/sys/dev/raidframe/rf_driver.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.c,v 1.99 2004/04/09 23:10:16 oster Exp $ */ +/* $NetBSD: rf_driver.c,v 1.100 2004/04/10 05:52:33 oster Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -73,7 +73,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.99 2004/04/09 23:10:16 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.100 2004/04/10 05:52:33 oster Exp $"); #include "opt_raid_diagnostic.h" @@ -202,6 +202,8 @@ rf_UnconfigureArray() int rf_Shutdown(RF_Raid_t *raidPtr) { + RF_VoidPointerListElem_t *tmp; + if (!raidPtr->valid) { RF_ERRORMSG("Attempt to shut down unconfigured RAIDframe driver. Aborting shutdown\n"); return (EINVAL); @@ -238,6 +240,22 @@ rf_Shutdown(RF_Raid_t *raidPtr) rf_UnconfigureVnodes(raidPtr); + /* Free the emergency IO buffers */ + while (raidPtr->iobuf != NULL) { + tmp = raidPtr->iobuf; + raidPtr->iobuf = raidPtr->iobuf->next; + free(tmp->p, M_RAIDFRAME); + rf_FreeVPListElem(tmp); + } + + /* Free the emergency stripe buffers */ + while (raidPtr->stripebuf != NULL) { + tmp = raidPtr->stripebuf; + raidPtr->stripebuf = raidPtr->stripebuf->next; + free(tmp->p, M_RAIDFRAME); + rf_FreeVPListElem(tmp); + } + rf_ShutdownList(&raidPtr->shutdownList); rf_UnconfigureArray(); -- cgit