Skip to content

Commit

Permalink
debugfs: dx_hash: honor the unsigned hash flag if a file system is op…
Browse files Browse the repository at this point in the history
…ened

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 <[email protected]>
  • Loading branch information
tytso committed Jan 16, 2024
1 parent 6cde9c2 commit 1094c17
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions debugfs/htree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1094c17

Please sign in to comment.