Add the same KASSERT to all VOP_STRATEGY and VOP_SPECSTRATEGY implementations

to check that the buffer points to the correct vnode.
This commit is contained in:
Poul-Henning Kamp 2003-06-15 18:53:00 +00:00
parent 76dbe2e720
commit cefb5754dd
16 changed files with 34 additions and 0 deletions

View File

@ -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");

View File

@ -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)

View File

@ -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");
/*

View File

@ -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));

View File

@ -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");

View File

@ -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");

View File

@ -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);
}

View File

@ -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) {
/*

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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));

View File

@ -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 &&

View File

@ -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);

View File

@ -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);