summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-06-15 18:53:00 +0000
committerphk <phk@FreeBSD.org>2003-06-15 18:53:00 +0000
commit24cc9156fe9b5c2e779cc33134e9821873057333 (patch)
tree68a65c9d3593abaee8f4a7c6f0b683e5d30c43fe
parent69776c10822e68c24101edbb82aec156257044a9 (diff)
downloadFreeBSD-src-24cc9156fe9b5c2e779cc33134e9821873057333.zip
FreeBSD-src-24cc9156fe9b5c2e779cc33134e9821873057333.tar.gz
Add the same KASSERT to all VOP_STRATEGY and VOP_SPECSTRATEGY implementations
to check that the buffer points to the correct vnode.
-rw-r--r--sys/fs/cd9660/cd9660_vnops.c2
-rw-r--r--sys/fs/hpfs/hpfs_vnops.c2
-rw-r--r--sys/fs/msdosfs/msdosfs_vnops.c2
-rw-r--r--sys/fs/ntfs/ntfs_vnops.c2
-rw-r--r--sys/fs/nwfs/nwfs_vnops.c2
-rw-r--r--sys/fs/smbfs/smbfs_vnops.c2
-rw-r--r--sys/fs/specfs/spec_vnops.c4
-rw-r--r--sys/fs/udf/udf_vnops.c2
-rw-r--r--sys/fs/unionfs/union_vnops.c2
-rw-r--r--sys/gnu/ext2fs/ext2_vnops.c2
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vnops.c2
-rw-r--r--sys/isofs/cd9660/cd9660_vnops.c2
-rw-r--r--sys/nfsclient/nfs_vnops.c2
-rw-r--r--sys/ufs/ffs/ffs_vnops.c2
-rw-r--r--sys/ufs/ufs/ufs_vnops.c2
-rw-r--r--sys/vm/vm_swap.c2
16 files changed, 34 insertions, 0 deletions
diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c
index 69b41a9..bf95bf7 100644
--- a/sys/fs/cd9660/cd9660_vnops.c
+++ b/sys/fs/cd9660/cd9660_vnops.c
@@ -718,6 +718,8 @@ cd9660_strategy(ap)
struct vnode *vp = bp->b_vp;
struct iso_node *ip;
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
ip = VTOI(vp);
if (vp->v_type == VBLK || vp->v_type == VCHR)
panic("cd9660_strategy: spec");
diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c
index 51d445d..c517000 100644
--- a/sys/fs/hpfs/hpfs_vnops.c
+++ b/sys/fs/hpfs/hpfs_vnops.c
@@ -651,6 +651,8 @@ hpfs_strategy(ap)
daddr_t blkno;
int error;
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
dprintf(("hpfs_strategy(): \n"));
if (vp->v_type == VBLK || vp->v_type == VCHR)
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 1dba6bb..6a83414 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -1749,6 +1749,8 @@ msdosfs_strategy(ap)
int error = 0;
daddr_t blkno;
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
if (bp->b_vp->v_type == VBLK || bp->b_vp->v_type == VCHR)
panic("msdosfs_strategy: spec");
/*
diff --git a/sys/fs/ntfs/ntfs_vnops.c b/sys/fs/ntfs/ntfs_vnops.c
index 9f86f1e..c24c9bf 100644
--- a/sys/fs/ntfs/ntfs_vnops.c
+++ b/sys/fs/ntfs/ntfs_vnops.c
@@ -282,6 +282,8 @@ ntfs_strategy(ap)
struct ntfsmount *ntmp = ip->i_mp;
int error;
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
dprintf(("ntfs_strategy: offset: %d, blkno: %d, lblkno: %d\n",
(u_int32_t)bp->b_offset,(u_int32_t)bp->b_blkno,
(u_int32_t)bp->b_lblkno));
diff --git a/sys/fs/nwfs/nwfs_vnops.c b/sys/fs/nwfs/nwfs_vnops.c
index a026eae..7dcc48a 100644
--- a/sys/fs/nwfs/nwfs_vnops.c
+++ b/sys/fs/nwfs/nwfs_vnops.c
@@ -796,6 +796,8 @@ static int nwfs_strategy (ap)
struct thread *td;
int error = 0;
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
NCPVNDEBUG("\n");
if (bp->b_flags & B_PHYS)
panic("nwfs physio");
diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c
index 20bd9c6..7ee89a62 100644
--- a/sys/fs/smbfs/smbfs_vnops.c
+++ b/sys/fs/smbfs/smbfs_vnops.c
@@ -886,6 +886,8 @@ smbfs_strategy (ap)
struct thread *td;
int error = 0;
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
SMBVDEBUG("\n");
if (bp->b_flags & B_PHYS)
panic("smbfs physio");
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index b53c819..89e6af2 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -531,6 +531,8 @@ spec_strategy(ap)
{
static int once;
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
if (!once) {
vprint("VOP_STRATEGY on VCHR", ap->a_vp);
backtrace();
@@ -547,6 +549,8 @@ spec_specstrategy(ap)
} */ *ap;
{
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
return spec_xstrategy(ap->a_vp, ap->a_bp);
}
diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c
index 5827483..046d83e 100644
--- a/sys/fs/udf/udf_vnops.c
+++ b/sys/fs/udf/udf_vnops.c
@@ -819,6 +819,8 @@ udf_strategy(struct vop_strategy_args *a)
vp = bp->b_vp;
node = VTON(vp);
+ KASSERT(a->a_vp == a->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, a->a_vp, a->a_bp->b_vp));
/* cd9660 has this test reversed, but it seems more logical this way */
if (bp->b_blkno != bp->b_lblkno) {
/*
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c
index 4862642..401567d 100644
--- a/sys/fs/unionfs/union_vnops.c
+++ b/sys/fs/unionfs/union_vnops.c
@@ -1830,6 +1830,8 @@ union_strategy(ap)
struct buf *bp = ap->a_bp;
struct vnode *othervp = OTHERVP(bp->b_vp);
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
#ifdef DIAGNOSTIC
if (othervp == NULLVP)
panic("union_strategy: nil vp");
diff --git a/sys/gnu/ext2fs/ext2_vnops.c b/sys/gnu/ext2fs/ext2_vnops.c
index 7f76f7c..43fd210 100644
--- a/sys/gnu/ext2fs/ext2_vnops.c
+++ b/sys/gnu/ext2fs/ext2_vnops.c
@@ -1461,6 +1461,8 @@ ext2_strategy(ap)
int32_t blkno;
int error;
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
ip = VTOI(vp);
if (vp->v_type == VBLK || vp->v_type == VCHR)
panic("ext2_strategy: spec");
diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c
index 7f76f7c..43fd210 100644
--- a/sys/gnu/fs/ext2fs/ext2_vnops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vnops.c
@@ -1461,6 +1461,8 @@ ext2_strategy(ap)
int32_t blkno;
int error;
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
ip = VTOI(vp);
if (vp->v_type == VBLK || vp->v_type == VCHR)
panic("ext2_strategy: spec");
diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c
index 69b41a9..bf95bf7 100644
--- a/sys/isofs/cd9660/cd9660_vnops.c
+++ b/sys/isofs/cd9660/cd9660_vnops.c
@@ -718,6 +718,8 @@ cd9660_strategy(ap)
struct vnode *vp = bp->b_vp;
struct iso_node *ip;
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
ip = VTOI(vp);
if (vp->v_type == VBLK || vp->v_type == VCHR)
panic("cd9660_strategy: spec");
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c
index 3a52302..2e4fe05 100644
--- a/sys/nfsclient/nfs_vnops.c
+++ b/sys/nfsclient/nfs_vnops.c
@@ -2552,6 +2552,8 @@ nfs_strategy(struct vop_strategy_args *ap)
struct thread *td;
int error = 0;
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
KASSERT(!(bp->b_flags & B_DONE), ("nfs_strategy: buffer %p unexpectedly marked B_DONE", bp));
KASSERT(BUF_REFCNT(bp) > 0, ("nfs_strategy: buffer %p not locked", bp));
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 53dfc41..7652a02 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -1384,6 +1384,8 @@ struct vop_strategy_args {
struct vnode *vp;
daddr_t lbn;
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
vp = ap->a_vp;
lbn = ap->a_bp->b_lblkno;
if (VTOI(vp)->i_fs->fs_magic == FS_UFS2_MAGIC &&
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 4f02ead..964a468 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -1949,6 +1949,8 @@ ufs_strategy(ap)
ufs2_daddr_t blkno;
int error;
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
ip = VTOI(vp);
if (bp->b_blkno == bp->b_lblkno) {
error = ufs_bmaparray(vp, bp->b_lblkno, &blkno, bp, NULL, NULL);
diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c
index b80becc..c9ea6d2 100644
--- a/sys/vm/vm_swap.c
+++ b/sys/vm/vm_swap.c
@@ -105,6 +105,8 @@ swapdev_strategy(ap)
struct vnode *vp;
struct buf *bp;
+ KASSERT(ap->a_vp == ap->a_bp->b_vp, ("%s(%p != %p)",
+ __func__, ap->a_vp, ap->a_bp->b_vp));
bp = ap->a_bp;
sz = howmany(bp->b_bcount, PAGE_SIZE);
OpenPOWER on IntegriCloud