From 73225b15a57e8a02236a612f1bc77c83488fabb4 Mon Sep 17 00:00:00 2001 From: oster Date: Sat, 20 Dec 2008 17:04:51 +0000 Subject: When unconfiguring an array where a reconstruct is in progress, abort the reconstruct and wait for IOs to drain before pulling the plug. Should fix the panic reported by der Mouse on tech-kern. --- sys/dev/raidframe/rf_driver.c | 15 ++++++++++++--- sys/dev/raidframe/rf_reconstruct.c | 10 ++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) (limited to 'sys/dev/raidframe') diff --git a/sys/dev/raidframe/rf_driver.c b/sys/dev/raidframe/rf_driver.c index e7c17e18194..866db00cffc 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.119 2008/11/18 14:29:55 ad Exp $ */ +/* $NetBSD: rf_driver.c,v 1.120 2008/12/20 17:04:51 oster Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -66,7 +66,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.119 2008/11/18 14:29:55 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.120 2008/12/20 17:04:51 oster Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_diagnostic.h" @@ -225,11 +225,20 @@ rf_Shutdown(RF_Raid_t *raidPtr) /* Wait for any parity re-writes to stop... */ while (raidPtr->parity_rewrite_in_progress) { - printf("Waiting for parity re-write to exit...\n"); + printf("raid%d: Waiting for parity re-write to exit...\n", + raidPtr->raidid); tsleep(&raidPtr->parity_rewrite_in_progress, PRIBIO, "rfprwshutdown", 0); } + /* Wait for any reconstruction to stop... */ + while (raidPtr->reconInProgress) { + printf("raid%d: Waiting for reconstruction to stop...\n", + raidPtr->raidid); + tsleep(&raidPtr->waitForReconCond, PRIBIO, + "rfreshutdown",0); + } + raidPtr->valid = 0; rf_update_component_labels(raidPtr, RF_FINAL_COMPONENT_UPDATE); diff --git a/sys/dev/raidframe/rf_reconstruct.c b/sys/dev/raidframe/rf_reconstruct.c index 7ee21cab119..c89b5d0030e 100644 --- a/sys/dev/raidframe/rf_reconstruct.c +++ b/sys/dev/raidframe/rf_reconstruct.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_reconstruct.c,v 1.105 2008/09/23 21:36:35 oster Exp $ */ +/* $NetBSD: rf_reconstruct.c,v 1.106 2008/12/20 17:04:51 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ ************************************************************/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.105 2008/09/23 21:36:35 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.106 2008/12/20 17:04:51 oster Exp $"); #include #include @@ -626,6 +626,12 @@ rf_ContinueReconstructFailedDisk(RF_RaidReconDesc_t *reconDesc) done = 0; while (!done) { + if (raidPtr->waitShutdown) { + /* someone is unconfiguring this array... bail on the reconstruct.. */ + recon_error = 1; + break; + } + num_writes = 0; /* issue a read for each surviving disk */ -- cgit