diff options
| author | oster <oster@NetBSD.org> | 1998-12-03 15:06:25 +0000 |
|---|---|---|
| committer | oster <oster@NetBSD.org> | 1998-12-03 15:06:25 +0000 |
| commit | 3f3d8e85e6d8c8d0d0ca9adbf4f6c67a152d2d95 (patch) | |
| tree | 5e6c6c975bf84e5e330038150c9803bcade4e4c5 /sys/dev/raidframe | |
| parent | 679de7e878a80d6fd9c10d8bcb3b475a721d5174 (diff) | |
If a configuration fails due to a non-existant spare, remember to release
any previously allocated components before bailing. Credit to Manuel Bouyer
for noticing this.
Diffstat (limited to 'sys/dev/raidframe')
| -rw-r--r-- | sys/dev/raidframe/rf_disks.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sys/dev/raidframe/rf_disks.c b/sys/dev/raidframe/rf_disks.c index 2517d1dc127..fe211c72c22 100644 --- a/sys/dev/raidframe/rf_disks.c +++ b/sys/dev/raidframe/rf_disks.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_disks.c,v 1.1 1998/11/13 04:20:29 oster Exp $ */ +/* $NetBSD: rf_disks.c,v 1.2 1998/12/03 15:06:25 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -363,7 +363,7 @@ int rf_ConfigureSpareDisks( RF_Config_t *cfgPtr) { char buf[256]; - int i, ret; + int r,c,i, ret; RF_DiskOp_t *rdcap_op = NULL, *tur_op = NULL; unsigned bs; RF_RaidDisk_t *disks; @@ -445,6 +445,22 @@ fail: #ifndef SIMULATE #if defined(__NetBSD__) && defined(_KERNEL) + /* Release the hold on the main components. We've failed to allocate a + spare, and since we're failing, we need to free things.. */ + + for(r=0;r<raidPtr->numRow;r++) { + for(c=0;c<raidPtr->numCol;c++) { + /* Cleanup.. */ +#ifdef DEBUG + printf("Cleaning up row: %d col: %d\n",r,c); +#endif + if (raidPtr->raid_cinfo[r][c].ci_vp) { + (void)vn_close(raidPtr->raid_cinfo[r][c].ci_vp, + FREAD|FWRITE, proc->p_ucred, proc); + } + } + } + for(i=0;i<raidPtr->numSpare;i++) { /* Cleanup.. */ #ifdef DEBUG |
