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

Samasth Norway Ananda samasth.norway.ananda@oracle.com
Wed Jun 26 03:05:32 CEST 2024


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



More information about the ltp mailing list