Skip to content

Commit 7e244a1

Browse files
Fix: draid autopkgtests fail on s390x architecture (Endianness Issue)
The ioctl call to create the pool was returning -1 with errno EINVAL. Inside the module code, inside vdev_draid.c, verify_perms is calling fletcher_4_native_varsize. This in turn calls fletcher_4_scalar_native. So, implemented a fletcher_4_byteswap_varsize which makes use of the fletcher_4_scalar_byteswap in Big endian machines. Signed-off-by: Pranav P <pranavsdreams@gmail.com> Closes #16261
1 parent f798b40 commit 7e244a1

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

include/zfs_fletcher.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ _ZFS_FLETCHER_H int fletcher_2_incremental_native(void *, size_t, void *);
6060
_ZFS_FLETCHER_H int fletcher_2_incremental_byteswap(void *, size_t, void *);
6161
_ZFS_FLETCHER_H void fletcher_4_native_varsize(const void *, uint64_t,
6262
zio_cksum_t *);
63+
_ZFS_FLETCHER_H void fletcher_4_byteswap_varsize(const void *, uint64_t,
64+
zio_cksum_t *);
6365
_ZFS_FLETCHER_H void fletcher_4_byteswap(const void *, uint64_t, const void *,
6466
zio_cksum_t *);
6567
_ZFS_FLETCHER_H int fletcher_4_incremental_native(void *, size_t, void *);

module/zcommon/zfs_fletcher.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,13 @@ fletcher_4_native_varsize(const void *buf, uint64_t size, zio_cksum_t *zcp)
499499
fletcher_4_scalar_native((fletcher_4_ctx_t *)zcp, buf, size);
500500
}
501501

502+
void
503+
fletcher_4_byteswap_varsize(const void *buf, uint64_t size, zio_cksum_t *zcp)
504+
{
505+
ZIO_SET_CHECKSUM(zcp, 0, 0, 0, 0);
506+
fletcher_4_scalar_byteswap((fletcher_4_ctx_t *)zcp, buf, size);
507+
}
508+
502509
static inline void
503510
fletcher_4_byteswap_impl(const void *buf, uint64_t size, zio_cksum_t *zcp)
504511
{

module/zfs/vdev_draid.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,11 @@ verify_perms(uint8_t *perms, uint64_t children, uint64_t nperms,
505505
int permssz = sizeof (uint8_t) * children * nperms;
506506
zio_cksum_t cksum;
507507

508+
#if defined(_ZFS_BIG_ENDIAN)
509+
fletcher_4_byteswap_varsize(perms, permssz, &cksum);
510+
#else
508511
fletcher_4_native_varsize(perms, permssz, &cksum);
512+
#endif
509513

510514
if (checksum != cksum.zc_word[0]) {
511515
kmem_free(counts, countssz);

0 commit comments

Comments
 (0)