Don't merge a good parity map with random stuff in the event that the

first component is missing.  (Since the merging just OR's the maps,
this isn't that big of a deal, as it will just over-estimate the
amount of checking that needs to be done.)
This commit is contained in:
oster 2010-03-01 14:51:58 +00:00
parent eb639a8ff6
commit e0010cd0df
1 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_netbsdkintf.c,v 1.271 2009/12/01 01:03:54 dyoung Exp $ */
/* $NetBSD: rf_netbsdkintf.c,v 1.272 2010/03/01 14:51:58 oster Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@ -139,7 +139,7 @@
***********************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.271 2009/12/01 01:03:54 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.272 2010/03/01 14:51:58 oster Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -2610,8 +2610,9 @@ void
rf_paritymap_kern_read(RF_Raid_t *raidPtr, struct rf_paritymap_ondisk *map)
{
struct rf_paritymap_ondisk tmp;
int c;
int c,first;
first=1;
for (c = 0; c < raidPtr->numCol; c++) {
/* Skip dead disks. */
if (RF_DEAD_DISK(raidPtr->Disks[c].status))
@ -2620,8 +2621,9 @@ rf_paritymap_kern_read(RF_Raid_t *raidPtr, struct rf_paritymap_ondisk *map)
raidPtr->raid_cinfo[c].ci_vp, &tmp,
RF_PARITYMAP_NBYTE,
RF_PARITY_MAP_OFFSET, RF_PARITY_MAP_SIZE);
if (c == 0) {
if (first) {
memcpy(map, &tmp, sizeof(*map));
first = 0;
} else {
rf_paritymap_merge(map, &tmp);
}