+ mm-pmem-xfs-introduce-mf_mem_pre_remove-for-unbind-v15.patch added to mm-hotfixes-unstable branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
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@xxxxxxxxxxx
Signed-off-by: Shiyang Ruan <ruansy.fnst@xxxxxxxxxxx>
Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx>
Acked-by: Dan Williams <dan.j.williams@xxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>
Cc: Luis Chamberlain <mcgrof@xxxxxxxxxx>
Cc: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 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@xxxxxxxxxxx are

mm-pmem-xfs-introduce-mf_mem_pre_remove-for-unbind.patch
mm-pmem-xfs-introduce-mf_mem_pre_remove-for-unbind-v15.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux