[LTP] [External] : Re: [PATCH] fallocate03: FALLOC_FL_PUNCH_HOLE must be used with FALLOC_FL_KEEP_SIZE

Cyril Hrubis chrubis@suse.cz
Tue Dec 10 12:03:22 CET 2024


Hi!
> >  From the fallocate() manual, I see that:
> > "The FALLOC_FL_PUNCH_HOLE flag must be ORed withFALLOC_FL_KEEP_SIZE in mode"
> > 
> > But it doesn't mean we wouldn't use FALLOC_FL_KEEP_SIZE singly in this test.
> 
> Oh okay. Sorry mistook that.

The problem here is that most of the fallocate() modes are not supported
on NFS just have a look on how fallocate is implemented in
linux/fs/nfs/nfs4file.c:

static long nfs42_fallocate(struct file *filep, int mode, loff_t offset, loff_t len)
{
        struct inode *inode = file_inode(filep);
        long ret;

        if (!S_ISREG(inode->i_mode))
                return -EOPNOTSUPP;

        if ((mode != 0) && (mode != (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE)))
                return -EOPNOTSUPP;

...

So only two combinations of modes are actually supported. I guess that
it may make sense to skip the unsupported modes for NFS.

And it may make sense to enable the test for all_filesystems as well.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list