--- a/usr/src/uts/common/fs/zfs/zfs_vnops.c Tue Oct 14 23:28:00 2008 -0700
+++ b/usr/src/uts/common/fs/zfs/zfs_vnops.c Wed Oct 15 08:10:31 2008 -0600
@@ -169,23 +169,32 @@
zfs_open(vnode_t **vpp, int flag, cred_t *cr, caller_context_t *ct)
{
znode_t *zp = VTOZ(*vpp);
+ zfsvfs_t *zfsvfs = zp->z_zfsvfs;
+
+ ZFS_ENTER(zfsvfs);
+ ZFS_VERIFY_ZP(zp);
if ((flag & FWRITE) && (zp->z_phys->zp_flags & ZFS_APPENDONLY) &&
((flag & FAPPEND) == 0)) {
+ ZFS_EXIT(zfsvfs);
return (EPERM);
}
if (!zfs_has_ctldir(zp) && zp->z_zfsvfs->z_vscan &&
ZTOV(zp)->v_type == VREG &&
!(zp->z_phys->zp_flags & ZFS_AV_QUARANTINED) &&
- zp->z_phys->zp_size > 0)
- if (fs_vscan(*vpp, cr, 0) != 0)
+ zp->z_phys->zp_size > 0) {
+ if (fs_vscan(*vpp, cr, 0) != 0) {
+ ZFS_EXIT(zfsvfs);
return (EACCES);
+ }
+ }
/* Keep a count of the synchronous opens in the znode */
if (flag & (FSYNC | FDSYNC))
atomic_inc_32(&zp->z_sync_cnt);
+ ZFS_EXIT(zfsvfs);
return (0);
}
@@ -195,6 +204,10 @@
caller_context_t *ct)
{
znode_t *zp = VTOZ(vp);
+ zfsvfs_t *zfsvfs = zp->z_zfsvfs;
+
+ ZFS_ENTER(zfsvfs);
+ ZFS_VERIFY_ZP(zp);
/* Decrement the synchronous opens in the znode */
if ((flag & (FSYNC | FDSYNC)) && (count == 1))
@@ -212,6 +225,7 @@
zp->z_phys->zp_size > 0)
VERIFY(fs_vscan(vp, cr, 1) == 0);
+ ZFS_EXIT(zfsvfs);
return (0);
}