Re: [PATCH] ntfs: keep i_size of a directory equal to its index root

From: Hyunchul Lee

Date: Wed Nov 25 2026 - 20:47:19 EST


On Wed, Nov 25, 2026 at 11:18:20PM +0900, Showta Ishizaki wrote:
> After mkdir, stat() gives a size of 0 for the directory until it is read
> back from disk, where it gives the length of $INDEX_ROOT.
> __ntfs_create() opens the index root but does not set i_size from it.
>
> When the index root is moved out to an index block,
> ntfs_ir_reparent() updates data_size but not i_size, which keeps the
> length the root had before.
>
> Set i_size in both, as ntfs_ir_truncate() does.
>
> Without the patch a new directory was 0 bytes and became 48 after a
> remount, and one with 300 files was 248 and became 56. With it the sizes
> are the same before and after.
>
> Fixes: af0db57d4293 ("ntfs: update inode operations")
> Fixes: 0a8ac0c1fa0b ("ntfs: update directory operations")
> Signed-off-by: Showta Ishizaki <zakinko@xxxxxxxxxxxxxx>

Looks good to me.

Reviewed-by: Hyunchul Lee <hyc.lee@xxxxxxxxx>

--
Thanks,
Hyunchul