[LTP] [PATCH] mremap06: fallocate is not supported on nfsv3
Petr Vorel
pvorel@suse.cz
Wed Apr 10 11:53:30 CEST 2024
Hi,
...
> > Shouldn't we limit this only to nfs, to make sure that fallocate() is
> > not accidentally disabled on other filesystems? At least that what I
> > suggested when I replied to the patch.
> That's what I also meant by my earlier suggestion (or, better I was not sure
> myself if it's needed). I would vote for this check. But since we already have
> this problem in other files, I would be ok to merge this first and handle
> proper fix as a separate approach if Samasth does not have time to solve it
> himself. @Samasth WDYT?
> The solution would be to at least check for tst_fs_type(".") == TST_NFS_MAGIC.
> Perfect solution would IMHO be to check for NFS version (e.g. in /proc/mounts)
> and TCONF only on NFSv3.
> BTW When I first read man fallocate(2), I interpreted following note related to
> FALLOC_FL_PUNCH_HOLE about general fallocate() support:
> Not all filesystems support FALLOC_FL_PUNCH_HOLE; if a filesystem doesn't
> support the operation, an error is returned. The operation is supported on at
> least the following filesystems:
> • XFS (since Linux 2.6.38)
> • ext4 (since Linux 3.0)
> • Btrfs (since Linux 3.7)
> • tmpfs(5) (since Linux 3.5)
> • gfs2(5) (since Linux 4.16)
Actually, I correct myself. Very proper check would be should TCONF only on all
filesystems we test (fs_type_whitelist[]) + these listed here from particular
version. i.e. not only NFSv3 is affected. But given it works on NFSv4*, it'd be
good to check the current support. Or we might just ignore the TCONF check, as
most of the filesystems got support in kernel 3.x and the oldest (gfs2) is 4.16.
Kind regards,
Petr
> Some of the tests which are using fallocate() indeed test FALLOC_FL_PUNCH_HOLE:
> $ git grep -l FALLOC_FL_PUNCH_HOLE testcases/
> testcases/kernel/mem/hugetlb/hugefallocate/hugefallocate01.c
> testcases/kernel/mem/hugetlb/hugefallocate/hugefallocate02.c
> testcases/kernel/syscalls/fallocate/fallocate04.c
> testcases/kernel/syscalls/fallocate/fallocate05.c
> testcases/kernel/syscalls/fallocate/fallocate06.c
> testcases/kernel/syscalls/memfd_create/memfd_create_common.c
> and others not, e.g.:
> testcases/kernel/syscalls/fallocate/fallocate0[1-3].c
> testcases/kernel/syscalls/mremap/mremap06.c (which does not check errno at all,
> likely not needed).
> Therefore also check for FALLOC_FL_PUNCH_HOLE would be needed (in addition to
> all NFS or NFSv3).
> BTW the man page does not mention NFS at all. @Samasth would you please send a
> patch to linux-man ML?
> Kind regards,
> Petr
More information about the ltp
mailing list