Whamcloud - gitweb
debugfs: byteswap dirsearch dirent buf on big endian systems
authorBrian Foster <bfoster@redhat.com>
Thu, 23 Jan 2025 13:52:11 +0000 (08:52 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 21 May 2025 13:46:32 +0000 (09:46 -0400)
commit4be42019388d76c933e3b2ea80284aaf5b8eaecb
tree7452dba6dc5f501bc6aeb9aa2eceea5577945fb9
parent5a6ec683252be78ccda7dec7dac530f2ebc46ce6
debugfs: byteswap dirsearch dirent buf on big endian systems

fstests test ext4/048 fails on big endian systems due to broken
debugfs dirsearch functionality. On an s390x system and 4k block
size, the dirsearch command seems to hang indefinitely. On the same
system with a 1k block size, the command fails to locate an existing
entry and causes the test to fail due to unexpected results.

The cause of the dirsearch failure is lack of byte swapping of the
on-disk (little endian) dirent buffer before attempting to iterate
entries in the given block. This leads to garbage record and name
length values, for example. To resolve this problem, byte swap the
directory buffer on big endian systems.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/20250123135211.575895-1-bfoster@redhat.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs/htree.c