diff options
author | jeff <jeff@FreeBSD.org> | 2002-07-06 05:21:12 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-07-06 05:21:12 +0000 |
commit | 908b0eb9a78bba073426ca3522bc7b515b842766 (patch) | |
tree | a96ed0b6d873203e3dcbda0abadbe2bee9137d8c | |
parent | 6060f5331d29dd10551872e1ca335518c638a482 (diff) | |
download | FreeBSD-src-908b0eb9a78bba073426ca3522bc7b515b842766.zip FreeBSD-src-908b0eb9a78bba073426ca3522bc7b515b842766.tar.gz |
- Add vop_strategy_pre to validate VOP_STRATEGY locking.
- Disable original vop_strategy lock specification.
- Switch to the new vop_strategy_pre for lock validation.
VOP_STRATEGY requires only that the buf is locked UNLESS the block numbers need
to be translated. There may be other reasons, but as long as the underlying
layer uses a VOP to perform the operations they will be caught later.
-rw-r--r-- | sys/kern/vfs_subr.c | 16 | ||||
-rw-r--r-- | sys/sys/vnode.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index fb7ba43..882fc39 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -253,6 +253,22 @@ vop_rename_pre(void *ap) ASSERT_VOP_LOCKED(a->a_tdvp, "vop_rename: tdvp not locked.\n"); } +void +vop_strategy_pre(void *ap) +{ + struct vop_strategy_args *a = ap; + int status; + + status = lockstatus(&a->a_bp->b_lock, curthread); + + if (status != LK_SHARED && status != LK_EXCLUSIVE) { + if (vfs_badlock_print) + printf("VOP_STRATEGY: bp is not locked but should be.\n"); + if (vfs_badlock_panic) + Debugger("Lock violation.\n"); + } +} + #endif /* DEBUG_VFS_LOCKS */ void diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 4e315d7..71e9236 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -524,6 +524,7 @@ do { \ } while (0) void vop_rename_pre(void *a); +void vop_strategy_pre(void *a); #else |