summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2022-08-29 19:01:53 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2022-08-29 19:01:53 +0000
commit035767cb71d5a19879432c16b9faf5197e56f167 (patch)
tree57cdf6b14a1b6181564463a7ac702fda7ac77fb7
parent443f2755385666b6e4aa0142c44bd988c70b0462 (diff)
Examine RAID-1C-specific softraid(4) meta-data when checking for
a key disk which is associated with a RAID-1C volume. ok jsing@, style tweak + ok kn@
-rw-r--r--sys/dev/softraid.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 762f6ee57d5..ebf092a40e5 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.425 2022/04/16 19:19:58 naddy Exp $ */
+/* $OpenBSD: softraid.c,v 1.426 2022/08/29 19:01:52 stsp Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -2593,10 +2593,12 @@ sr_ioctl_vol(struct sr_softc *sc, struct bioc_vol *bv)
bv->bv_nodisk = sd->sd_meta->ssdi.ssd_chunk_no;
#ifdef CRYPTO
- if ((sd->sd_meta->ssdi.ssd_level == 'C' ||
- sd->sd_meta->ssdi.ssd_level == 0x1C) &&
+ if (sd->sd_meta->ssdi.ssd_level == 'C' &&
sd->mds.mdd_crypto.key_disk != NULL)
bv->bv_nodisk++;
+ else if (sd->sd_meta->ssdi.ssd_level == 0x1C &&
+ sd->mds.mdd_raid1c.sr1c_crypto.key_disk != NULL)
+ bv->bv_nodisk++;
#endif
if (bv->bv_status == BIOC_SVREBUILD)
bv->bv_percent = sr_rebuild_percent(sd);
@@ -2650,10 +2652,13 @@ sr_ioctl_disk(struct sr_softc *sc, struct bioc_disk *bd)
src = sd->sd_vol.sv_chunks[bd->bd_diskid];
#ifdef CRYPTO
else if (bd->bd_diskid == sd->sd_meta->ssdi.ssd_chunk_no &&
- (sd->sd_meta->ssdi.ssd_level == 'C' ||
- sd->sd_meta->ssdi.ssd_level == 0x1C) &&
+ sd->sd_meta->ssdi.ssd_level == 'C' &&
sd->mds.mdd_crypto.key_disk != NULL)
src = sd->mds.mdd_crypto.key_disk;
+ else if (bd->bd_diskid == sd->sd_meta->ssdi.ssd_chunk_no &&
+ sd->sd_meta->ssdi.ssd_level == 0x1C &&
+ sd->mds.mdd_raid1c.sr1c_crypto.key_disk != NULL)
+ src = sd->mds.mdd_crypto.key_disk;
#endif
else
break;