From 8c39e1bf02b630a157629c0686a8656dc8e9d881 Mon Sep 17 00:00:00 2001 From: oster Date: Fri, 4 Jun 1999 02:02:39 +0000 Subject: [PATCH] When adding a hot spare, remember to lock down the main raidPtr structure before mucking with its contents. --- sys/dev/raidframe/rf_disks.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/raidframe/rf_disks.c b/sys/dev/raidframe/rf_disks.c index 0df84d1775be..fc25a0c4b1d7 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.9 1999/06/04 01:50:01 oster Exp $ */ +/* $NetBSD: rf_disks.c,v 1.10 1999/06/04 02:02:39 oster Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -791,6 +791,8 @@ rf_add_hot_spare(raidPtr, sparePtr) return(EINVAL); } + RF_LOCK_MUTEX(raidPtr->mutex); + /* the beginning of the spares... */ disks = &raidPtr->Disks[0][raidPtr->numCol]; @@ -854,9 +856,11 @@ rf_add_hot_spare(raidPtr, sparePtr) raidPtr->numSpare++; + RF_UNLOCK_MUTEX(raidPtr->mutex); return (0); fail: + RF_UNLOCK_MUTEX(raidPtr->mutex); return(ret); }