summaryrefslogtreecommitdiff
path: root/sys/kern/subr_disk.c
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2012-01-13 14:39:32 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2012-01-13 14:39:32 +0000
commit4e1c2b5a725511b008102fd74d27642c474aade6 (patch)
treee34aceb79d2b0f3952a31de355797472ee0ddf45 /sys/kern/subr_disk.c
parent4d7b81f3cdab455ba5567d9961ebd981be604103 (diff)
Always set DKF_OPENED in the disk attach callback.
Diffstat (limited to 'sys/kern/subr_disk.c')
-rw-r--r--sys/kern/subr_disk.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index b3b5ce92ef8..10d181c6fa2 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_disk.c,v 1.138 2012/01/13 14:16:51 jsing Exp $ */
+/* $OpenBSD: subr_disk.c,v 1.139 2012/01/13 14:39:31 jsing Exp $ */
/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
@@ -871,19 +871,21 @@ disk_attach_callback(void *arg1, void *arg2)
if (dk->dk_devno == dev)
break;
}
- if (dk == NULL || (dk->dk_flags & (DKF_OPENED | DKF_NOLABELREAD))) {
- wakeup(dk);
+ if (dk == NULL)
return;
- }
/* XXX: Assumes dk is part of the device softc. */
device_ref(dk->dk_device);
+ if (dk->dk_flags & (DKF_OPENED | DKF_NOLABELREAD))
+ goto done;
+
/* Read disklabel. */
if (disk_readlabel(&dl, dev, errbuf, sizeof(errbuf)) == NULL)
dk->dk_flags |= DKF_LABELVALID;
- dk->dk_flags |= DKF_OPENED;
+done:
+ dk->dk_flags |= DKF_OPENED;
device_unref(dk->dk_device);
wakeup(dk);
}