diff options
author | Tom Rini <trini@konsulko.com> | 2024-05-14 07:46:33 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-05-14 07:46:33 -0600 |
commit | e7992828adcd5fad75bce9e6c41dfa9277ab93b0 (patch) | |
tree | dcb6356b6af294979f388c78c6821a63c91d3275 /fs/zfs/zfs.c | |
parent | c67199962b2a819a4b0ae8d57dc68b7cadee0c9e (diff) | |
parent | 42826664e4452304bdadc909d7c5f791d4abc552 (diff) |
Merge branch '2024-05-13-assorted-updates' into next
- A few zfs fixes, ARMv8 timer cleanups, support more algorithms with
the nuvoton crypto driver, virtio + env in filesystem fix, K3 code
cleanup and warning fix in gen_compile_commands.
Diffstat (limited to 'fs/zfs/zfs.c')
-rw-r--r-- | fs/zfs/zfs.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/fs/zfs/zfs.c b/fs/zfs/zfs.c index c44e7ece5df..9906d553fa6 100644 --- a/fs/zfs/zfs.c +++ b/fs/zfs/zfs.c @@ -16,6 +16,7 @@ #include <linux/time.h> #include <linux/ctype.h> #include <asm/byteorder.h> +#include <u-boot/zlib.h> #include "zfs_common.h" #include "div64.h" @@ -182,7 +183,8 @@ static int zlib_decompress(void *s, void *d, uint32_t slen, uint32_t dlen) { - if (zlib_decompress(s, d, slen, dlen) < 0) + uLongf z_dest_len = dlen; + if (uncompress(d, &z_dest_len, s, slen) != Z_OK) return ZFS_ERR_BAD_FS; return ZFS_ERR_NONE; } @@ -333,6 +335,12 @@ vdev_uberblock_compare(uberblock_t *ub1, uberblock_t *ub2) return 0; } +static inline int +is_supported_spa_version(uint64_t version) { + return version == FEATURES_SUPPORTED_SPA_VERSION || + (version > 0 && version <= SPA_VERSION); +} + /* * Three pieces of information are needed to verify an uberblock: the magic * number, the version number, and the checksum. @@ -354,14 +362,12 @@ uberblock_verify(uberblock_t *uber, int offset, struct zfs_data *data) return ZFS_ERR_BAD_FS; } - if (zfs_to_cpu64(uber->ub_magic, LITTLE_ENDIAN) == UBERBLOCK_MAGIC - && zfs_to_cpu64(uber->ub_version, LITTLE_ENDIAN) > 0 - && zfs_to_cpu64(uber->ub_version, LITTLE_ENDIAN) <= SPA_VERSION) + if (zfs_to_cpu64(uber->ub_magic, LITTLE_ENDIAN) == UBERBLOCK_MAGIC && + is_supported_spa_version(zfs_to_cpu64(uber->ub_version, LITTLE_ENDIAN))) endian = LITTLE_ENDIAN; - if (zfs_to_cpu64(uber->ub_magic, BIG_ENDIAN) == UBERBLOCK_MAGIC - && zfs_to_cpu64(uber->ub_version, BIG_ENDIAN) > 0 - && zfs_to_cpu64(uber->ub_version, BIG_ENDIAN) <= SPA_VERSION) + if (zfs_to_cpu64(uber->ub_magic, BIG_ENDIAN) == UBERBLOCK_MAGIC && + is_supported_spa_version(zfs_to_cpu64(uber->ub_version, BIG_ENDIAN))) endian = BIG_ENDIAN; if (endian == UNKNOWN_ENDIAN) { @@ -1787,7 +1793,7 @@ check_pool_label(struct zfs_data *data) return ZFS_ERR_BAD_FS; } - if (version > SPA_VERSION) { + if (!is_supported_spa_version(version)) { free(nvlist); printf("SPA version too new %llu > %llu\n", (unsigned long long) version, |