All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org, willy@infradead.org,
	mcgrof@kernel.org, jack@suse.cz, djwong@kernel.org,
	dan.j.williams@intel.com, ruansy.fnst@fujitsu.com,
	akpm@linux-foundation.org
Subject: + mm-pmem-xfs-introduce-mf_mem_pre_remove-for-unbind-v15.patch added to mm-hotfixes-unstable branch
Date: Thu, 28 Sep 2023 09:10:05 -0700	[thread overview]
Message-ID: <20230928161006.83262C433C8@smtp.kernel.org> (raw)


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


                 reply	other threads:[~2023-09-28 16:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230928161006.83262C433C8@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=djwong@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=ruansy.fnst@fujitsu.com \
    --cc=willy@infradead.org \
    /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.