summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2022-11-14 13:39:38 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2022-11-14 13:39:38 +0000
commit357ebe2434acff2a3575407ba54ff1083649b248 (patch)
treebf139db7fa9281abb48b5f51f1da2e1be5f9b56f /usr.sbin
parent7d35ebf664211e9f802b841eb13ea10c34f2469b (diff)
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.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/installboot/softraid.c10
1 files 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 <jsing@openbsd.org>
*
@@ -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];