Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Keep vnode locked during VOP_RECLAIM.



details:   https://anonhg.NetBSD.org/src/rev/f6fa4a1ff5e9
branches:  trunk
changeset: 823197:f6fa4a1ff5e9
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Apr 15 23:16:53 2017 +0000

description:
Keep vnode locked during VOP_RECLAIM.

No bump because it wouldn't have been possible to acquire the lock in
VOP_RECLAIM anyway -- instant deadlock because vn_lock waits to
transition out of the RECLAIMING state first.  Benefit is that we can
now assert ownership of the lock in any operations called by
VOP_RECLAIM.

Discussed on tech-kern:

https://mail-index.netbsd.org/tech-kern/2017/04/01/msg021751.html

diffstat:

 sys/kern/vfs_vnode.c  |  6 +++---
 sys/kern/vnode_if.src |  6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (53 lines):

diff -r b3873f0c6fe0 -r f6fa4a1ff5e9 sys/kern/vfs_vnode.c
--- a/sys/kern/vfs_vnode.c      Sat Apr 15 22:01:57 2017 +0000
+++ b/sys/kern/vfs_vnode.c      Sat Apr 15 23:16:53 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_vnode.c,v 1.83 2017/04/11 14:45:46 riastradh Exp $ */
+/*     $NetBSD: vfs_vnode.c,v 1.84 2017/04/15 23:16:53 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.83 2017/04/11 14:45:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.84 2017/04/15 23:16:53 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -1554,10 +1554,10 @@
         * Note that the VOP_INACTIVE will not unlock the vnode.
         */
        VOP_INACTIVE(vp, &recycle);
-       VOP_UNLOCK(vp);
        if (VOP_RECLAIM(vp)) {
                vnpanic(vp, "%s: cannot reclaim", __func__);
        }
+       VOP_UNLOCK(vp);
 
        KASSERT(vp->v_data == NULL);
        KASSERT(vp->v_uobj.uo_npages == 0);
diff -r b3873f0c6fe0 -r f6fa4a1ff5e9 sys/kern/vnode_if.src
--- a/sys/kern/vnode_if.src     Sat Apr 15 22:01:57 2017 +0000
+++ b/sys/kern/vnode_if.src     Sat Apr 15 23:16:53 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: vnode_if.src,v 1.71 2017/04/11 14:25:00 riastradh Exp $
+#      $NetBSD: vnode_if.src,v 1.72 2017/04/15 23:16:53 riastradh Exp $
 #
 # Copyright (c) 1992, 1993
 #      The Regents of the University of California.  All rights reserved.
@@ -393,11 +393,11 @@
 };
 
 #
-#% reclaim    vp      U U U
+#% reclaim    vp      L L L
 #
 vop_reclaim {
        FSTRANS=NO
-       IN LOCKED=NO struct vnode *vp;
+       IN LOCKED=YES struct vnode *vp;
 };
 
 #



Home | Main Index | Thread Index | Old Index