[LTP] [PATCH] fallocate05: Allow ENXIO error from lseek(SEEK_DATA) on empty file
Martin Doucha
mdoucha@suse.cz
Tue Sep 24 18:00:27 CEST 2024
Some filesystems release deallocated blocks in larger chunks.
On these filesystems, the whole test file needs to be deallocated
to allow the final write to pass. However, lseek(SEEK_DATA) may
return ENXIO error if the entire file range from offset to end of file
is one large hole. Allow ENXIO error in this special case.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
testcases/kernel/syscalls/fallocate/fallocate05.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/testcases/kernel/syscalls/fallocate/fallocate05.c b/testcases/kernel/syscalls/fallocate/fallocate05.c
index 732a2f15d..b4350c865 100644
--- a/testcases/kernel/syscalls/fallocate/fallocate05.c
+++ b/testcases/kernel/syscalls/fallocate/fallocate05.c
@@ -154,6 +154,10 @@ static void run(void)
if (TST_RET == holesize) {
tst_res(TPASS, "Test file data start at offset %ld", TST_RET);
+ } else if (TST_RET == -1 && holesize >= bufsize + extsize &&
+ TST_ERR == ENXIO) {
+ tst_res(TPASS | TTERRNO,
+ "lseek(SEEK_DATA) failed on empty file");
} else if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "lseek(SEEK_DATA) failed");
} else {
--
2.46.0
More information about the ltp
mailing list