* + mm-pmem-xfs-introduce-mf_mem_pre_remove-for-unbind-v15.patch added to mm-hotfixes-unstable branch
@ 2023-09-28 16:10 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2023-09-28 16:10 UTC (permalink / raw)
To: mm-commits, willy, mcgrof, jack, djwong, dan.j.williams,
ruansy.fnst, akpm
The patch titled
Subject: mm, pmem, xfs: Introduce MF_MEM_PRE_REMOVE for unbind
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
mm-pmem-xfs-introduce-mf_mem_pre_remove-for-unbind-v15.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-pmem-xfs-introduce-mf_mem_pre_remove-for-unbind-v15.patch
This patch will later appear in the mm-hotfixes-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Shiyang Ruan <ruansy.fnst@fujitsu.com>
Subject: mm, pmem, xfs: Introduce MF_MEM_PRE_REMOVE for unbind
Date: Thu, 28 Sep 2023 18:32:27 +0800
add/fix code comments per Dan's comments
Link: https://lkml.kernel.org/r/20230928103227.250550-1-ruansy.fnst@fujitsu.com
Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
fs/xfs/xfs_notify_failure.c | 21 +++++++++++++++------
mm/memory-failure.c | 4 ++++
2 files changed, 19 insertions(+), 6 deletions(-)
--- a/fs/xfs/xfs_notify_failure.c~mm-pmem-xfs-introduce-mf_mem_pre_remove-for-unbind-v15
+++ a/fs/xfs/xfs_notify_failure.c
@@ -234,18 +234,21 @@ xfs_dax_notify_ddev_failure(
xfs_trans_cancel(tp);
/*
- * Determine how to shutdown the filesystem according to the
- * error code and flags.
+ * Shutdown fs from a force umount in pre-remove case which won't fail,
+ * so errors can be ignored. Otherwise, shutdown the filesystem with
+ * CORRUPT flag if error occured or notify.want_shutdown was set during
+ * RMAP querying.
*/
- if (error || notify.want_shutdown) {
+ if (mf_flags & MF_MEM_PRE_REMOVE)
+ xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT);
+ else if (error || notify.want_shutdown) {
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_ONDISK);
if (!error)
error = -EFSCORRUPTED;
- } else if (mf_flags & MF_MEM_PRE_REMOVE)
- xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT);
+ }
out:
- /* Thaw the fs if it is frozen before. */
+ /* Thaw the fs if it has been frozen before. */
if (mf_flags & MF_MEM_PRE_REMOVE)
xfs_dax_notify_failure_thaw(mp, kernel_frozen);
@@ -276,6 +279,12 @@ xfs_dax_notify_failure(
if (mp->m_logdev_targp && mp->m_logdev_targp->bt_daxdev == dax_dev &&
mp->m_logdev_targp != mp->m_ddev_targp) {
+ /*
+ * In the pre-remove case the failure notification is attempting
+ * to trigger a force unmount. The expectation is that the
+ * device is still present, but its removal is in progress and
+ * can not be cancelled, proceed with accessing the log device.
+ */
if (mf_flags & MF_MEM_PRE_REMOVE)
return 0;
xfs_err(mp, "ondisk log corrupt, shutting down fs!");
--- a/mm/memory-failure.c~mm-pmem-xfs-introduce-mf_mem_pre_remove-for-unbind-v15
+++ a/mm/memory-failure.c
@@ -1814,6 +1814,10 @@ int mf_dax_kill_procs(struct address_spa
if (!pre_remove)
SetPageHWPoison(page);
+ /*
+ * The pre_remove case is revoking access, the memory is still
+ * good and could theoretically be put back into service.
+ */
collect_procs_fsdax(page, mapping, index, &to_kill, pre_remove);
unmap_and_kill(&to_kill, page_to_pfn(page), mapping,
index, mf_flags);
_
Patches currently in -mm which might be from ruansy.fnst@fujitsu.com are
mm-pmem-xfs-introduce-mf_mem_pre_remove-for-unbind.patch
mm-pmem-xfs-introduce-mf_mem_pre_remove-for-unbind-v15.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-28 16:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-28 16:10 + mm-pmem-xfs-introduce-mf_mem_pre_remove-for-unbind-v15.patch added to mm-hotfixes-unstable branch Andrew Morton
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.