Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/union As FSTRANS is part of VOP_*LOCK() since June 4,...



details:   https://anonhg.NetBSD.org/src/rev/93ec5a4c7397
branches:  trunk
changeset: 364365:93ec5a4c7397
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sat Mar 19 13:48:04 2022 +0000

description:
As FSTRANS is part of VOP_*LOCK() since June 4, 2017 the vdead_check()
from union_lock() is no longer needed.

Adapt union_lock() to the recent addition of upgrade or downgrade.

VV_LOCKSWORK now.

diffstat:

 sys/fs/union/union_subr.c  |   5 +++--
 sys/fs/union/union_vnops.c |  23 +++--------------------
 2 files changed, 6 insertions(+), 22 deletions(-)

diffs (84 lines):

diff -r a95f6bd3c5fa -r 93ec5a4c7397 sys/fs/union/union_subr.c
--- a/sys/fs/union/union_subr.c Sat Mar 19 11:55:03 2022 +0000
+++ b/sys/fs/union/union_subr.c Sat Mar 19 13:48:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: union_subr.c,v 1.79 2020/08/18 09:44:07 hannken Exp $  */
+/*     $NetBSD: union_subr.c,v 1.80 2022/03/19 13:48:04 hannken Exp $  */
 
 /*
  * Copyright (c) 1994
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.79 2020/08/18 09:44:07 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.80 2022/03/19 13:48:04 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -567,6 +567,7 @@
 
        vp->v_tag = VT_UNION;
        vp->v_op = union_vnodeop_p;
+       vp->v_vflag |= VV_LOCKSWORK;
        vp->v_data = un;
        un->un_vnode = vp;
 
diff -r a95f6bd3c5fa -r 93ec5a4c7397 sys/fs/union/union_vnops.c
--- a/sys/fs/union/union_vnops.c        Sat Mar 19 11:55:03 2022 +0000
+++ b/sys/fs/union/union_vnops.c        Sat Mar 19 13:48:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: union_vnops.c,v 1.82 2021/12/10 19:30:05 andvar Exp $  */
+/*     $NetBSD: union_vnops.c,v 1.83 2022/03/19 13:48:04 hannken Exp $ */
 
 /*
  * Copyright (c) 1992, 1993, 1994, 1995
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.82 2021/12/10 19:30:05 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.83 2022/03/19 13:48:04 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1709,15 +1709,6 @@
                lockvp = LOCKVP(vp);
                error = union_lock1(vp, lockvp, flags);
                mutex_exit(&un->un_lock);
-               if (error)
-                       return error;
-               if (mutex_tryenter(vp->v_interlock)) {
-                       error = vdead_check(vp, VDEAD_NOWAIT);
-                       mutex_exit(vp->v_interlock);
-               } else
-                       error = EBUSY;
-               if (error)
-                       union_unlock1(vp, lockvp);
                return error;
        }
 
@@ -1726,7 +1717,7 @@
                lockvp = LOCKVP(vp);
                mutex_exit(&un->un_lock);
                error = union_lock1(vp, lockvp, flags);
-               if (error != 0)
+               if (error != 0 || (flags & (LK_DOWNGRADE | LK_UPGRADE)) != 0)
                        return error;
                mutex_enter(&un->un_lock);
                if (lockvp == LOCKVP(vp))
@@ -1735,14 +1726,6 @@
        }
        mutex_exit(&un->un_lock);
 
-       mutex_enter(vp->v_interlock);
-       error = vdead_check(vp, VDEAD_NOWAIT);
-       if (error) {
-               union_unlock1(vp, lockvp);
-               error = vdead_check(vp, 0);
-               KASSERT(error == ENOENT);
-       }
-       mutex_exit(vp->v_interlock);
        return error;
 }
 



Home | Main Index | Thread Index | Old Index