From: linuxtestproject.agent@gmail.com
To: Gaurav Pathak <gpathak@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] syscalls/statx13: Add basic test for STATX_WRITE_ATOMIC on regular file
Date: Fri, 18 Sep 2026 12:51:56 +0000 [thread overview]
Message-ID: <20260918125156.8501-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260918111208.116077-1-gpathak@suse.de>
Hi Gaurav,
On Thu Sep 17 16:23:04 2026 +0530, Gaurav Pathak wrote:
> syscalls/statx13: Add basic test for STATX_WRITE_ATOMIC on regular file
> Fixes: #1224
>
> Signed-off-by: Gaurav Pathak <gaurav.pathak@suse.com>
> Closes: #1224 or a Link tag to reference an issue.
Fixes: tags must reference a commit SHA present in git history, not an issue.
Use Closes: #1224 to reference the issue. Also remove the unedited template
instruction "or a Link tag to reference an issue." from the Closes tag.
> diff --git a/configure.ac b/configure.ac
> index 18bfdb88c..72f423c56 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -181,7 +181,7 @@ AC_CHECK_MEMBERS([struct iocb.aio_rw_flags],,,[#include <linux/aio_abi.h>])
> AC_CHECK_MEMBERS([struct fanotify_event_info_fid.fsid.__val],,,[#include <sys/fanotify.h>])
> AC_CHECK_MEMBERS([struct perf_event_mmap_page.aux_head],,,[#include <linux/perf_event.h>])
> AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],[],[],[#include <signal.h>])
> -AC_CHECK_MEMBERS([struct statx.stx_mnt_id, struct statx.stx_dio_mem_align],,,[
> +AC_CHECK_MEMBERS([struct statx.stx_mnt_id, struct statx.stx_dio_mem_align, struct statx.stx_atomic_write_unit_max_opt],,,[
> #define _GNU_SOURCE
> #include <sys/stat.h>
> ])
configure.ac checks may only enable fallback API definitions in
include/lapi/. Fallback definitions for struct statx extensions and atomic
write flags should be added to include/lapi/stat.h instead.
> diff --git a/testcases/kernel/syscalls/statx/statx13.c b/testcases/kernel/syscalls/statx/statx13.c
> new file mode 100644
> index 000000000..ea42a102c
> --- /dev/null
> +++ b/testcases/kernel/syscalls/statx/statx13.c
Add an entry for statx13 to runtest/syscalls.
> +/*\
> + * This test validates the STATX_WRITE_ATOMIC feature (introduced in Linux 6.13).
> + * It ensures that supported filesystems (xfs as of now) correctly report their
> + * atomic write limits to user space when queried via statx().
> + *
> + * The test performs the following validations:
> + * - Creates a test file using O_DIRECT (a prerequisite for atomic writes).
Insert a blank line before the bulleted list so Sphinx can parse the reST
block correctly. Also, reference the syscall as :manpage:`statx(2)`.
> +#define TESTFILE MNTPOINT"/testfile"
Add a space between concatenated string literals: MNTPOINT "/testfile".
> +#define _GNU_SOURCE
> +#include <sys/param.h>
> +#include "tst_test.h"
Include "lapi/stat.h". Fallback definitions for STATX_WRITE_ATOMIC,
STATX_ATTR_WRITE_ATOMIC, and atomic write fields in struct statx must be
provided in include/lapi/stat.h so the test compiles on older C libraries.
> +#ifdef HAVE_STRUCT_STATX_STX_ATOMIC_WRITE_UNIT_MAX_OPT
> + if (buff.stx_atomic_write_unit_max_opt == 0) {
Do not place #ifdef guards inside function bodies. Define the fallback
struct in include/lapi/stat.h so the test code compiles unconditionally.
> + if (buff.stx_atomic_write_unit_max_opt > buff.stx_atomic_write_unit_max)
> + tst_res(TFAIL, "stx_atomic_write_unit_max_opt (%u) exceeds max (%u)",
> + buff.stx_atomic_write_unit_max_opt,
> + buff.stx_atomic_write_unit_max);
> +
> + else if (buff.stx_atomic_write_unit_max_opt < buff.stx_atomic_write_unit_min)
Remove the blank line between if and else if to follow kernel coding style.
> +static void setup(void)
> +{
> + char *data_buff = SAFE_MEMALIGN(ALIGNMENT, WRITE_SIZE);
> +
> + if (strcmp(tst_device->fs_type, "xfs") && strcmp(tst_device->fs_type, "ext4"))
> + tst_brk(TCONF, "This test only supports ext4 and xfs");
> +
> + umask(0);
> + memset(data_buff, '@', WRITE_SIZE);
> +
> + file_fd = SAFE_OPEN(TESTFILE, O_RDWR | O_CREAT | O_DIRECT, MODE);
> + SAFE_WRITE(SAFE_WRITE_ALL, file_fd, data_buff, WRITE_SIZE);
> +}
data_buff is never freed, leaking memory. Move the allocation after the
filesystem check and call free(data_buff) after SAFE_WRITE(). Also remove
the double space after '=' in file_fd assignment.
> +static void cleanup(void)
> +{
> + if (file_fd > -1)
> + SAFE_CLOSE(file_fd);
> +}
Use if (file_fd != -1) instead of file_fd > -1 to match the LTP convention.
Verdict - Needs revision
---
Note:
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
next prev parent reply other threads:[~2026-09-18 12:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 2:56 [LTP] [PATCH] syscalls/statx13: Add basic test for STATX_WRITE_ATOMIC on regular file Gaurav Pathak
2026-09-17 10:53 ` Gaurav Pathak
2026-09-17 11:17 ` [LTP] " linuxtestproject.agent
2026-09-17 14:19 ` [LTP] [PATCH] " Petr Vorel
2026-09-18 11:04 ` gpathak
2026-09-17 14:23 ` Petr Vorel
2026-09-18 11:12 ` [LTP] [PATCH v3] " Gaurav Pathak
2026-09-18 12:51 ` linuxtestproject.agent [this message]
2026-10-05 13:18 ` [LTP] " Andrea Cervesato via ltp
2026-10-08 14:26 ` [LTP] [PATCH] " Andrea Cervesato via ltp
2026-09-17 11:15 ` [LTP] " linuxtestproject.agent
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=20260918125156.8501-1-linuxtestproject.agent@gmail.com \
--to=linuxtestproject.agent@gmail.com \
--cc=gpathak@suse.de \
--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