* [LTP] [PATCH] fallocate03: FALLOC_FL_PUNCH_HOLE must be used with FALLOC_FL_KEEP_SIZE
@ 2024-06-26 1:05 Samasth Norway Ananda via ltp
2024-07-04 7:53 ` Li Wang
0 siblings, 1 reply; 4+ messages in thread
From: Samasth Norway Ananda via ltp @ 2024-06-26 1:05 UTC (permalink / raw)
To: ltp
The fallocate03 ltp test fails with "failed: EOPNOTSUPP" if we just use
FALLOC_FL_KEEP_SIZE for the mode instead of ORing it with
FALLOC_FL_PUNCH_HOLE.
Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>
---
testcases/kernel/syscalls/fallocate/fallocate03.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/testcases/kernel/syscalls/fallocate/fallocate03.c b/testcases/kernel/syscalls/fallocate/fallocate03.c
index b3e6b3817..20ce13cd4 100644
--- a/testcases/kernel/syscalls/fallocate/fallocate03.c
+++ b/testcases/kernel/syscalls/fallocate/fallocate03.c
@@ -30,10 +30,10 @@ static struct test_case {
{DEFAULT_MODE, BLOCKS_WRITTEN},
{DEFAULT_MODE, BLOCKS_WRITTEN + HOLE_SIZE_IN_BLOCKS / 2 - 1},
{DEFAULT_MODE, BLOCKS_WRITTEN + HOLE_SIZE_IN_BLOCKS + 1},
- {FALLOC_FL_KEEP_SIZE, 2},
- {FALLOC_FL_KEEP_SIZE, BLOCKS_WRITTEN},
- {FALLOC_FL_KEEP_SIZE, BLOCKS_WRITTEN + HOLE_SIZE_IN_BLOCKS / 2 + 1},
- {FALLOC_FL_KEEP_SIZE, BLOCKS_WRITTEN + HOLE_SIZE_IN_BLOCKS + 2}
+ {FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, 2},
+ {FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, BLOCKS_WRITTEN},
+ {FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, BLOCKS_WRITTEN + HOLE_SIZE_IN_BLOCKS / 2 + 1},
+ {FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, BLOCKS_WRITTEN + HOLE_SIZE_IN_BLOCKS + 2}
};
static int block_size;
@@ -82,7 +82,7 @@ static void verify_fallocate(unsigned int nr)
TST_EXP_PASS(
fallocate(fd, tc->mode, tc->offset * block_size, block_size),
"fallocate(fd, %s, %ld, %d)",
- tc->mode ? "FALLOC_FL_KEEP_SIZE" : "DEFAULT_MODE",
+ tc->mode ? "FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE" : "DEFAULT_MODE",
tc->offset * block_size, block_size);
}
--
2.45.2
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] fallocate03: FALLOC_FL_PUNCH_HOLE must be used with FALLOC_FL_KEEP_SIZE
2024-06-26 1:05 [LTP] [PATCH] fallocate03: FALLOC_FL_PUNCH_HOLE must be used with FALLOC_FL_KEEP_SIZE Samasth Norway Ananda via ltp
@ 2024-07-04 7:53 ` Li Wang
2024-07-23 17:55 ` [LTP] [External] : " Samasth via ltp
0 siblings, 1 reply; 4+ messages in thread
From: Li Wang @ 2024-07-04 7:53 UTC (permalink / raw)
To: Samasth Norway Ananda; +Cc: ltp
Hi Samasth,
Sorry for the late reply, base on your test failure, which kernel version
and
FS-type did you use?
From the fallocate() manual, I see that:
"The FALLOC_FL_PUNCH_HOLE flag must be ORed with FALLOC_FL_KEEP_SIZE in
mode"
But it doesn't mean we wouldn't use FALLOC_FL_KEEP_SIZE singly in this test.
On Wed, Jun 26, 2024 at 9:06 AM Samasth Norway Ananda via ltp <
ltp@lists.linux.it> wrote:
> The fallocate03 ltp test fails with "failed: EOPNOTSUPP" if we just use
> FALLOC_FL_KEEP_SIZE for the mode instead of ORing it with
> FALLOC_FL_PUNCH_HOLE.
>
> Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>
> ---
> testcases/kernel/syscalls/fallocate/fallocate03.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/fallocate/fallocate03.c
> b/testcases/kernel/syscalls/fallocate/fallocate03.c
> index b3e6b3817..20ce13cd4 100644
> --- a/testcases/kernel/syscalls/fallocate/fallocate03.c
> +++ b/testcases/kernel/syscalls/fallocate/fallocate03.c
> @@ -30,10 +30,10 @@ static struct test_case {
> {DEFAULT_MODE, BLOCKS_WRITTEN},
> {DEFAULT_MODE, BLOCKS_WRITTEN + HOLE_SIZE_IN_BLOCKS / 2 - 1},
> {DEFAULT_MODE, BLOCKS_WRITTEN + HOLE_SIZE_IN_BLOCKS + 1},
> - {FALLOC_FL_KEEP_SIZE, 2},
> - {FALLOC_FL_KEEP_SIZE, BLOCKS_WRITTEN},
> - {FALLOC_FL_KEEP_SIZE, BLOCKS_WRITTEN + HOLE_SIZE_IN_BLOCKS / 2 +
> 1},
> - {FALLOC_FL_KEEP_SIZE, BLOCKS_WRITTEN + HOLE_SIZE_IN_BLOCKS + 2}
> + {FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, 2},
> + {FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, BLOCKS_WRITTEN},
> + {FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, BLOCKS_WRITTEN +
> HOLE_SIZE_IN_BLOCKS / 2 + 1},
> + {FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, BLOCKS_WRITTEN +
> HOLE_SIZE_IN_BLOCKS + 2}
> };
>
> static int block_size;
> @@ -82,7 +82,7 @@ static void verify_fallocate(unsigned int nr)
> TST_EXP_PASS(
> fallocate(fd, tc->mode, tc->offset * block_size,
> block_size),
> "fallocate(fd, %s, %ld, %d)",
> - tc->mode ? "FALLOC_FL_KEEP_SIZE" : "DEFAULT_MODE",
> + tc->mode ? "FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE" :
> "DEFAULT_MODE",
> tc->offset * block_size, block_size);
> }
>
> --
> 2.45.2
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
>
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [External] : Re: [PATCH] fallocate03: FALLOC_FL_PUNCH_HOLE must be used with FALLOC_FL_KEEP_SIZE
2024-07-04 7:53 ` Li Wang
@ 2024-07-23 17:55 ` Samasth via ltp
2024-12-10 11:03 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Samasth via ltp @ 2024-07-23 17:55 UTC (permalink / raw)
To: Li Wang; +Cc: ltp
On 7/4/24 12:53 AM, Li Wang wrote:
> Hi Samasth,
>
> Sorry for the late reply, base on your test failure, which kernel
> version and
> FS-type did you use?
>
Li, I am using the v6.10 kernel and the FS-type is nfsvers=4.2. The
fallocate() call is only supported over NFSv4.2 and should show a proper
message when run over NFSv4.1 or below.
The output I get on NFSv4.2 is
<<<test_output>>>
incrementing stop
tst_test.c:1733: TINFO: LTP version: 20220121-1963-g830a705d6
tst_test.c:1617: TINFO: Timeout per run is 0h 00m 30s
fallocate03.c:83: TPASS: fallocate(fd, DEFAULT_MODE, 2097152, 1048576)
passed
fallocate03.c:83: TPASS: fallocate(fd, DEFAULT_MODE, 12582912, 1048576)
passed
fallocate03.c:83: TPASS: fallocate(fd, DEFAULT_MODE, 17825792, 1048576)
passed
fallocate03.c:83: TPASS: fallocate(fd, DEFAULT_MODE, 26214400, 1048576)
passed
fallocate03.c:83: TFAIL: fallocate(fd, FALLOC_FL_KEEP_SIZE, 2097152,
1048576) failed: EOPNOTSUPP (95)
fallocate03.c:83: TFAIL: fallocate(fd, FALLOC_FL_KEEP_SIZE, 12582912,
1048576) failed: EOPNOTSUPP (95)
fallocate03.c:83: TFAIL: fallocate(fd, FALLOC_FL_KEEP_SIZE, 19922944,
1048576) failed: EOPNOTSUPP (95)
fallocate03.c:83: TFAIL: fallocate(fd, FALLOC_FL_KEEP_SIZE, 27262976,
1048576) failed: EOPNOTSUPP (95)
Summary:
passed 4
failed 4
broken 0
skipped 0
warnings 0
When I run it on NFSv4.1 or below all the tests fail with EOPNOTSUPP.
> 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.
Thanks,
Samasth.
>
>
>
> On Wed, Jun 26, 2024 at 9:06 AM Samasth Norway Ananda via ltp
> <ltp@lists.linux.it <mailto:ltp@lists.linux.it>> wrote:
>
> The fallocate03 ltp test fails with "failed: EOPNOTSUPP" if we just use
> FALLOC_FL_KEEP_SIZE for the mode instead of ORing it with
> FALLOC_FL_PUNCH_HOLE.
>
> Signed-off-by: Samasth Norway Ananda
> <samasth.norway.ananda@oracle.com
> <mailto:samasth.norway.ananda@oracle.com>>
> ---
> testcases/kernel/syscalls/fallocate/fallocate03.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/fallocate/fallocate03.c
> b/testcases/kernel/syscalls/fallocate/fallocate03.c
> index b3e6b3817..20ce13cd4 100644
> --- a/testcases/kernel/syscalls/fallocate/fallocate03.c
> +++ b/testcases/kernel/syscalls/fallocate/fallocate03.c
> @@ -30,10 +30,10 @@ static struct test_case {
> {DEFAULT_MODE, BLOCKS_WRITTEN},
> {DEFAULT_MODE, BLOCKS_WRITTEN + HOLE_SIZE_IN_BLOCKS / 2 - 1},
> {DEFAULT_MODE, BLOCKS_WRITTEN + HOLE_SIZE_IN_BLOCKS + 1},
> - {FALLOC_FL_KEEP_SIZE, 2},
> - {FALLOC_FL_KEEP_SIZE, BLOCKS_WRITTEN},
> - {FALLOC_FL_KEEP_SIZE, BLOCKS_WRITTEN + HOLE_SIZE_IN_BLOCKS /
> 2 + 1},
> - {FALLOC_FL_KEEP_SIZE, BLOCKS_WRITTEN + HOLE_SIZE_IN_BLOCKS + 2}
> + {FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, 2},
> + {FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, BLOCKS_WRITTEN},
> + {FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, BLOCKS_WRITTEN
> + HOLE_SIZE_IN_BLOCKS / 2 + 1},
> + {FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, BLOCKS_WRITTEN
> + HOLE_SIZE_IN_BLOCKS + 2}
> };
>
> static int block_size;
> @@ -82,7 +82,7 @@ static void verify_fallocate(unsigned int nr)
> TST_EXP_PASS(
> fallocate(fd, tc->mode, tc->offset * block_size,
> block_size),
> "fallocate(fd, %s, %ld, %d)",
> - tc->mode ? "FALLOC_FL_KEEP_SIZE" : "DEFAULT_MODE",
> + tc->mode ? "FALLOC_FL_KEEP_SIZE |
> FALLOC_FL_PUNCH_HOLE" : "DEFAULT_MODE",
> tc->offset * block_size, block_size);
> }
>
> --
> 2.45.2
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
> <https://urldefense.com/v3/__https://lists.linux.it/listinfo/ltp__;!!ACWV5N9M2RV99hQ!ImURCv7bX_N4cHEQ60yHgML0NBIqYcjPdJN4Kot4Ia6o9rBb2TwedwyR0Q1WyZ-I-NCjXyaf_i-Fe-L2h5O7mf4$>
>
>
>
> --
> Regards,
> Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [External] : Re: [PATCH] fallocate03: FALLOC_FL_PUNCH_HOLE must be used with FALLOC_FL_KEEP_SIZE
2024-07-23 17:55 ` [LTP] [External] : " Samasth via ltp
@ 2024-12-10 11:03 ` Cyril Hrubis
0 siblings, 0 replies; 4+ messages in thread
From: Cyril Hrubis @ 2024-12-10 11:03 UTC (permalink / raw)
To: samasth.norway.ananda; +Cc: ltp
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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-10 11:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-26 1:05 [LTP] [PATCH] fallocate03: FALLOC_FL_PUNCH_HOLE must be used with FALLOC_FL_KEEP_SIZE Samasth Norway Ananda via ltp
2024-07-04 7:53 ` Li Wang
2024-07-23 17:55 ` [LTP] [External] : " Samasth via ltp
2024-12-10 11:03 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox