Module Name:    src
Committed By:   riastradh
Date:           Mon Aug 22 00:20:18 UTC 2022

Modified Files:
        src/sys/dev/dkwedge: dk.c

Log Message:
dk(4): Assert parent is open in dklastclose.

It is not possible for us to be closing a wedge whose parent is not
open by at least this wedge.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/dev/dkwedge/dk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/dkwedge/dk.c
diff -u src/sys/dev/dkwedge/dk.c:1.118 src/sys/dev/dkwedge/dk.c:1.119
--- src/sys/dev/dkwedge/dk.c:1.118	Mon Aug 22 00:20:03 2022
+++ src/sys/dev/dkwedge/dk.c	Mon Aug 22 00:20:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: dk.c,v 1.118 2022/08/22 00:20:03 riastradh Exp $	*/
+/*	$NetBSD: dk.c,v 1.119 2022/08/22 00:20:18 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.118 2022/08/22 00:20:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.119 2022/08/22 00:20:18 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1223,6 +1223,7 @@ dklastclose(struct dkwedge_softc *sc)
 
 	KASSERT(mutex_owned(&sc->sc_dk.dk_openlock));
 	KASSERT(mutex_owned(&sc->sc_parent->dk_rawlock));
+	KASSERT(sc->sc_parent->dk_rawopens > 0);
 
 	mode = sc->sc_mode;
 

Reply via email to