Module Name:    src
Committed By:   riastradh
Date:           Mon Aug 22 00:19:53 UTC 2022

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

Log Message:
dk(4): Turn locking contract comment into assertions in dklastclose.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 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.116 src/sys/dev/dkwedge/dk.c:1.117
--- src/sys/dev/dkwedge/dk.c:1.116	Mon Aug 22 00:19:43 2022
+++ src/sys/dev/dkwedge/dk.c	Mon Aug 22 00:19:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: dk.c,v 1.116 2022/08/22 00:19:43 riastradh Exp $	*/
+/*	$NetBSD: dk.c,v 1.117 2022/08/22 00:19:53 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.116 2022/08/22 00:19:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.117 2022/08/22 00:19:53 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1199,15 +1199,15 @@ dkopen(dev_t dev, int flags, int fmt, st
 	return (error);
 }
 
-/*
- * Caller must hold sc->sc_dk.dk_openlock and sc->sc_parent->dk_rawlock.
- */
 static int
 dklastclose(struct dkwedge_softc *sc)
 {
 	struct vnode *vp;
 	int error = 0, mode;
 
+	KASSERT(mutex_owned(&sc->sc_dk.dk_openlock));
+	KASSERT(mutex_owned(&sc->sc_parent->dk_rawlock));
+
 	mode = sc->sc_mode;
 
 	vp = NULL;

Reply via email to