]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ksmbd: remove unnecessary generic_fillattr in smb2_open
authorHyunchul Lee <hyc.lee@gmail.com>
Mon, 18 Dec 2023 15:33:07 +0000 (00:33 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Dec 2023 09:41:52 +0000 (10:41 +0100)
commita7ddc4951f0f3c3647334380c3eda1d7d33bd7f5
treef7614bae0d0819e6713bb95dc308e5ebaff8f575
parentebb8c616574adf715093f2fcdbd7afe54c4481a1
ksmbd: remove unnecessary generic_fillattr in smb2_open

[ Upstream commit c90b31eaf9e77269d3803ed9223a2e0168b519ac ]

Remove unnecessary generic_fillattr to fix wrong
AllocationSize of SMB2_CREATE response, And
Move the call of ksmbd_vfs_getattr above the place
where stat is needed because of truncate.

This patch fixes wrong AllocationSize of SMB2_CREATE
response. Because ext4 updates inode->i_blocks only
when disk space is allocated, generic_fillattr does
not set stat.blocks properly for delayed allocation.
But ext4 returns the blocks that include the delayed
allocation blocks when getattr is called.

The issue can be reproduced with commands below:

touch ${FILENAME}
xfs_io -c "pwrite -S 0xAB 0 40k" ${FILENAME}
xfs_io -c "stat" ${FILENAME}

40KB are written, but the count of blocks is 8.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ksmbd/smb2pdu.c