Module Name:    src
Committed By:   andvar
Date:           Sat Apr 16 16:40:54 UTC 2022

Modified Files:
        src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Fix mistake in error branch locking caused by previous changes.
vput(vp) also unlocks vp, thus unlocking happens twice in error flow
causing kernel to panic with failed assertion lktype != LK_NONE
in vfs_vnode.c#778. Thanks riastradh with finding the issue.


To generate a diff of this commit:
cvs rdiff -u -r1.406 -r1.407 src/sys/dev/raidframe/rf_netbsdkintf.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/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.406 src/sys/dev/raidframe/rf_netbsdkintf.c:1.407
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.406	Sat Apr 16 07:57:33 2022
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sat Apr 16 16:40:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.406 2022/04/16 07:57:33 hannken Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.407 2022/04/16 16:40:54 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.406 2022/04/16 07:57:33 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.407 2022/04/16 16:40:54 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -2951,7 +2951,6 @@ rf_find_raid_components(void)
 
 			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 			error = VOP_OPEN(vp, FREAD | FSILENT, NOCRED);
-			VOP_UNLOCK(vp);
 
 			if (error) {
 				/* "Who cares."  Continue looking
@@ -2960,6 +2959,7 @@ rf_find_raid_components(void)
 				continue;
 			}
 
+			VOP_UNLOCK(vp);
 			error = getdisksize(vp, &numsecs, &secsize);
 			if (error) {
 				/*

Reply via email to