Linux Test Project
 help / color / mirror / Atom feed
From: Martin Doucha <mdoucha@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] fallocate05: Allow ENXIO error from lseek(SEEK_DATA) on empty file
Date: Tue, 24 Sep 2024 18:00:27 +0200	[thread overview]
Message-ID: <20240924160028.67124-1-mdoucha@suse.cz> (raw)

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

             reply	other threads:[~2024-09-24 16:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24 16:00 Martin Doucha [this message]
2024-09-25  9:14 ` [LTP] [PATCH] fallocate05: Allow ENXIO error from lseek(SEEK_DATA) on empty file Avinesh Kumar
2024-09-26 12:28 ` Cyril Hrubis
2024-09-26 12:33   ` Martin Doucha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240924160028.67124-1-mdoucha@suse.cz \
    --to=mdoucha@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox