From: stsp Date: Mon, 29 Aug 2022 19:01:52 +0000 (+0000) Subject: Examine RAID-1C-specific softraid(4) meta-data when checking for X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5886cc40c4780585f1b3d71b803821046fd5c1b3;p=openbsd 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@ --- 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 * Copyright (c) 2008 Chris Kuethe @@ -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;