Skip to content

Commit 5d2b42e

Browse files
Shuoran LiuJaegeuk Kim
authored andcommitted
f2fs: fix a bug when using namehash to locate dentry bucket
In the following scenario, 1) we don't have the key and doing a lookup for encrypted file, 2) and the encrypted filename is big name we should use fname->hash as name hash value instead of what is calculated by fname->disk_name. Because in such case, fname->disk_name is empty. Signed-off-by: Shuoran Liu <[email protected]> Acked-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent dfd02e4 commit 5d2b42e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/f2fs/dir.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ static struct f2fs_dir_entry *find_in_level(struct inode *dir,
172172
int max_slots;
173173
f2fs_hash_t namehash;
174174

175-
namehash = f2fs_dentry_hash(&name);
175+
if(fname->hash)
176+
namehash = cpu_to_le32(fname->hash);
177+
else
178+
namehash = f2fs_dentry_hash(&name);
176179

177180
nbucket = dir_buckets(level, F2FS_I(dir)->i_dir_level);
178181
nblock = bucket_blocks(level);

0 commit comments

Comments
 (0)