summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_subr.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2002-07-06 05:21:12 +0000
committerjeff <jeff@FreeBSD.org>2002-07-06 05:21:12 +0000
commit908b0eb9a78bba073426ca3522bc7b515b842766 (patch)
treea96ed0b6d873203e3dcbda0abadbe2bee9137d8c /sys/kern/vfs_subr.c
parent6060f5331d29dd10551872e1ca335518c638a482 (diff)
downloadFreeBSD-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.
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r--sys/kern/vfs_subr.c16
1 files changed, 16 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
OpenPOWER on IntegriCloud