Re: [PATCH v8 5/5] smb/client: refresh allocation after EOF-extending fallocate

Paulo Alcantara <[email protected]> Wed, 29 Jul 2026 19:54:25 -0300
Newsgroups org.kernel.vger.linux-cifs
Message-ID <[email protected]>
Huiwen He <[email protected]> writes:

> From: Huiwen He <[email protected]>
>
> 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 <[email protected]>
> Reviewed-by: ChenXiaoSong <[email protected]>

This patch regressed fstests generic/103 and generic/590 against samba
4.24 (strict allocate = yes) with a 15G xfs partition for both test and
scratch shares.  The tests now fail with -ENOSPC.

A simple reproducer

	$ mount.cifs //samba-fs0/scratch2 /mnt/1 -o username=xxx,password=yyy
        $ df -h /mnt/1
	Filesystem            Size  Used Avail Use% Mounted on
	//samba-fs0/scratch2   15G  326M   15G   3% /mnt/1
	$ xfs_io -c "falloc 0 8G" -f /mnt/1/file
	fallocate: No space left on device