The rec_len of directory ".." should be ext4_dir_rec_len(2, NULL) instead of ext4_dir_rec_len(1, NULL). Although ext4_dir_rec_len return the same number either with name_len 1 or name_len 2, it's better use the right name_len to make code more intuitive. Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx> --- fs/ext4/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index aee1858e6482..24cdeb2aa0d5 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -2925,7 +2925,7 @@ struct ext4_dir_entry_2 *ext4_init_dot_dotdot(struct inode *inode, de->name_len = 2; if (!dotdot_real_len) de->rec_len = ext4_rec_len_to_disk(blocksize - - (csum_size + ext4_dir_rec_len(1, NULL)), + (csum_size + ext4_dir_rec_len(2, NULL)), blocksize); else de->rec_len = ext4_rec_len_to_disk( -- 2.30.0