* [LTP] [PATCH] Patch:V2:creat07():Added new_behavior flag to detect kernel version > 6.11 : Tests that creat() succeeds (write to executed file allowed) Removed the old skip logic that did TCONF on kernel >= 6.11 Added one static variable exp_errno to store expected result: -1 means creat() should succeed ETXTBSY means it should fail with that errno setup() now sets exp_errno from kernel version Simplified verify_creat(): if expected is success, call creat(), close fd, print TPASS if expected is failure, use TST_EXP_FAIL2() for ETXTBSY Removed extra verbose kernel-info messages Removed exec of external child binary and replaced it with an in-process forked child using TST_CHECKPOINT_WAKE() + pause() Removed .resource_files from test
@ 2026-05-13 6:48 lepillai
2026-05-13 7:57 ` [LTP] " linuxtestproject.agent
2026-05-13 12:10 ` [LTP] [PATCH] " Cyril Hrubis
0 siblings, 2 replies; 3+ messages in thread
From: lepillai @ 2026-05-13 6:48 UTC (permalink / raw)
To: ltp; +Cc: lekshmi-cpillai
From: lekshmi-cpillai <lekshmi@ktes.isst.tadn.ibm.com>
Signed-off-by: lekshmi-cpillai <lepillai@linux.ibm.com>
---
testcases/kernel/syscalls/creat/creat07.c | 38 ++++++++++-------------
1 file changed, 17 insertions(+), 21 deletions(-)
diff --git a/testcases/kernel/syscalls/creat/creat07.c b/testcases/kernel/syscalls/creat/creat07.c
index c7b85ee69..f55bca2af 100644
--- a/testcases/kernel/syscalls/creat/creat07.c
+++ b/testcases/kernel/syscalls/creat/creat07.c
@@ -19,41 +19,41 @@
#define TEST_APP "creat07_child"
+static int exp_errno;
+
static void verify_creat(void)
{
pid_t pid;
pid = SAFE_FORK();
- if (pid == 0) {
- SAFE_EXECL(TEST_APP, TEST_APP, NULL);
- exit(1);
+ if (!pid) {
+ TST_CHECKPOINT_WAKE(0);
+ pause();
+ exit(0);
}
TST_CHECKPOINT_WAIT(0);
- TEST(creat(TEST_APP, O_WRONLY));
+ if (exp_errno == -1) {
+ TEST(creat(TEST_APP, O_WRONLY));
- if (TST_RET != -1) {
- tst_res(TFAIL, "creat() succeeded unexpectedly");
- return;
+ if (TST_RET < 0) {
+ tst_res(TFAIL | TTERRNO, "creat() failed unexpectedly");
+ } else {
+ SAFE_CLOSE(TST_RET);
+ tst_res(TPASS, "creat() succeeded");
+ }
+ } else {
+ TST_EXP_FAIL2(creat(TEST_APP, O_WRONLY), exp_errno);
}
- if (TST_ERR == ETXTBSY)
- tst_res(TPASS, "creat() received EXTBSY");
- else
- tst_res(TFAIL | TTERRNO, "creat() failed unexpectedly");
-
SAFE_KILL(pid, SIGKILL);
SAFE_WAITPID(pid, NULL, 0);
}
static void setup(void)
{
- if ((tst_kvercmp(6, 11, 0)) >= 0) {
- tst_brk(TCONF, "Skipping test, write to executed file is "
- "allowed since 6.11-rc1.\n"
- "2a010c412853 (\"fs: don't block i_writecount during exec\")");
- }
+ exp_errno = tst_kvercmp(6, 11, 0) >= 0 ? -1 : ETXTBSY;
}
static struct tst_test test = {
@@ -61,8 +61,4 @@ static struct tst_test test = {
.test_all = verify_creat,
.needs_checkpoints = 1,
.forks_child = 1,
- .resource_files = (const char *const []) {
- TEST_APP,
- NULL
- }
};
--
2.39.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] Patch:V2:creat07():Added new_behavior flag to detect kernel version > 6.11 : Tests that creat() succeeds (write to executed file allowed) Removed the old skip logic that did TCONF on kernel >= 6.11 Added one static variable exp_errno to store expected result: -1 means creat() should succeed ETXTBSY means it should fail with that errno setup() now sets exp_errno from kernel version Simplified verify_creat(): if expected is success, call creat(), close fd, print TPASS if expected is failure, use TST_EXP_FAIL2() for ETXTBSY Removed extra verbose kernel-info messages Removed exec of external child binary and replaced it with an in-process forked child using TST_CHECKPOINT_WAKE() + pause() Removed .resource_files from test
2026-05-13 6:48 [LTP] [PATCH] Patch:V2:creat07():Added new_behavior flag to detect kernel version > 6.11 : Tests that creat() succeeds (write to executed file allowed) Removed the old skip logic that did TCONF on kernel >= 6.11 Added one static variable exp_errno to store expected result: -1 means creat() should succeed ETXTBSY means it should fail with that errno setup() now sets exp_errno from kernel version Simplified verify_creat(): if expected is success, call creat(), close fd, print TPASS if expected is failure, use TST_EXP_FAIL2() for ETXTBSY Removed extra verbose kernel-info messages Removed exec of external child binary and replaced it with an in-process forked child using TST_CHECKPOINT_WAKE() + pause() Removed .resource_files from test lepillai
@ 2026-05-13 7:57 ` linuxtestproject.agent
2026-05-13 12:10 ` [LTP] [PATCH] " Cyril Hrubis
1 sibling, 0 replies; 3+ messages in thread
From: linuxtestproject.agent @ 2026-05-13 7:57 UTC (permalink / raw)
To: lepillai; +Cc: ltp
Hi Lekshmi,
On Wed, 13 May 2026, lekshmi-cpillai wrote:
> Patch:V2:creat07():Added new_behavior flag to detect kernel version > 6.11...
The commit subject must be a single concise line (<=72 chars) in imperative
form without a "Patch:V2:" prefix. The body must explain WHY the old TCONF
approach was wrong, not just list what was changed.
> - if (pid == 0) {
> - SAFE_EXECL(TEST_APP, TEST_APP, NULL);
> - exit(1);
> + if (!pid) {
> + TST_CHECKPOINT_WAKE(0);
> + pause();
> + exit(0);
> }
Removing SAFE_EXECL breaks the ETXTBSY path: creat() only returns ETXTBSY
when the target file is being executed by another process. Since the new
child never exec's creat07_child, creat(TEST_APP, O_WRONLY) will never
return ETXTBSY on kernels < 6.11 — that test branch will always fail.
Restore the exec of the child binary (or find another way to hold the
inode busy during execution).
> /*\
> * Check that :manpage:`creat(2)` sets ETXTBSY correctly.
> */
Update the doc comment to describe both behaviors: ETXTBSY on kernel < 6.11
and success on kernel >= 6.11.
Pre-existing issues noticed in the surrounding code (not introduced by
this patch):
- testcases/kernel/syscalls/creat/creat07_child.c — orphaned: still
compiled by the wildcard Makefile and listed in .gitignore, but no
longer exec'd and removed from .resource_files. Either delete it or
restore the SAFE_EXECL call.
---
Note:
Our agent completed the review of the patch. The full review can be
found at: https://github.com/linux-test-project/ltp-agent/actions/runs/25785799074
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] Patch:V2:creat07():Added new_behavior flag to detect kernel version > 6.11 : Tests that creat() succeeds (write to executed file allowed) Removed the old skip logic that did TCONF on kernel >= 6.11 Added one static variable exp_errno to store expected result: -1 means creat() should succeed ETXTBSY means it should fail with that errno setup() now sets exp_errno from kernel version Simplified verify_creat(): if expected is success, call creat(), close fd, print TPASS if expected is failure, use TST_EXP_FAIL2() for ETXTBSY Removed extra verbose kernel-info messages Removed exec of external child binary and replaced it with an in-process forked child using TST_CHECKPOINT_WAKE() + pause() Removed .resource_files from test
2026-05-13 6:48 [LTP] [PATCH] Patch:V2:creat07():Added new_behavior flag to detect kernel version > 6.11 : Tests that creat() succeeds (write to executed file allowed) Removed the old skip logic that did TCONF on kernel >= 6.11 Added one static variable exp_errno to store expected result: -1 means creat() should succeed ETXTBSY means it should fail with that errno setup() now sets exp_errno from kernel version Simplified verify_creat(): if expected is success, call creat(), close fd, print TPASS if expected is failure, use TST_EXP_FAIL2() for ETXTBSY Removed extra verbose kernel-info messages Removed exec of external child binary and replaced it with an in-process forked child using TST_CHECKPOINT_WAKE() + pause() Removed .resource_files from test lepillai
2026-05-13 7:57 ` [LTP] " linuxtestproject.agent
@ 2026-05-13 12:10 ` Cyril Hrubis
1 sibling, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2026-05-13 12:10 UTC (permalink / raw)
To: lepillai; +Cc: lekshmi-cpillai, ltp
Hi!
I think the best solution is to change this test not to run on newer
kernel and write a new test that checks the new behavior. Combining the
two different expectations in a single test is going to be inherently
messy.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-13 12:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-13 6:48 [LTP] [PATCH] Patch:V2:creat07():Added new_behavior flag to detect kernel version > 6.11 : Tests that creat() succeeds (write to executed file allowed) Removed the old skip logic that did TCONF on kernel >= 6.11 Added one static variable exp_errno to store expected result: -1 means creat() should succeed ETXTBSY means it should fail with that errno setup() now sets exp_errno from kernel version Simplified verify_creat(): if expected is success, call creat(), close fd, print TPASS if expected is failure, use TST_EXP_FAIL2() for ETXTBSY Removed extra verbose kernel-info messages Removed exec of external child binary and replaced it with an in-process forked child using TST_CHECKPOINT_WAKE() + pause() Removed .resource_files from test lepillai
2026-05-13 7:57 ` [LTP] " linuxtestproject.agent
2026-05-13 12:10 ` [LTP] [PATCH] " Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox