git: b4d3dd861511 - main - zfs: fix up bogus checksums with blake3 in face of cpu migration
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 25 Apr 2023 15:21:50 UTC
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b4d3dd861511cc58c1d1328511189b8a42a6d091 commit b4d3dd861511cc58c1d1328511189b8a42a6d091 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2023-04-25 15:20:19 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2023-04-25 15:20:19 +0000 zfs: fix up bogus checksums with blake3 in face of cpu migration This is a temporary measure until a better fix is sorted out. Upstream report: https://github.com/openzfs/zfs/issues/14785 Reported by: Evgeniy Khramtsov Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/contrib/openzfs/module/zfs/blake3_zfs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/contrib/openzfs/module/zfs/blake3_zfs.c b/sys/contrib/openzfs/module/zfs/blake3_zfs.c index bcc595bca8f2..7783282b671a 100644 --- a/sys/contrib/openzfs/module/zfs/blake3_zfs.c +++ b/sys/contrib/openzfs/module/zfs/blake3_zfs.c @@ -50,7 +50,8 @@ abd_checksum_blake3_native(abd_t *abd, uint64_t size, const void *ctx_template, ASSERT(ctx_template != NULL); #if defined(_KERNEL) - BLAKE3_CTX *ctx = blake3_per_cpu_ctx[CPU_SEQID_UNSTABLE]; + kpreempt_disable(); + BLAKE3_CTX *ctx = blake3_per_cpu_ctx[CPU_SEQID]; #else BLAKE3_CTX *ctx = kmem_alloc(sizeof (*ctx), KM_SLEEP); #endif @@ -59,7 +60,9 @@ abd_checksum_blake3_native(abd_t *abd, uint64_t size, const void *ctx_template, (void) abd_iterate_func(abd, 0, size, blake3_incremental, ctx); Blake3_Final(ctx, (uint8_t *)zcp); -#if !defined(_KERNEL) +#if defined(_KERNEL) + kpreempt_enable(); +#else memset(ctx, 0, sizeof (*ctx)); kmem_free(ctx, sizeof (*ctx)); #endif