[LTP] syscalls/statx13: Add test for STATX_WRITE_ATOMIC on regular file

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Tue Oct 27 08:33:18 CET 2026


Hi Gaurav,

On Tue, Oct 27, 2026 at 12:36:25PM +0530, Gaurav Pathak wrote:
> syscalls/statx13: Add test for STATX_WRITE_ATOMIC on regular file

> +static int file_fd = -1;
> +static int mount_flag;
> +static char *data_buff = NULL;
> +static struct ltp_statx *buff;

Initializing a static pointer to NULL triggers a checkpatch.pl error
("ERROR: do not initialise statics to NULL"). Remove the "= NULL"
initializer, or make data_buff and file_fd local to setup() since they
are only used to create TESTFILE.

> +static void verify_statx(void)
> +{
> +	TST_EXP_PASS(statx(AT_FDCWD, TESTFILE, 0, STATX_BASIC_STATS | STATX_WRITE_ATOMIC, &buff->buff),
> +			"statx(AT_FDCWD, %s, 0, STATX_BASIC_STATS | STATX_WRITE_ATOMIC, &buf)", TESTFILE);
> +
> +	if (!TST_PASS)
> +		return;
> +
> +	/* Check if the kernel populated the atomic limit struct members */
> +	if (!(buff->data.stx_mask & STATX_WRITE_ATOMIC))
> +		tst_brk(TCONF, "Kernel may be too old to report atomic limits: STATX_WRITE_ATOMIC missing from stx_mask");

TST_EXP_PASS() records a TPASS before the TCONF checks on stx_mask and
stx_attributes, which causes do_exit() to suppress the TCONF exit status
when atomic writes are unsupported on both XFS (v6.13-v6.15 without
hardware support) and ext4. Use TST_EXP_PASS_SILENT() here (as in
statx10.c and statx11.c) so TPASS is only recorded when the atomic write
fields are supported and verified.

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


More information about the ltp mailing list