]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
smb/client: refresh allocation after EOF-extending fallocate
authorHuiwen He <hehuiwen@kylinos.cn>
Fri, 3 Jul 2026 05:32:59 +0000 (13:32 +0800)
committerSteve French <stfrench@microsoft.com>
Mon, 13 Jul 2026 15:37:55 +0000 (10:37 -0500)
commit5bd1d3dcc25a51663b3878cbc506e16be15af354
tree762a30de1e4aece6109d10e296b87e42abfad9a1
parent7a06d3b816d73448b4e38b83d65049f090b7b201
smb/client: refresh allocation after EOF-extending fallocate

Before this change, xfstests generic/496 was not supported on ksmbd:

        generic/496 ... [not run] fallocated swap not supported here

ksmbd handles SetEOF as truncate, so EOF extension alone does not
allocate backing blocks. A fallocated swapfile can therefore still
look sparse to swapon.

Request allocation for EOF-extending fallocate ranges that can be
represented by FILE_ALLOCATION_INFORMATION, and refresh the allocation
state afterwards.

With this change, xfstests generic/496 and generic/701 pass on ksmbd.

However, Samba "strict allocate = no" now exposes the real generic/701
failure: the old pass came from inflated local i_blocks, not from
server allocation. generic/213 also fails in that case because an
oversized allocation request may not return ENOSPC.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb2ops.c
fs/smb/client/smb2pdu.c
fs/smb/client/smb2proto.h
fs/smb/common/fscc.h
fs/smb/server/smb2pdu.h