Index: sys/kern/vfs_vnops.c =================================================================== --- sys/kern/vfs_vnops.c +++ sys/kern/vfs_vnops.c @@ -3465,6 +3465,7 @@ vn_deallocate_impl(struct vnode *vp, off_t *offset, off_t *length, int flags, int ioflag, struct ucred *active_cred, struct ucred *file_cred) { + struct ucred *cred; struct mount *mp; void *rl_cookie; off_t off, len; @@ -3508,9 +3509,14 @@ error = mac_vnode_check_write(active_cred, file_cred, vp); #endif - if (error == 0) + if (error == 0) { + if (file_cred != NULL) + cred = file_cred; + else + cred = active_cred; error = VOP_DEALLOCATE(vp, &off, &len, flags, ioflag, - active_cred); + cred); + } if ((ioflag & IO_NODELOCKED) == 0) { VOP_UNLOCK(vp);