From 1f113cb32a47282c5ee535a6aeb4da65fd669c50 Mon Sep 17 00:00:00 2001 From: oster Date: Wed, 17 Nov 2004 01:34:10 +0000 Subject: [PATCH] Don't allow -f to fail a disk while a reconstruction is taking place since that would cause a panic. (Problem noticed by dan@.) --- sys/dev/raidframe/rf_netbsdkintf.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index a33a6f17bf7f..5490b8a6ec50 100644 --- a/sys/dev/raidframe/rf_netbsdkintf.c +++ b/sys/dev/raidframe/rf_netbsdkintf.c @@ -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 -__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 #include @@ -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