Re: vfs.zfs.bclone_enabled (was: FreeBSD 14.0-BETA2 Now Available)

From: Mark Millard <marklmi_at_yahoo.com>
Date: Mon, 18 Sep 2023 22:51:30 UTC
Alexander Motin <mav_at_FreeBSD.org> wrote on
Date: Mon, 18 Sep 2023 13:26:56 UTC :

> block_cloning feature is marked as READONLY_COMPAT. It should not 
> require any special handling from the boot code.

From stand/libsa/zfs/zfsimpl.c but adding a comment about the
read-only compatibility status of each entry:

/*
 * List of ZFS features supported for read
 */
static const char *features_e: vfs.zfs.bclone_enabled
        "com.datto:bookmark_v2",		// READ-ONLY COMPATIBLE no
        "com.datto:encryption",			// READ-ONLY COMPATIBLE no
        "com.datto:resilver_defer",		// READ-ONLY COMPATIBLE yes
        "com.delphix:bookmark_written",		// READ-ONLY COMPATIBLE no
        "com.delphix:device_removal",		// READ-ONLY COMPATIBLE no
        "com.delphix:embedded_data",		// READ-ONLY COMPATIBLE no
        "com.delphix:extensible_dataset",	// READ-ONLY COMPATIBLE no
        "com.delphix:head_errlog",		// READ-ONLY COMPATIBLE no
        "com.delphix:hole_birth",		// READ-ONLY COMPATIBLE no
        "com.delphix:obsolete_counts",		// READ-ONLY COMPATIBLE yes
        "com.delphix:spacemap_histogram",	// READ-ONLY COMPATIBLE yes
        "com.delphix:spacemap_v2",		// READ-ONLY COMPATIBLE yes
        "com.delphix:zpool_checkpoint",		// READ-ONLY COMPATIBLE yes
        "com.intel:allocation_classes",		// READ-ONLY COMPATIBLE yes
        "com.joyent:multi_vdev_crash_dump",	// READ-ONLY COMPATIBLE no
        "com.klarasystems:vdev_zaps_v2",	// READ-ONLY COMPATIBLE no
        "org.freebsd:zstd_compress",		// READ-ONLY COMPATIBLE no
        "org.illumos:lz4_compress",		// READ-ONLY COMPATIBLE no
        "org.illumos:sha512",			// READ-ONLY COMPATIBLE no
        "org.illumos:skein",			// READ-ONLY COMPATIBLE no
        "org.open-zfs:large_blocks",		// READ-ONLY COMPATIBLE no
        "org.openzfs:blake3",			// READ-ONLY COMPATIBLE no
        "org.zfsonlinux:allocation_classes",	// READ-ONLY COMPATIBLE yes
        "org.zfsonlinux:large_dnode",		// READ-ONLY COMPATIBLE no
        NULL
};

So it appears that the design is that both "no" and "yes" ones
that are known to be supported are listed and anything else is
supposed to lead to rejection until explicitly added as
known-compatibile.

This matches up with stand/libsa/zfs/zfsimpl.c 's:

static int
nvlist_check_features_for_read(nvlist_t *nvl)
{
        nvlist_t *features = NULL;
        nvs_data_t *data;
        nvp_header_t *nvp;
        nv_string_t *nvp_name;
        int rc;
        
        rc = nvlist_find(nvl, ZPOOL_CONFIG_FEATURES_FOR_READ,
            DATA_TYPE_NVLIST, NULL, &features, NULL);
        switch (rc) {
        case 0:
                break;          /* Continue with checks */
        
        case ENOENT:
                return (0);     /* All features are disabled */
        
        default:
                return (rc);    /* Error while reading nvlist */
        }
        
        data = (nvs_data_t *)features->nv_data;
        nvp = &data->nvl_pair;  /* first pair in nvlist */
        
        while (nvp->encoded_size != 0 && nvp->decoded_size != 0) {
                int i, found;
        
                nvp_name = (nv_string_t *)((uintptr_t)nvp + sizeof(*nvp));
                found = 0;

                for (i = 0; features_for_read[i] != NULL; i++) {
                        if (memcmp(nvp_name->nv_data, features_for_read[i],
                            nvp_name->nv_size) == 0) {
                                found = 1;
                                break;
                        }
                }

                if (!found) {
                        printf("ZFS: unsupported feature: %.*s\n",
                            nvp_name->nv_size, nvp_name->nv_data);
                        rc = EIO;
                }
                nvp = (nvp_header_t *)((uint8_t *)nvp + nvp->encoded_size);
        }
        nvlist_destroy(features);

        return (rc);
}

I do not know if vfs.zfs.bclone_enabled=0 leads the loader
to see vs. not-see a "com.fudosecurity:block_cloning".

===
Mark Millard
marklmi at yahoo.com