Skip to contentSkip to conversation

fallocate05: Allow ENXIO error from lseek(SEEK_DATA) on empty file

PATCH In review Martin Doucha 3 participants 4 messages Sep 24, 2024 – Sep 26, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fallocate05: Allow ENXIO error from lseek(SEEK_DATA) on empty file

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.

---
 testcases/kernel/syscalls/fallocate/fallocate05.c | 4 ++++
 1 file changed, 4 insertions(+)
testcases/kernel/syscalls/fallocate/fallocate05.c +4 -0
index 732a2f15d..b4350c865 100644
@@ -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 {
Signature · 5 lines
2.46.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 7 lines · On Tuesday, September 24, 2024 6:00:27 PM GMT+2 Martin Doucha wrote:

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.

testcases/kernel/syscalls/fallocate/fallocate05.c static void run(void) · line 156

Quoted 13 lines
---
 testcases/kernel/syscalls/fallocate/fallocate05.c | 4 ++++
 1 file changed, 4 insertions(+)
(quoted diff) +0 -0

b/testcases/kernel/syscalls/fallocate/fallocate05.c index 732a2f15d..b4350c865 100644

testcases/kernel/syscalls/fallocate/fallocate05.c +0 -0
@@ -154,6 +154,10 @@ static void run(void)
 
 	if (TST_RET == holesize) {
 		tst_res(TPASS, "Test file data start at offset %ld", 

TST_RET);

Quoted 11 lines
testcases/kernel/syscalls/fallocate/fallocate05.c +4 -1
+	} 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

Quoted 2 lines

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Regards,
Avinesh

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Martin Doucha

Hi!

Quoted 5 lines

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.

I do not get how is the whole file one hole, we write 10 bytes at the end after we punch the hole. Or do I miss something?

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
Quoted 9 lines · Cyril Hrubis

Hi!

Quoted 5 lines

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.

I do not get how is the whole file one hole, we write 10 bytes at the end after we punch the hole. Or do I miss something?

Ah, right, sorry, I forgot about that last write. The ENXIO is a side effect of the last write randomly failing on bcachefs which should be a kernel bug. I'll reject the patch then.

Signature · 11 lines
Martin Doucha   [email protected]
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp