Ping 在 2023/3/28 17:41, Shiyang Ruan 写道:
This patchset is to add gracefully unbind support for pmem. Patch1 corrects the calculation of length and end of a given range. Patch2 introduces a new flag call MF_MEM_REMOVE, to let dax holder know it is a remove event. With the help of notify_failure mechanism, we are able to shutdown the filesystem on the pmem gracefully. Changes since v10: Patch1: 1. correct the count calculation in xfs_failure_pgcnt(). Patch2: 2. drop the patch which introduces super_drop_pagecache(). 3. in mf_dax_kill_procs(), don't SetPageHWPoison() and search for all tasks while mf_flags has MF_MEM_PRE_REMOVE. 4. only do mf_dax_kill_procs() on dax mapping. 5. do invalidate_inode_pages2_range() for each file found during rmap, to make sure the dax entry are disassociated before pmem is gone. Otherwise, umount filesystem after unbind will cause crash because the dax entries have to be disassociated but now the pmem is not exist. For detail analysis of this change, please refer this link[1]. [1] https://lore.kernel.org/linux-xfs/b1d9fc03-1a71-a75f-f87b-5819991e4eb2@xxxxxxxxxxx/ Shiyang Ruan (2): xfs: fix the calculation of length and end mm, pmem, xfs: Introduce MF_MEM_REMOVE for unbind drivers/dax/super.c | 3 +- fs/xfs/xfs_notify_failure.c | 66 +++++++++++++++++++++++++++++++------ include/linux/mm.h | 1 + mm/memory-failure.c | 17 +++++++--- 4 files changed, 72 insertions(+), 15 deletions(-)