selftests/mm: skip hard dirty page-cache test on FUSE
Subsystems (4)
PATCH 1/1 selftests/mm: skip hard dirty page-cache test on FUSE
Like NFS, FUSE reports on close() the -EIO that MADV_HWPOISON records in the mapping of a dirty page-cache page, as fuse_flush() calls filemap_check_errors(). Run from a virtiofs directory, e.g. in a virtme-ng guest, the hard dirty_pagecache variant fails on its final close():
memory-failure.c:389:dirty_pagecache:Expected close(fd) (-1) == 0 (0)
Skip it on FUSE, as commit e14e52a7ce02 ("selftests/mm: skip hard dirty page-cache test on NFS") does for NFS.
An AI coding assistant (Claude) was used to find the failure, write the fix and draft this changelog.
---
Tested in a virtme-ng guest, memory-failure built from mm-new with and without this patch, hwpoison_inject loaded:
cwd on before after virtiofs 9 pass, 1 fail 9 pass, 1 skip ext4 (loop) 10 pass 10 pass
run_vmtests.sh -t memory-failure from the virtiofs directory passes with the patch. The soft dirty_pagecache variant keeps running on FUSE and passes.
FUSE servers that open files with FOPEN_NOFLUSH do not report the error on close(), so the variant could run there; it is skipped with the rest.
--- tools/testing/selftests/mm/memory-failure.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
tools/testing/selftests/mm/memory-failure.c +4 -3
@@ -355,11 +355,12 @@ TEST_F(memory_failure, dirty_pagecache) fs_type =get_fs_type (fd);/* * MADV_HARD poisoning of dirty page-cache data records an expected -* -EIO in the file mapping. NFS reports this error on close(), so -* skip this variant. +* -EIO in the file mapping. NFS and FUSE report this error on +* close(), so skip this variant. */ if (!fs_type || fs_type ==TMPFS_MAGIC || - (fs_type ==NFS_SUPER_MAGIC && variant->type ==MADV_HARD )) { + ((fs_type ==NFS_SUPER_MAGIC || fs_type ==FUSE_SUPER_MAGIC ) && + variant->type ==MADV_HARD )) {close (fd);SKIP (return,"unsupported filesystem :%x\n" , fs_type); }
---
base-commit: 7d1a16abe4cc5dccd21e3d6262e44433a5885d27
change-id: 20261123-memory-failure-fuse-skip-b976b4ea035b
Best regards,
Signature · 1 line
Kurt Lin <[email protected]>
Quoted 41 lines · Kurt Lin
Like NFS, FUSE reports on
close()the-EIOthatMADV_HWPOISONrecords in the mapping of a dirty page-cache page, asfuse_flush()callsfilemap_check_errors(). Run from a virtiofs directory, e.g. in a virtme-ng guest, the harddirty_pagecachevariant fails on its finalclose():memory-failure.c:389:dirty_pagecache:Expected close(fd) (-1) == 0 (0)
Skip it on FUSE, as commit
e14e52a7ce02("selftests/mm: skip hard dirty page-cache test on NFS") does for NFS.An AI coding assistant (Claude) was used to find the failure, write the fix and draft this changelog.
Fixes d51b5076c746 ("selftests/mm: add memory failure dirty pagecache test")Signed-off-by Kurt Lin <[email protected]>---
Tested in a virtme-ng guest, memory-failure built from mm-new with and without this patch,hwpoison_injectloaded:cwd on before after virtiofs 9 pass, 1 fail 9 pass, 1 skip ext4 (loop) 10 pass 10 pass
run_vmtests.sh-t memory-failure from the virtiofs directory passes with the patch. The softdirty_pagecachevariant keeps running on FUSE and passes.FUSE servers that open files with
FOPEN_NOFLUSHdo not report the error onclose(), so the variant could run there; it is skipped with the rest.--- tools/testing/selftests/mm/memory-failure.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)tools/testing/selftests/mm/memory-failure.c +0
-0@@ -355,11 +355,12 @@ TEST_F(memory_failure, dirty_pagecache) fs_type =get_fs_type (fd);/*
tools/testing/selftests/mm/memory-failure.c TEST_F(memory_failure, dirty_pagecache) · line 363
Quoted 10 lines
tools/testing/selftests/mm/memory-failure.c +4
-3* MADV_HARD poisoning of dirty page-cache data records an expected -* -EIO in the file mapping. NFS reports this error on close(), so -* skip this variant. +* -EIO in the file mapping. NFS and FUSE report this error on +* close(), so skip this variant. */ if (!fs_type || fs_type ==TMPFS_MAGIC || - (fs_type ==NFS_SUPER_MAGIC && variant->type ==MADV_HARD )) { + ((fs_type ==NFS_SUPER_MAGIC || fs_type ==FUSE_SUPER_MAGIC ) && + variant->type ==MADV_HARD )) {
Would it be better to add a helper? I doubt there might be more unsupported filesystem.
Thanks.
.
Kurt Lin
Tested-byQuoted 2 lines · Miaohe Lin
Would it be better to add a helper? I doubt there might be more unsupported filesystem.
Thanks for the ack. There are more (CIFS and orangefs also report the error on close()), but Andrew has since replaced this patch in mm-new with e747ed2c3418 ("selftests/mm: check that fsync() reports hard-poisoned dirty page-cache"), which needs no per-filesystem list. My patch can be dropped.
I tested mm-new 87cdbd9bd631, which has e747ed2c3418 and 44191f78d131, in a virtme-ng guest. memory-failure now passes from virtiofs, where it failed before, still passes on ext4, and 50 runs in a row on each were clean. I did not hit the unpoison -EBUSY on virtiofs even without the ftruncate(), so that part is not covered here.
Tested with the help of an AI coding assistant. For both e747ed2c3418 and 44191f78d131:
Andrew Morton
maintainerQuoted 16 lines · On Mon, 23 Nov 2026 23:04:59 +0800 Kurt Lin <[email protected]> wrote:
Quoted 2 lines · Miaohe Lin
Would it be better to add a helper? I doubt there might be more unsupported filesystem.
Thanks for the ack. There are more (CIFS and orangefs also report the error on
close()), but Andrew has since replaced this patch in mm-new withe747ed2c3418("selftests/mm: check thatfsync()reports hard-poisoned dirty page-cache"), which needs no per-filesystem list. My patch can be dropped.I tested mm-new
87cdbd9bd631, which hase747ed2c3418and44191f78d131, in a virtme-ng guest. memory-failure now passes from virtiofs, where it failed before, still passes on ext4, and 50 runs in a row on each were clean. I did not hit the unpoison-EBUSYon virtiofs even without theftruncate(), so that part is not covered here.
Quoted 4 lines
Tested with the help of an AI coding assistant. For both
e747ed2c3418and44191f78d131:Tested-by Kurt Lin <[email protected]>
Cool, thanks. Yes, that's a work in progress, I'm drafting an email but not quite there yet. I think I have 71 filesystems working but a few (cephs, orangefs, afs, hpfs, omfs) are fighting back.