Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/raidframe Fix mistake in error branch locking caused...



details:   https://anonhg.NetBSD.org/src/rev/b9f32d2de053
branches:  trunk
changeset: 365260:b9f32d2de053
user:      andvar <andvar%NetBSD.org@localhost>
date:      Sat Apr 16 16:40:54 2022 +0000

description:
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.

diffstat:

 sys/dev/raidframe/rf_netbsdkintf.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 758693eed4ae -r b9f32d2de053 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Sat Apr 16 15:55:10 2022 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Sat Apr 16 16:40:54 2022 +0000
@@ -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 @@
 
                        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 @@
                                continue;
                        }
 
+                       VOP_UNLOCK(vp);
                        error = getdisksize(vp, &numsecs, &secsize);
                        if (error) {
                                /*



Home | Main Index | Thread Index | Old Index