zfs: get_special_prop() should also check for ZFS_TYPE_SNAPSHOT
With zfs-tests run for #15512, we got panic with debug build:
> ::status debugging crash dump vmcore.0 (64-bit) from test operating system: 5.11 release-0-gba179997cef (i86pc) build version: heads/release-0-gba179997cef image uuid: 3b586323-2a88-41f6-9386-92670996f297 panic message: assertion failed: ds_type == ZFS_TYPE_VOLUME, file: ../../common/fs/zfs/zcp_get.c, line: 449 dump content: kernel pages only
So we get assert because we are attempting to access ZFS_PROP_VOLSIZE, but dataset type is not ZFS_TYPE_VOLUME. Incidentally, it actually is ZFS_TYPE_SNAPSHOT.
So I started to dig around and found interesting fact - when #7431 was integrated, we got assertion:
ASSERT(ds_type == ZFS_TYPE_VOLUME);
The same assert was also in OpenZFS tree at that time, see https://github.com/openzfs/openzfs/blob/master/usr/src/uts/common/fs/zfs/zcp_get.c#L449 but current OpenZFS is based on ZoL and has expanded the assert expression to include ZFS_TYPE_SNAPSHOT. The change to add ZFS_TYPE_SNAPSHOT is included in the commit implementing #7431, see https://github.com/openzfs/zfs/blob/master/module/zfs/zcp_get.c#L356
Apparently we need to deal with this assert if we ever want to integrate #15512, and I think we do want to integrate it, because it is part of the commit chain leading to other interesting developments.