Re: [PATCH v3 1/5] selftests/mm: skip COW tmpfile cases when fallocate() is unsupported

From: Usama Arif

Date: Mon Jul 27 2026 - 12:50:12 EST


On Mon, 27 Jul 2026 10:52:17 +0100 Muhammad Usama Anjum <usama.anjum@xxxxxxx> wrote:

> The tmpfile-backed COW cases allocate a one-page file with fallocate()
> before exercising private and shared mappings. When the filesystem
> backing tmpfile() does not implement fallocate(), setup fails with
> EOPNOTSUPP and no COW behavior is exercised.
>
> This occurs when the temporary directory resides on a filesystem with
> limited allocation support, such as NFSv3. Reporting a failure adds
> noise because the test prerequisite is absent rather than the COW
> implementation being broken.
>
> Report EOPNOTSUPP as a skip. Continue treating every other fallocate()
> error as a failure so unexpected setup regressions remain visible.
>
> Tested-by: Sarthak Sharma <sarthak.sharma@xxxxxxx>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@xxxxxxx>
> ---
> tools/testing/selftests/mm/cow.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
> index 0c627ea89ff7b..c1b8920e29342 100644
> --- a/tools/testing/selftests/mm/cow.c
> +++ b/tools/testing/selftests/mm/cow.c
> @@ -1718,8 +1718,13 @@ static void run_with_tmpfile(non_anon_test_fn fn, const char *desc)
>
> /* File consists of a single page filled with zeroes. */
> if (fallocate(fd, 0, 0, pagesize)) {
> - ksft_perror("fallocate() failed");
> - log_test_result(KSFT_FAIL);
> + if (errno == EOPNOTSUPP) {
> + ksft_print_msg("fallocate() not supported by filesystem\n");
> + log_test_result(KSFT_SKIP);
> + } else {
> + ksft_perror("fallocate() failed");
> + log_test_result(KSFT_FAIL);
> + }


Correctly skips only unsupported fallocate() setup

Acked-by: Usama Arif <usama.arif@xxxxxxxxx>

> goto close;
> }
>
> --
> 2.47.3
>
>