From 6dfaf0dfc1ad2a0831bbce5417be20f1b1ef9b0d Mon Sep 17 00:00:00 2001 From: kn Date: Mon, 14 Nov 2022 13:39:37 +0000 Subject: [PATCH] Check for offline chunks first, then check for keydisks Like keydisks, offline data chunks also report a size of zero, so skipping zero sized chunks before doing the offline check means not printing the "softraid chunk N not online - skipping..." warning. Restore order to make this warning appear on degraded volumes again. --- usr.sbin/installboot/softraid.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/usr.sbin/installboot/softraid.c b/usr.sbin/installboot/softraid.c index 54780a70e58..c9b5bb3d6ec 100644 --- a/usr.sbin/installboot/softraid.c +++ b/usr.sbin/installboot/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.8 2022/11/08 14:05:41 kn Exp $ */ +/* $OpenBSD: softraid.c,v 1.9 2022/11/14 13:39:37 kn Exp $ */ /* * Copyright (c) 2012 Joel Sing * @@ -161,10 +161,6 @@ sr_open_chunk(int devfd, int vol, int disk, struct bioc_disk *bd, if (ioctl(devfd, BIOCDISK, bd) == -1) err(1, "BIOCDISK"); - /* Keydisks always have a size of zero. */ - if (bd->bd_size == 0) - return -1; - /* Check disk status. */ if (bd->bd_status != BIOC_SDONLINE && bd->bd_status != BIOC_SDREBUILD) { @@ -173,6 +169,10 @@ sr_open_chunk(int devfd, int vol, int disk, struct bioc_disk *bd, return -1; } + /* Keydisks always have a size of zero. */ + if (bd->bd_size == 0) + return -1; + if (strlen(bd->bd_vendor) < 1) errx(1, "invalid disk name"); *part = bd->bd_vendor[strlen(bd->bd_vendor) - 1]; -- 2.20.1