Don't allow -f to fail a disk while a reconstruction is taking place

since that would cause a panic.  (Problem noticed by dan@.)
This commit is contained in:
oster 2004-11-17 01:34:10 +00:00
parent c7dab32bb3
commit 1f113cb32a
1 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_netbsdkintf.c,v 1.184 2004/11/16 16:52:30 oster Exp $ */
/* $NetBSD: rf_netbsdkintf.c,v 1.185 2004/11/17 01:34:10 oster Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@ -146,7 +146,7 @@
***********************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.184 2004/11/16 16:52:30 oster Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.185 2004/11/17 01:34:10 oster Exp $");
#include <sys/param.h>
#include <sys/errno.h>
@ -1285,6 +1285,12 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
RF_LOCK_MUTEX(raidPtr->mutex);
if (raidPtr->status == rf_rs_reconstructing) {
/* you can't fail a disk while we're reconstructing! */
/* XXX wrong for RAID6 */
RF_UNLOCK_MUTEX(raidPtr->mutex);
return (EINVAL);
}
if ((raidPtr->Disks[rr->col].status ==
rf_ds_optimal) && (raidPtr->numFailures > 0)) {
/* some other component has failed. Let's not make