* [LTP] [PATCH] fallocate05: Allow ENXIO error from lseek(SEEK_DATA) on empty file
@ 2024-09-24 16:00 Martin Doucha
2024-09-25 9:14 ` Avinesh Kumar
2024-09-26 12:28 ` Cyril Hrubis
0 siblings, 2 replies; 4+ messages in thread
From: Martin Doucha @ 2024-09-24 16:00 UTC (permalink / raw)
To: ltp
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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH] fallocate05: Allow ENXIO error from lseek(SEEK_DATA) on empty file
2024-09-24 16:00 [LTP] [PATCH] fallocate05: Allow ENXIO error from lseek(SEEK_DATA) on empty file Martin Doucha
@ 2024-09-25 9:14 ` Avinesh Kumar
2024-09-26 12:28 ` Cyril Hrubis
1 sibling, 0 replies; 4+ messages in thread
From: Avinesh Kumar @ 2024-09-25 9:14 UTC (permalink / raw)
To: Martin Doucha; +Cc: ltp
Hi,
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.
>
> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
Reviewed-by: Avinesh Kumar <akumar@suse.de>
> ---
> 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
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
Regards,
Avinesh
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH] fallocate05: Allow ENXIO error from lseek(SEEK_DATA) on empty file
2024-09-24 16:00 [LTP] [PATCH] fallocate05: Allow ENXIO error from lseek(SEEK_DATA) on empty file Martin Doucha
2024-09-25 9:14 ` Avinesh Kumar
@ 2024-09-26 12:28 ` Cyril Hrubis
2024-09-26 12:33 ` Martin Doucha
1 sibling, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2024-09-26 12:28 UTC (permalink / raw)
To: Martin Doucha; +Cc: ltp
Hi!
> 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?
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] fallocate05: Allow ENXIO error from lseek(SEEK_DATA) on empty file
2024-09-26 12:28 ` Cyril Hrubis
@ 2024-09-26 12:33 ` Martin Doucha
0 siblings, 0 replies; 4+ messages in thread
From: Martin Doucha @ 2024-09-26 12:33 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
On 26. 09. 24 14:28, Cyril Hrubis wrote:
> Hi!
>> 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.
--
Martin Doucha mdoucha@suse.cz
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-26 12:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-24 16:00 [LTP] [PATCH] fallocate05: Allow ENXIO error from lseek(SEEK_DATA) on empty file Martin Doucha
2024-09-25 9:14 ` Avinesh Kumar
2024-09-26 12:28 ` Cyril Hrubis
2024-09-26 12:33 ` Martin Doucha
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.