It is highly improbable but still quite possible that two objects in different datasets are created with the same object numbers and in transaction groups with the same IDs. znodes corresponding to those objects would have the same z_id and z_gen, but their other attributes may be quite different. zfs recv -F may replace one of such objects with the other and zfs_rezget() would be successful in such a case. As a result file properties recorded in the replaced object's vnode may no longer match the received object's properties (the znode is refreshed). One of the obvious cached properties is the vnode's type recorded in v_type. Maybe there are others.
I think that there could quite unexpected consequences if a regular file is replaced with a directory (or vice versa) and zfs_rezget() is successful. So, in addition to the existing checks it is better to compare v_type with (refreshed) z_mode. Although, I am not sure what would be better to do if those values do not match: update v_type or fail zfs_rezget(), so that a new vnode-znode pair could be created. The latter seems like a safer option. P.S. FreeBSD already has the defensive code: http://bxr.su/FreeBSD/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#1330 -- Andriy Gapon _______________________________________________ developer mailing list developer@open-zfs.org http://lists.open-zfs.org/mailman/listinfo/developer