]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
debugfs: dx_hash: honor the unsigned hash flag if a file system is opened
authorTheodore Ts'o <tytso@mit.edu>
Tue, 16 Jan 2024 02:59:49 +0000 (21:59 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 16 Jan 2024 02:59:49 +0000 (21:59 -0500)
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 <tytso@mit.edu>
debugfs/htree.c

index fab04e2b398a1b975d8d93328188cb58850e7d9e..73a68e92c431971839421022e032774d3c12b1f6 100644 (file)
@@ -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();