Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6814061pxv; Fri, 30 Jul 2021 03:05:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcw25k07RUAXLdnqgAjOcL108KFeBdUMBUnBEflZ+b9YVyQ1ZD9KbgmpLnxHf/cKj01S32 X-Received: by 2002:a17:906:2bdb:: with SMTP id n27mr1828256ejg.312.1627639535656; Fri, 30 Jul 2021 03:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627639535; cv=none; d=google.com; s=arc-20160816; b=m8G/ASPLZ8jsRz+lXkRWh4Z36fbZqjRf7+5AOGk3C0zk3csFIdeddn8xBBqKhITcrG Dxru4W/G497IhJ+6fRUxge+mChdyPaVLptEdgmcUnzvXoa25LN1+CsCm1giKzmHU4ff7 rfojZvVUyTD40AjBFrqJsDyJAIJB0NnHF6dSws/gLQea2JU4aVvENMi6YgUc0QObRg7i 4lxpJFd8PJ+dDSyn3F5zwzEZ7BKE9OXRWL4R8wHz3/6SphBF0O9IiothBaoFOTIVs0QH eTjYFYayneLNSvY/O5yXDhmbothINpQPEZfr8+sB3SCZ7NMjr+X6Y9QK5MmtOiHxbKc+ 3GBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-hdrordr; bh=p5LkEOcZLTNUk03yMSKzywYEWfOTzeYpwEb5O33b6p0=; b=ChA10NobQnVdhNMVjErJUGXLMacFVX6K+6wwAnSINMOlsr1+bKZ4f0eb5d7yiGurCR kae3TcE2bCGH0Rly9pG+ilQ2WUsOrVXpbo2KiU/EW3UUYgWur43mJ1Jz4Wg/mHZeL71E RI5ilpddY6E5i0YwffSAWDQ+ueua7KcOxaJJzTtQmzGffb0cLm2amrs5BwhaxE+w7GzV zbKqA+GJpGN2mynb1ZGQrKZyitehnL5prApzEeHyoSDhEy0Ch0+1kV04TpidYqB/pRNg cn8phcnqs+wbLgqy9Q97/VKVlNEHhf6N0y7mMD68tf2juXhNxmzTj18OdX1hI+840Bs0 XA9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r7si1162245edo.180.2021.07.30.03.05.11; Fri, 30 Jul 2021 03:05:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238433AbhG3KDR (ORCPT + 99 others); Fri, 30 Jul 2021 06:03:17 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:36456 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238330AbhG3KCN (ORCPT ); Fri, 30 Jul 2021 06:02:13 -0400 IronPort-HdrOrdr: =?us-ascii?q?A9a23=3A8+cL/arpl8z7A3Y9qNRPyyEaV5rDeYIsimQD?= =?us-ascii?q?101hICG8cqSj+fxG+85rsSMc6QxhP03I9urhBEDtex/hHP1OkOws1NWZLWrbUQ?= =?us-ascii?q?KTRekIh+bfKlbbehEWmNQz6U4ZSdkdNDTvNykAse/KpBm/D807wMSKtIShheLl?= =?us-ascii?q?xX9rSg1wApsQljtRO0KKFFFsXglaCd4cHJqY3MBOoD2tYjA5dcK+b0N1J9Trlp?= =?us-ascii?q?nako78ex4aC1oC4AmKtzmh77n3CFy5834lIlVy/Ys=3D?= X-IronPort-AV: E=Sophos;i="5.84,281,1620662400"; d="scan'208";a="112074003" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 30 Jul 2021 18:02:07 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 8FBC94D0D49D; Fri, 30 Jul 2021 18:02:01 +0800 (CST) Received: from G08CNEXCHPEKD09.g08.fujitsu.local (10.167.33.85) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Fri, 30 Jul 2021 18:02:01 +0800 Received: from irides.mr.mr.mr (10.167.225.141) by G08CNEXCHPEKD09.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.23 via Frontend Transport; Fri, 30 Jul 2021 18:02:00 +0800 From: Shiyang Ruan To: , , , , , CC: , , , , , Subject: [PATCH RESEND v6 0/9] fsdax: introduce fs query to support reflink Date: Fri, 30 Jul 2021 18:01:49 +0800 Message-ID: <20210730100158.3117319-1-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-yoursite-MailScanner-ID: 8FBC94D0D49D.A3938 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: ruansy.fnst@fujitsu.com X-Spam-Status: No Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset is aimed to support shared pages tracking for fsdax. Changes for RESEND: - update the title of patch 6 - update the wrong email address of one receiver Changes from V5: - fix dax_load_pfn(), take locked,empty,zero dax entry into consideration - fix the usage of rwsem lock for dax_device's holder - fix build error reported by kernelbot - keep functionality of dax_{,dis}assocaite_entry() for filesystems doesn't have rmapbt feature - Rebased to v5.14-rc3 This patchset moves owner tracking from dax_assocaite_entry() to pmem device driver, by introducing an interface ->memory_failure() for struct pagemap. This interface is called by memory_failure() in mm, and implemented by pmem device. Then call holder operations to find the filesystem which the corrupted data located in, and call filesystem handler to track files or metadata associated with this page. Finally we are able to try to fix the corrupted data in filesystem and do other necessary processing, such as killing processes who are using the files affected. The call trace is like this: memory_failure() |* fsdax case |------------ |pgmap->ops->memory_failure() => pmem_pgmap_memory_failure() | dax_holder_notify_failure() => | dax_device->holder_ops->notify_failure() => | - xfs_dax_notify_failure() | - md_dax_notify_failure() | |* xfs_dax_notify_failure() | |-------------------------- | | xfs_rmap_query_range() | | xfs_currupt_helper() | | * corrupted on metadata | | try to recover data, call xfs_force_shutdown() | | * corrupted on file data | | try to recover data, call mf_dax_kill_procs() | |* md_dax_notify_failure() | |------------------------- | md_targets->iterate_devices() | md_targets->rmap() => linear_rmap() | dax_holder_notify_failure() |* normal case |------------- mf_generic_kill_procs() The fsdax & reflink support for XFS is not contained in this patchset. (Rebased on v5.14-rc3) == Shiyang Ruan (9): pagemap: Introduce ->memory_failure() dax: Introduce holder for dax_device mm: factor helpers for memory_failure_dev_pagemap pmem,mm: Implement ->memory_failure in pmem driver mm: Introduce mf_dax_kill_procs() for fsdax case xfs: Implement ->notify_failure() for XFS dm: Introduce ->rmap() to find bdev offset md: Implement dax_holder_operations fsdax: add exception for reflinked files block/genhd.c | 56 +++++++++++ drivers/dax/super.c | 58 ++++++++++++ drivers/md/dm-linear.c | 20 ++++ drivers/md/dm.c | 126 ++++++++++++++++++++++++- drivers/nvdimm/pmem.c | 13 +++ fs/dax.c | 59 ++++++++---- fs/xfs/xfs_fsops.c | 5 + fs/xfs/xfs_mount.h | 1 + fs/xfs/xfs_super.c | 135 +++++++++++++++++++++++++++ include/linux/dax.h | 46 +++++++++ include/linux/device-mapper.h | 5 + include/linux/genhd.h | 1 + include/linux/memremap.h | 9 ++ include/linux/mm.h | 10 ++ mm/memory-failure.c | 169 +++++++++++++++++++++++----------- 15 files changed, 641 insertions(+), 72 deletions(-) -- 2.32.0