diff options
author | pjd <pjd@FreeBSD.org> | 2009-09-13 10:33:51 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2009-09-13 10:33:51 +0000 |
commit | e5e33d251a94a905fe3f499fa32a37b43f214539 (patch) | |
tree | 199ad29638ee4e1e511c955d4d89ffb4bdd9e802 /sys/cddl/contrib | |
parent | 2dcef8ae2ba607af0ecf73abc909344f5d23a167 (diff) | |
download | FreeBSD-src-e5e33d251a94a905fe3f499fa32a37b43f214539.zip FreeBSD-src-e5e33d251a94a905fe3f499fa32a37b43f214539.tar.gz |
When zfs.ko is compiled with debug, make sure that znode and vnode point at
each other.
MFC after: 3 days
Diffstat (limited to 'sys/cddl/contrib')
3 files changed, 22 insertions, 3 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h index c05ee20..bb1c9da 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h @@ -231,8 +231,27 @@ typedef struct znode { /* * Convert between znode pointers and vnode pointers */ +#ifdef DEBUG +static __inline vnode_t * +ZTOV(znode_t *zp) +{ + vnode_t *vp = zp->z_vnode; + + ASSERT(vp == NULL || vp->v_data == NULL || vp->v_data == zp); + return (vp); +} +static __inline znode_t * +VTOZ(vnode_t *vp) +{ + znode_t *zp = (znode_t *)vp->v_data; + + ASSERT(zp == NULL || zp->z_vnode == NULL || zp->z_vnode == vp); + return (zp); +} +#else #define ZTOV(ZP) ((ZP)->z_vnode) #define VTOZ(VP) ((znode_t *)(VP)->v_data) +#endif /* * ZFS_ENTER() is called on entry to each ZFS vnode and vfs operation. diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index 175e63e..0753fe9 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -4382,7 +4382,7 @@ zfs_freebsd_reclaim(ap) mutex_enter(&zp->z_lock); ASSERT(zp->z_phys != NULL); - ZTOV(zp) = NULL; + zp->z_vnode = NULL; mutex_exit(&zp->z_lock); if (zp->z_unlinked) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c index f90b413..082198f 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c @@ -110,7 +110,7 @@ znode_evict_error(dmu_buf_t *dbuf, void *user_ptr) mutex_exit(&zp->z_lock); zfs_znode_free(zp); } else if (vp->v_count == 0) { - ZTOV(zp) = NULL; + zp->z_vnode = NULL; vhold(vp); mutex_exit(&zp->z_lock); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread); @@ -1533,7 +1533,7 @@ zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx) ZTOV(rootzp)->v_data = NULL; ZTOV(rootzp)->v_count = 0; ZTOV(rootzp)->v_holdcnt = 0; - ZTOV(rootzp) = NULL; + rootzp->z_vnode = NULL; VOP_UNLOCK(vp, 0); vdestroy(vp); dmu_buf_rele(rootzp->z_dbuf, NULL); |