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

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Mon Oct 26 22:30:30 CET 2026


Hi Gaurav,

On Mon Oct 26 22:40:55 2026 +0530, Gaurav Pathak <gaurav.pathak@suse.com>
wrote:
> syscalls/statx13: Add test for STATX_WRITE_ATOMIC on regular file

> +#define PATH_EXT4_BS_GT_PS "/sys/fs/ext4/features/blocksize_gt_pagesize"
> +
> +static int has_thp(void)
> +{
> +	return access(PATH_MM_THP, F_OK) == 0;
> +}
> ...
> +static int fs_supports_large_block(const char *fs_type)
> +{
> +	if (!strcmp(fs_type, "ext4"))
> +		return access(PATH_EXT4_BS_GT_PS, F_OK) == 0;
> +
> +	return has_thp();
> +}
> ...
> +	if (!strcmp(tst_device->fs_type, "xfs")) {
> +		if (max >= 65536 && fs_supports_large_block(tst_device->fs_type))
> +			bsize = 16384;
> +		else if (fs_supports_large_block(tst_device->fs_type))
> +			bsize = max;
> +		else
> +			bsize = MIN(max, (unsigned int)getpagesize());
> +	} else {
> +		bsize = MIN(max, (unsigned int)getpagesize());
> +	}

fs_supports_large_block() is only called inside the "xfs" branch in setup(),
while the ext4 branch unconditionally caps bsize to getpagesize(). As a
result, PATH_EXT4_BS_GT_PS and the "ext4" check in fs_supports_large_block()
are dead code, and the commit message claim that ext4 block size uses
blocksize_gt_pagesize does not match setup(). Either drop PATH_EXT4_BS_GT_PS
and fs_supports_large_block() (calling has_thp() directly for "xfs") and
update the commit message, or use fs_supports_large_block() in the ext4
branch as well.

> +static void cleanup(void)
> +{
> +	if (file_fd != -1) {
> +		SAFE_CLOSE(file_fd);
> +		file_fd = -1;
> +	}
> +	if (mount_flag)
> +		tst_umount(MNTPOINT);
> +}

SAFE_CLOSE() already resets file_fd to -1. Drop the manual file_fd = -1
assignment and the surrounding curly braces.

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