Re: [PATCH v2 4/5] selftests/mm: skip hard dirty page-cache test on NFS
From: Miaohe Lin
Date: Fri Jul 24 2026 - 22:12:43 EST
On 2026/7/24 18:24, Muhammad Usama Anjum wrote:
> The hard dirty_pagecache variant uses MADV_HWPOISON to exercise recovery
> of a dirty file-backed page. The recovery path records -EIO in the
> address_space mapping, which NFS later reports when the test closes the
> file. This makes the test fail after the hwpoison checks have completed.
>
> Skip this variant when the test file is on NFS. Keep the hard clean-page
> and both soft-offline variants enabled because they use folio removal,
> invalidation, or migration rather than recording a delayed writeback
> error.
>
> The unsupported-filesystem path in clean_pagecache() also returns
> without closing the opened test file. Close the descriptor before
> skipping there and in dirty_pagecache().
>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@xxxxxxx>
> ---
> Changes since v1:
> - Limit the NFS skip to the hard dirty-page variant.
> ---
> tools/testing/selftests/mm/memory-failure.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/memory-failure.c b/tools/testing/selftests/mm/memory-failure.c
> index 032ed952057c6..3c72084f57e8b 100644
> --- a/tools/testing/selftests/mm/memory-failure.c
> +++ b/tools/testing/selftests/mm/memory-failure.c
> @@ -283,8 +283,10 @@ TEST_F(memory_failure, clean_pagecache)
> if (fd < 0)
> SKIP(return, "failed to open test file.\n");
> fs_type = get_fs_type(fd);
> - if (!fs_type || fs_type == TMPFS_MAGIC)
> + if (!fs_type || fs_type == TMPFS_MAGIC) {
> + close(fd);
> SKIP(return, "unsupported filesystem :%x\n", fs_type);
> + }
>
> addr = mmap(0, self->page_size, PROT_READ | PROT_WRITE,
> MAP_SHARED, fd, 0);
> @@ -325,8 +327,11 @@ TEST_F(memory_failure, dirty_pagecache)
> if (fd < 0)
> SKIP(return, "failed to open test file.\n");
> fs_type = get_fs_type(fd);
> - if (!fs_type || fs_type == TMPFS_MAGIC)
> + if (!fs_type || fs_type == TMPFS_MAGIC ||
> + (fs_type == NFS_SUPER_MAGIC && variant->type == MADV_HARD)) {
It would be helpful if we add some comments here.
Reviewed-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>
Thanks.
.