Source-Changes-HG archive

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

[src/trunk]: src/sys/miscfs/specfs Avoid a race with spec_revoke for the asse...



details:   https://anonhg.NetBSD.org/src/rev/44a494a15d53
branches:  trunk
changeset: 344549:44a494a15d53
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Apr 04 08:03:53 2016 +0000

description:
Avoid a race with spec_revoke for the assertion too.

Final fix for PR kern/50467 Panic from disconnecting phone while reading
its contents

diffstat:

 sys/miscfs/specfs/spec_vnops.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 2531a89539e3 -r 44a494a15d53 sys/miscfs/specfs/spec_vnops.c
--- a/sys/miscfs/specfs/spec_vnops.c    Mon Apr 04 07:37:07 2016 +0000
+++ b/sys/miscfs/specfs/spec_vnops.c    Mon Apr 04 08:03:53 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: spec_vnops.c,v 1.161 2016/03/26 14:58:13 hannken Exp $ */
+/*     $NetBSD: spec_vnops.c,v 1.162 2016/04/04 08:03:53 hannken Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.161 2016/03/26 14:58:13 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.162 2016/04/04 08:03:53 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -1041,6 +1041,7 @@
 
        mutex_enter(vp->v_interlock);
        if (vdead_check(vp, VDEAD_NOWAIT) == 0 && vp->v_specnode != NULL) {
+               KASSERT(vp == vp->v_specnode->sn_dev->sd_bdevvp);
                dev = vp->v_rdev;
        }
        mutex_exit(vp->v_interlock);
@@ -1051,8 +1052,6 @@
        }
        bp->b_dev = dev;
 
-       KASSERT(vp == vp->v_specnode->sn_dev->sd_bdevvp);
-
        if (!(bp->b_flags & B_READ)) {
                error = fscow_run(bp, false);
                if (error)



Home | Main Index | Thread Index | Old Index