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.
This commit is contained in:
parent
679de7e878
commit
3f3d8e85e6
@ -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.
|
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -363,7 +363,7 @@ int rf_ConfigureSpareDisks(
|
|||||||
RF_Config_t *cfgPtr)
|
RF_Config_t *cfgPtr)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
int i, ret;
|
int r,c,i, ret;
|
||||||
RF_DiskOp_t *rdcap_op = NULL, *tur_op = NULL;
|
RF_DiskOp_t *rdcap_op = NULL, *tur_op = NULL;
|
||||||
unsigned bs;
|
unsigned bs;
|
||||||
RF_RaidDisk_t *disks;
|
RF_RaidDisk_t *disks;
|
||||||
@ -445,6 +445,22 @@ fail:
|
|||||||
#ifndef SIMULATE
|
#ifndef SIMULATE
|
||||||
#if defined(__NetBSD__) && defined(_KERNEL)
|
#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++) {
|
for(i=0;i<raidPtr->numSpare;i++) {
|
||||||
/* Cleanup.. */
|
/* Cleanup.. */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
Loading…
Reference in New Issue
Block a user