From: sashiko-bot@kernel.org
To: "Andrew Morton" <akpm@linux-foundation.org>,
"Kurt Lin" <lylin1023@gmail.com>
Cc: linux-mm@kvack.org, "Miaohe Lin" <linmiaohe@huawei.com>,
"Naoya Horiguchi" <nao.horiguchi@gmail.com>,
"David Hildenbrand" <david@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
"Vlastimil Babka" <vbabka@kernel.org>,
"Mike Rapoport" <rppt@kernel.org>,
"Michal Hocko" <mhocko@suse.com>, "Shuah Khan" <shuah@kernel.org>,
"Muhammad Usama Anjum" <usama.anjum@arm.com>,
"Amir Goldstein" <amir73il@gmail.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"German Maglione" <gmaglione@redhat.com>,
"Miklos Szeredi" <miklos@szeredi.hu>,
"Ryusuke Konishi" <konishi.ryusuke@gmail.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Vivek Goyal" <vgoyal@redhat.com>
Subject: Re: [PATCH 4/9] selftest/mm/memory-failure: keep page-cache files linked until cleanup
Date: Sun, 29 Nov 2026 06:52:50 +0000 [thread overview]
Message-ID: <sashiko-outbox-239349@kernel.org> (raw)
In-Reply-To: <1c93b263b19d4465899bb81efd62bcb3.4@linux-foundation.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/mm: test files left linked and untruncated on ASSERT
failure
--
commit ab1ec762ba7c473ad6543ed54c4b3f4498c666ae
Author: Andrew Morton <akpm@linux-foundation.org>
selftest/mm/memory-failure: keep page-cache files linked until cleanup
This commit delays unlinking the page-cache test files until test completion
or skip paths so filesystems such as CIFS and 9p do not fail fstatfs() or
ftruncate() on an unlinked file.
> diff --git a/tools/testing/selftests/mm/memory-failure.c b/tools/testing/selftests/mm/memory-failure.c
> index f94f2168e46c5..3812d57bdee64 100644
> --- a/tools/testing/selftests/mm/memory-failure.c
> +++ b/tools/testing/selftests/mm/memory-failure.c
> @@ -266,10 +266,8 @@ static int prepare_file(const char *fname, unsigned long size)
> int fd;
>
> fd = open(fname, O_RDWR | O_CREAT, 0664);
> - if (fd >= 0) {
> - unlink(fname);
> + if (fd >= 0)
> ftruncate(fd, size);
> - }
> return fd;
> }
[ ... ]
> @@ -362,6 +365,7 @@ TEST_F(memory_failure, clean_pagecache)
>
> ASSERT_EQ(munmap(addr, self->page_size), 0);
>
> + unlink(fname);
> ASSERT_EQ(close(fd), 0);
> }
[ ... ]
> @@ -423,6 +433,7 @@ TEST_F(memory_failure, dirty_pagecache)
> ASSERT_EQ(ftruncate(fd, 0), 0);
> }
>
> + unlink(fname);
> ASSERT_EQ(close(fd), 0);
> }
[Severity: Low]
Does a failed assertion in clean_pagecache or dirty_pagecache leave the test
file linked and untruncated when jumping to FIXTURE_TEARDOWN(memory_failure)?
If any ASSERT_* check in prepare(), variant->inject(), check(), munmap() or
fsync() fails, __bail() runs FIXTURE_TEARDOWN(memory_failure) and aborts
before reaching ftruncate(fd, 0) and unlink(fname). On filesystems without
error_remove_folio (such as 9p, CIFS or FUSE), cleanup() -> unpoison_memory()
in teardown then runs while the poisoned dirty folio is still in the page
cache and fails with -EBUSY, leaving the page hardware-poisoned. The file is
also left on disk, so the next variant reopens it via prepare_file() without
O_TRUNC and inherits the poisoned inode (until a later patch in the series,
commit "selftests/mm/memory-failure: extend page-cache test files with
pwrite()", adds O_TRUNC).
Recording the test fd and filename in FIXTURE(memory_failure) so
FIXTURE_TEARDOWN(memory_failure) can truncate, close and unlink the file
before calling cleanup() would handle both normal completion and assertion
failures.
--
Sashiko AI review · https://sashiko.dev/#/patchset/1c93b263b19d4465899bb81efd62bcb3.1@linux-foundation.org?part=4
next prev parent reply other threads:[~2026-11-29 6:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 6:51 [PATCH 1/9] selftests/mm/memory-failure: check that fsync() reports hard-poisoned dirty page-cache Andrew Morton
2026-11-28 6:51 ` [PATCH 2/9] selftests/mm/memory-failure: truncate poisoned FUSE page-cache before teardown Andrew Morton
2026-11-28 6:52 ` [PATCH 3/9] selftests/mm/memory-failure: skip poisoned dirty page-cache on NILFS2 Andrew Morton
2026-11-28 6:52 ` [PATCH 4/9] selftest/mm/memory-failure: keep page-cache files linked until cleanup Andrew Morton
2026-11-29 6:52 ` sashiko-bot [this message]
2026-11-28 6:52 ` [PATCH 5/9] selftests/mm/memory-failure: skip hard dirty page-cache test on CephFS Andrew Morton
2026-11-28 6:52 ` [PATCH 6/9] selftests/mm/memory-failure: close dirty page-cache files before unlinking them Andrew Morton
2026-11-28 6:52 ` [PATCH 7/9] selftests/mm/memory-failure: extend page-cache test files with pwrite() Andrew Morton
2026-11-28 6:52 ` [PATCH 8/9] selftests/mm/memory-failure: write the whole page-cache test file for OMFS Andrew Morton
2026-11-28 6:52 ` [PATCH 9/9] selftests/mm/memory-failure: accept EIO from close after poisoning dirty data Andrew Morton
2026-11-28 18:36 ` [PATCH 1/9] selftests/mm/memory-failure: check that fsync() reports hard-poisoned dirty page-cache Kurt Lin
2026-12-01 7:13 ` Miaohe Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-239349@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=amir73il@gmail.com \
--cc=david@kernel.org \
--cc=eperezma@redhat.com \
--cc=gmaglione@redhat.com \
--cc=konishi.ryusuke@gmail.com \
--cc=liam@infradead.org \
--cc=linmiaohe@huawei.com \
--cc=linux-mm@kvack.org \
--cc=lylin1023@gmail.com \
--cc=mhocko@suse.com \
--cc=miklos@szeredi.hu \
--cc=nao.horiguchi@gmail.com \
--cc=rppt@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shuah@kernel.org \
--cc=stefanha@redhat.com \
--cc=usama.anjum@arm.com \
--cc=vbabka@kernel.org \
--cc=vgoyal@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.