Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/miscfs/genfs Now that FSTRANS is part of VOP_*LOCK() rem...
details: https://anonhg.NetBSD.org/src/rev/fbb34359f89e
branches: trunk
changeset: 354105:fbb34359f89e
user: hannken <hannken%NetBSD.org@localhost>
date: Sun Jun 04 08:01:33 2017 +0000
description:
Now that FSTRANS is part of VOP_*LOCK() remove FSTRANS and vdead_check()
from genfs_.*lock() and assert the vnode state once the vnode is locked.
diffstat:
sys/miscfs/genfs/genfs_vnops.c | 76 +++++++----------------------------------
1 files changed, 13 insertions(+), 63 deletions(-)
diffs (126 lines):
diff -r 8d6c278d8a1d -r fbb34359f89e sys/miscfs/genfs/genfs_vnops.c
--- a/sys/miscfs/genfs/genfs_vnops.c Sun Jun 04 08:00:27 2017 +0000
+++ b/sys/miscfs/genfs/genfs_vnops.c Sun Jun 04 08:01:33 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_vnops.c,v 1.195 2017/04/11 14:29:32 riastradh Exp $ */
+/* $NetBSD: genfs_vnops.c,v 1.196 2017/06/04 08:01:33 hannken Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.195 2017/04/11 14:29:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.196 2017/06/04 08:01:33 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -288,41 +288,18 @@
vnode_impl_t *vip = VNODE_TO_VIMPL(vp);
int flags = ap->a_flags;
krw_t op;
- int error;
+
+ if (! ISSET(flags, LK_RETRY))
+ return ENOENT;
op = (ISSET(flags, LK_EXCLUSIVE) ? RW_WRITER : RW_READER);
if (ISSET(flags, LK_NOWAIT)) {
if (! rw_tryenter(vip->vi_lock, op))
return EBUSY;
- if (mutex_tryenter(vp->v_interlock)) {
- error = vdead_check(vp, VDEAD_NOWAIT);
- if (error == ENOENT && ISSET(flags, LK_RETRY))
- error = 0;
- mutex_exit(vp->v_interlock);
- } else
- error = EBUSY;
- if (error)
- rw_exit(vip->vi_lock);
- return error;
+ } else {
+ rw_enter(vip->vi_lock, op);
}
-
- rw_enter(vip->vi_lock, op);
- mutex_enter(vp->v_interlock);
- error = vdead_check(vp, VDEAD_NOWAIT);
- if (error == EBUSY) {
- rw_exit(vip->vi_lock);
- error = vdead_check(vp, 0);
- KASSERT(error == ENOENT);
- mutex_exit(vp->v_interlock);
- rw_enter(vip->vi_lock, op);
- mutex_enter(vp->v_interlock);
- }
- KASSERT(error == ENOENT);
- mutex_exit(vp->v_interlock);
- if (! ISSET(flags, LK_RETRY)) {
- rw_exit(vip->vi_lock);
- return ENOENT;
- }
+ VSTATE_ASSERT_UNLOCKED(vp, VS_RECLAIMED);
return 0;
}
@@ -355,43 +332,18 @@
} */ *ap = v;
vnode_t *vp = ap->a_vp;
vnode_impl_t *vip = VNODE_TO_VIMPL(vp);
- struct mount *mp = vp->v_mount;
int flags = ap->a_flags;
krw_t op;
- int error;
op = (ISSET(flags, LK_EXCLUSIVE) ? RW_WRITER : RW_READER);
if (ISSET(flags, LK_NOWAIT)) {
- if (fstrans_start_nowait(mp, FSTRANS_SHARED))
- return EBUSY;
- if (! rw_tryenter(vip->vi_lock, op)) {
- fstrans_done(mp);
+ if (! rw_tryenter(vip->vi_lock, op))
return EBUSY;
- }
- if (mutex_tryenter(vp->v_interlock)) {
- error = vdead_check(vp, VDEAD_NOWAIT);
- mutex_exit(vp->v_interlock);
- } else
- error = EBUSY;
- if (error) {
- rw_exit(vip->vi_lock);
- fstrans_done(mp);
- }
- return error;
+ } else {
+ rw_enter(vip->vi_lock, op);
}
-
- fstrans_start(mp, FSTRANS_SHARED);
- rw_enter(vip->vi_lock, op);
- mutex_enter(vp->v_interlock);
- error = vdead_check(vp, VDEAD_NOWAIT);
- if (error) {
- rw_exit(vip->vi_lock);
- fstrans_done(mp);
- error = vdead_check(vp, 0);
- KASSERT(error == ENOENT);
- }
- mutex_exit(vp->v_interlock);
- return error;
+ VSTATE_ASSERT_UNLOCKED(vp, VS_ACTIVE);
+ return 0;
}
/*
@@ -405,10 +357,8 @@
} */ *ap = v;
vnode_t *vp = ap->a_vp;
vnode_impl_t *vip = VNODE_TO_VIMPL(vp);
- struct mount *mp = vp->v_mount;
rw_exit(vip->vi_lock);
- fstrans_done(mp);
return 0;
}
Home |
Main Index |
Thread Index |
Old Index