From 1094c175940d38013dd87145c18169f04530c978 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 15 Jan 2024 21:59:49 -0500 Subject: [PATCH] debugfs: dx_hash: honor the unsigned hash flag if a file system is opened If we are using the hash seed and hash version from an open file systenm, then we should also use the unsigned version of the hash algorithm if the superblock as the unsigned hash flag set. Signed-off-by: Theodore Ts'o --- debugfs/htree.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debugfs/htree.c b/debugfs/htree.c index fab04e2b3..73a68e92c 100644 --- a/debugfs/htree.c +++ b/debugfs/htree.c @@ -347,6 +347,9 @@ void do_dx_hash(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)), hash_seed[3] = current_fs->super->s_hash_seed[3]; hash_version = current_fs->super->s_def_hash_version; + if (hash_version <= EXT2_HASH_TEA && + current_fs->super->s_flags & EXT2_FLAGS_UNSIGNED_HASH) + hash_version += 3; } reset_getopt();