The quilt patch titled Subject: mm, pmem, xfs: Introduce MF_MEM_PRE_REMOVE for unbind has been removed from the -mm tree. Its filename was mm-pmem-xfs-introduce-mf_mem_pre_remove-for-unbind-v15.patch This patch was dropped because an updated version will be merged ------------------------------------------------------ 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