Source-Changes-HG archive

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

[src/trunk]: src/sys/kern As VOP_STRATEGY() usually calls itself on the file ...



details:   https://anonhg.NetBSD.org/src/rev/5cdc4466bd3f
branches:  trunk
changeset: 845662:5cdc4466bd3f
user:      hannken <hannken%NetBSD.org@localhost>
date:      Fri Oct 11 08:04:52 2019 +0000

description:
As VOP_STRATEGY() usually calls itself on the file system holding "/dev"
it may deadlock on suspension of this file system.

Add fstrans type LAZY and use it for VOP_STRATEGY().

Adress PR kern/53624 (dom0 freeze on domU exit) is still there

diffstat:

 sys/kern/vnode_if.sh  |  10 ++++++----
 sys/kern/vnode_if.src |   3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diffs (65 lines):

diff -r f4ff6d8a53ee -r 5cdc4466bd3f sys/kern/vnode_if.sh
--- a/sys/kern/vnode_if.sh      Fri Oct 11 04:25:11 2019 +0000
+++ b/sys/kern/vnode_if.sh      Fri Oct 11 08:04:52 2019 +0000
@@ -29,7 +29,7 @@
  * SUCH DAMAGE.
  */
 "
-SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.66 2017/06/04 08:03:26 hannken Exp $'
+SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.67 2019/10/11 08:04:52 hannken Exp $'
 
 # Script to produce VFS front-end sugar.
 #
@@ -318,7 +318,7 @@
 
 if [ -z "${rump}" ] ; then
        echo "
-enum fst_op { FST_NO, FST_YES, FST_TRY };
+enum fst_op { FST_NO, FST_YES, FST_LAZY, FST_TRY };
 
 static inline int
 vop_pre(vnode_t *vp, struct mount **mp, bool *mpsafe, enum fst_op op)
@@ -331,7 +331,7 @@
                KERNEL_LOCK(1, curlwp);
        }
 
-       if (op == FST_YES || op == FST_TRY) {
+       if (op == FST_YES || op == FST_LAZY || op == FST_TRY) {
                for (;;) {
                        *mp = vp->v_mount;
                        if (op == FST_TRY) {
@@ -342,6 +342,8 @@
                                        }
                                        return error;
                                }
+                       } else if (op == FST_LAZY) {
+                               fstrans_start_lazy(*mp);
                        } else {
                                fstrans_start(*mp);
                        }
@@ -360,7 +362,7 @@
 vop_post(vnode_t *vp, struct mount *mp, bool mpsafe, enum fst_op op)
 {
 
-       if (op == FST_YES) {
+       if (op == FST_YES || op == FST_LAZY) {
                fstrans_done(mp);
        }
 
diff -r f4ff6d8a53ee -r 5cdc4466bd3f sys/kern/vnode_if.src
--- a/sys/kern/vnode_if.src     Fri Oct 11 04:25:11 2019 +0000
+++ b/sys/kern/vnode_if.src     Fri Oct 11 08:04:52 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 hannken Exp $
+#      $NetBSD: vnode_if.src,v 1.78 2019/10/11 08:04:52 hannken Exp $
 #
 # Copyright (c) 1992, 1993
 #      The Regents of the University of California.  All rights reserved.
@@ -436,6 +436,7 @@
 #% strategy   vp      = = =
 #
 vop_strategy {
+       FSTRANS=LAZY
        IN struct vnode *vp;
        IN struct buf *bp;
 };



Home | Main Index | Thread Index | Old Index