All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v10 0/9] fsdax: introduce fs query to support reflink
@ 2022-01-27 12:40 Shiyang Ruan
  2022-01-27 12:40 ` [PATCH v10 1/9] dax: Introduce holder for dax_device Shiyang Ruan
                   ` (8 more replies)
  0 siblings, 9 replies; 43+ messages in thread
From: Shiyang Ruan @ 2022-01-27 12:40 UTC (permalink / raw)
  To: linux-kernel, linux-xfs, nvdimm, linux-mm, linux-fsdevel
  Cc: djwong, dan.j.williams, david, hch, jane.chu

This patchset is aimed to support shared pages tracking for fsdax.

Changes since V9:
  - Remove dax write/read lock patch
  - Remove dax_lock_entry() in dax_lock_mapping_entry() and rename it to
      dax_load_page()
  - Wrap dax code in memory-failure.c with #if IS_ENABLED(CONFIG_FS_DAX)
  - Wrap xfs_dax_failure_fn() with #if IS_ENABLED(CONFIG_MEMORY_FAILURE)
  - Move PAGE_MAPPING_DAX_COW into page-flags.h

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()
|  |* xfs_dax_notify_failure()
|  |--------------------------
|  |   xfs_rmap_query_range()
|  |    xfs_dax_failure_fn()
|  |    * corrupted on metadata
|  |       try to recover data, call xfs_force_shutdown()
|  |    * corrupted on file data
|  |       try to recover data, call mf_dax_kill_procs()
|* normal case
|-------------
|mf_generic_kill_procs()

==
Shiyang Ruan (9):
  dax: Introduce holder for dax_device
  mm: factor helpers for memory_failure_dev_pagemap
  pagemap,pmem: Introduce ->memory_failure()
  fsdax: fix function description
  fsdax: Introduce dax_load_page()
  mm: move pgoff_address() to vma_pgoff_address()
  mm: Introduce mf_dax_kill_procs() for fsdax case
  xfs: Implement ->notify_failure() for XFS
  fsdax: set a CoW flag when associate reflink mappings

 drivers/dax/super.c         |  62 ++++++++++
 drivers/nvdimm/pmem.c       |  16 +++
 fs/dax.c                    | 123 +++++++++++++++----
 fs/xfs/Makefile             |   1 +
 fs/xfs/xfs_buf.c            |  12 ++
 fs/xfs/xfs_fsops.c          |   3 +
 fs/xfs/xfs_mount.h          |   1 +
 fs/xfs/xfs_notify_failure.c | 222 ++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_notify_failure.h |  10 ++
 include/linux/dax.h         |  37 ++++++
 include/linux/memremap.h    |  12 ++
 include/linux/mm.h          |  17 +++
 include/linux/page-flags.h  |   6 +
 mm/memory-failure.c         | 234 +++++++++++++++++++++++++-----------
 14 files changed, 666 insertions(+), 90 deletions(-)
 create mode 100644 fs/xfs/xfs_notify_failure.c
 create mode 100644 fs/xfs/xfs_notify_failure.h

-- 
2.34.1




^ permalink raw reply	[flat|nested] 43+ messages in thread
* Re: [PATCH v10 9/9] fsdax: set a CoW flag when associate reflink mappings
@ 2022-01-28 21:03 kernel test robot
  2022-01-30  3:32   ` kernel test robot
  0 siblings, 1 reply; 43+ messages in thread
From: kernel test robot @ 2022-01-28 21:03 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 15118 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20220127124058.1172422-10-ruansy.fnst@fujitsu.com>
References: <20220127124058.1172422-10-ruansy.fnst@fujitsu.com>
TO: Shiyang Ruan <ruansy.fnst@fujitsu.com>
TO: linux-kernel(a)vger.kernel.org
TO: linux-xfs(a)vger.kernel.org
TO: nvdimm(a)lists.linux.dev
TO: linux-mm(a)kvack.org
TO: linux-fsdevel(a)vger.kernel.org
CC: djwong(a)kernel.org
CC: dan.j.williams(a)intel.com
CC: david(a)fromorbit.com
CC: hch(a)infradead.org
CC: jane.chu(a)oracle.com

Hi Shiyang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v5.17-rc1]
[cannot apply to xfs-linux/for-next hnaz-mm/master next-20220128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Shiyang-Ruan/fsdax-introduce-fs-query-to-support-reflink/20220127-204239
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2c271fe77d52a0555161926c232cd5bc07178b39
:::::: branch date: 30 hours ago
:::::: commit date: 30 hours ago
config: x86_64-randconfig-c007-20220124 (https://download.01.org/0day-ci/archive/20220129/202201290206.TU7AHhWg-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project f32dccb9a43b02ce4e540d6ba5dbbdb188f2dc7d)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/26822296a70d211de3c5f4ef903d4c4cf29179bd
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Shiyang-Ruan/fsdax-introduce-fs-query-to-support-reflink/20220127-204239
        git checkout 26822296a70d211de3c5f4ef903d4c4cf29179bd
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                           *op++ = (u8) u;
                           ~~~~~~^~~~~~~~
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   2 warnings generated.
   arch/x86/kernel/cpu/intel.c:925:4: warning: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
                           intel_tlb_lookup(desc[j]);
                           ^                ~~~~~~~
   arch/x86/kernel/cpu/intel.c:909:6: note: Assuming field 'cpuid_level' is >= 2
           if (c->cpuid_level < 2)
               ^~~~~~~~~~~~~~~~~~
   arch/x86/kernel/cpu/intel.c:909:2: note: Taking false branch
           if (c->cpuid_level < 2)
           ^
   arch/x86/kernel/cpu/intel.c:915:15: note: Assuming 'i' is < 'n'
           for (i = 0 ; i < n ; i++) {
                        ^~~~~
   arch/x86/kernel/cpu/intel.c:915:2: note: Loop condition is true.  Entering loop body
           for (i = 0 ; i < n ; i++) {
           ^
   arch/x86/kernel/cpu/intel.c:916:3: note: Calling 'cpuid'
                   cpuid(2, &regs[0], &regs[1], &regs[2], &regs[3]);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/processor.h:604:2: note: Calling 'native_cpuid'
           __cpuid(eax, ebx, ecx, edx);
           ^
   arch/x86/include/asm/processor.h:579:19: note: expanded from macro '__cpuid'
   #define __cpuid                 native_cpuid
                                   ^
   arch/x86/include/asm/processor.h:604:2: note: Returning from 'native_cpuid'
           __cpuid(eax, ebx, ecx, edx);
           ^
   arch/x86/include/asm/processor.h:579:19: note: expanded from macro '__cpuid'
   #define __cpuid                 native_cpuid
                                   ^
   arch/x86/kernel/cpu/intel.c:916:3: note: Returning from 'cpuid'
                   cpuid(2, &regs[0], &regs[1], &regs[2], &regs[3]);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/cpu/intel.c:919:3: note: Loop condition is true.  Entering loop body
                   for (j = 0 ; j < 3 ; j++)
                   ^
   arch/x86/kernel/cpu/intel.c:920:8: note: Assuming the condition is false
                           if (regs[j] & (1 << 31))
                               ^~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/cpu/intel.c:920:4: note: Taking false branch
                           if (regs[j] & (1 << 31))
                           ^
   arch/x86/kernel/cpu/intel.c:919:3: note: Loop condition is true.  Entering loop body
                   for (j = 0 ; j < 3 ; j++)
                   ^
   arch/x86/kernel/cpu/intel.c:920:8: note: Assuming the condition is false
                           if (regs[j] & (1 << 31))
                               ^~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/cpu/intel.c:920:4: note: Taking false branch
                           if (regs[j] & (1 << 31))
                           ^
   arch/x86/kernel/cpu/intel.c:919:3: note: Loop condition is true.  Entering loop body
                   for (j = 0 ; j < 3 ; j++)
                   ^
   arch/x86/kernel/cpu/intel.c:920:8: note: Assuming the condition is false
                           if (regs[j] & (1 << 31))
                               ^~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/cpu/intel.c:920:4: note: Taking false branch
                           if (regs[j] & (1 << 31))
                           ^
   arch/x86/kernel/cpu/intel.c:919:3: note: Loop condition is false. Execution continues on line 924
                   for (j = 0 ; j < 3 ; j++)
                   ^
   arch/x86/kernel/cpu/intel.c:924:8: note: The value 1 is assigned to 'j'
                   for (j = 1 ; j < 16 ; j++)
                        ^~~~~
   arch/x86/kernel/cpu/intel.c:924:3: note: Loop condition is true.  Entering loop body
                   for (j = 1 ; j < 16 ; j++)
                   ^
   arch/x86/kernel/cpu/intel.c:925:4: note: 1st function call argument is an uninitialized value
                           intel_tlb_lookup(desc[j]);
                           ^                ~~~~~~~
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
>> fs/dax.c:339:2: warning: Value stored to 'mapping' is never read [clang-analyzer-deadcode.DeadStores]
           mapping = (struct address_space *)PAGE_MAPPING_DAX_COW;
           ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/dax.c:339:2: note: Value stored to 'mapping' is never read
           mapping = (struct address_space *)PAGE_MAPPING_DAX_COW;
           ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/dax.c:1813:25: warning: The result of the left shift is undefined due to shifting by '4294967295', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult]
           size_t len = PAGE_SIZE << order;
                                  ^  ~~~~~
   fs/dax.c:1812:23: note: Calling 'pe_order'
           unsigned int order = pe_order(pe_size);
                                ^~~~~~~~~~~~~~~~~
   fs/dax.c:35:6: note: Assuming 'pe_size' is not equal to PE_SIZE_PTE
           if (pe_size == PE_SIZE_PTE)
               ^~~~~~~~~~~~~~~~~~~~~~
   fs/dax.c:35:2: note: Taking false branch
           if (pe_size == PE_SIZE_PTE)
           ^
   fs/dax.c:37:6: note: Assuming 'pe_size' is not equal to PE_SIZE_PMD
           if (pe_size == PE_SIZE_PMD)
               ^~~~~~~~~~~~~~~~~~~~~~
   fs/dax.c:37:2: note: Taking false branch
           if (pe_size == PE_SIZE_PMD)
           ^
   fs/dax.c:39:6: note: Assuming 'pe_size' is not equal to PE_SIZE_PUD
           if (pe_size == PE_SIZE_PUD)
               ^~~~~~~~~~~~~~~~~~~~~~
   fs/dax.c:39:2: note: Taking false branch
           if (pe_size == PE_SIZE_PUD)
           ^
   fs/dax.c:41:2: note: Returning the value 4294967295
           return ~0;
           ^~~~~~~~~
   fs/dax.c:1812:23: note: Returning from 'pe_order'
           unsigned int order = pe_order(pe_size);
                                ^~~~~~~~~~~~~~~~~
   fs/dax.c:1812:2: note: 'order' initialized to 4294967295
           unsigned int order = pe_order(pe_size);
           ^~~~~~~~~~~~~~~~~~
   fs/dax.c:1813:25: note: The result of the left shift is undefined due to shifting by '4294967295', which is greater or equal to the width of type 'unsigned long'
           size_t len = PAGE_SIZE << order;
                                  ^  ~~~~~
   Suppressed 2 warnings (1 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   fs/crypto/fname.c:209:18: warning: The right operand of '|' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   ac = (ac << 8) | src[i];
                                  ^
   fs/crypto/fname.c:346:2: note: Taking false branch
           if (fscrypt_is_dot_dotdot(&qname)) {
           ^
   fs/crypto/fname.c:353:6: note: Assuming field 'len' is >= FS_CRYPTO_BLOCK_SIZE
           if (iname->len < FS_CRYPTO_BLOCK_SIZE)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/crypto/fname.c:353:2: note: Taking false branch
           if (iname->len < FS_CRYPTO_BLOCK_SIZE)
           ^
   fs/crypto/fname.c:356:2: note: Taking false branch
           if (fscrypt_has_encryption_key(inode))
           ^
   fs/crypto/fname.c:363:2: note: Taking false branch
           BUILD_BUG_ON(offsetofend(struct fscrypt_nokey_name, dirhash) !=
           ^
   include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
           BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:346:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:334:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:326:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   fs/crypto/fname.c:363:2: note: Loop condition is false.  Exiting loop
           BUILD_BUG_ON(offsetofend(struct fscrypt_nokey_name, dirhash) !=
           ^
   include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
           BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:346:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:334:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:318:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   fs/crypto/fname.c:365:2: note: Taking false branch
           BUILD_BUG_ON(offsetofend(struct fscrypt_nokey_name, bytes) !=

vim +/mapping +339 fs/dax.c

d2c997c0f14535 Dan Williams   2017-12-22  328  
d2c997c0f14535 Dan Williams   2017-12-22  329  /*
d2c997c0f14535 Dan Williams   2017-12-22  330   * Iterate through all mapped pfns represented by an entry, i.e. skip
d2c997c0f14535 Dan Williams   2017-12-22  331   * 'empty' and 'zero' entries.
d2c997c0f14535 Dan Williams   2017-12-22  332   */
d2c997c0f14535 Dan Williams   2017-12-22  333  #define for_each_mapped_pfn(entry, pfn) \
a77d19f46a37c0 Matthew Wilcox 2018-03-27  334  	for (pfn = dax_to_pfn(entry); \
a77d19f46a37c0 Matthew Wilcox 2018-03-27  335  			pfn < dax_end_pfn(entry); pfn++)
d2c997c0f14535 Dan Williams   2017-12-22  336  
26822296a70d21 Shiyang Ruan   2022-01-27  337  static inline void dax_mapping_set_cow_flag(struct address_space *mapping)
26822296a70d21 Shiyang Ruan   2022-01-27  338  {
26822296a70d21 Shiyang Ruan   2022-01-27 @339  	mapping = (struct address_space *)PAGE_MAPPING_DAX_COW;
26822296a70d21 Shiyang Ruan   2022-01-27  340  }
26822296a70d21 Shiyang Ruan   2022-01-27  341  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2022-02-16  3:09 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 12:40 [PATCH v10 0/9] fsdax: introduce fs query to support reflink Shiyang Ruan
2022-01-27 12:40 ` [PATCH v10 1/9] dax: Introduce holder for dax_device Shiyang Ruan
2022-01-27 16:13   ` kernel test robot
2022-01-27 16:13     ` kernel test robot
2022-01-27 16:44   ` kernel test robot
2022-01-27 16:44     ` kernel test robot
2022-02-02 13:03   ` Christoph Hellwig
2022-02-13 12:58     ` [PATCH v10.1 " Shiyang Ruan
2022-02-15 22:06       ` Dan Williams
2022-01-27 12:40 ` [PATCH v10 2/9] mm: factor helpers for memory_failure_dev_pagemap Shiyang Ruan
2022-02-01 21:03   ` Matthew Wilcox
2022-02-15 22:11   ` Dan Williams
2022-01-27 12:40 ` [PATCH v10 3/9] pagemap,pmem: Introduce ->memory_failure() Shiyang Ruan
2022-02-15 22:38   ` Dan Williams
2022-01-27 12:40 ` [PATCH v10 4/9] fsdax: fix function description Shiyang Ruan
2022-02-02 13:04   ` Christoph Hellwig
2022-02-15 23:51     ` Dan Williams
2022-01-27 12:40 ` [PATCH v10 5/9] fsdax: Introduce dax_load_page() Shiyang Ruan
2022-02-16  1:34   ` Dan Williams
2022-02-16  3:02     ` Shiyang Ruan
2022-02-16  3:07       ` Dan Williams
2022-01-27 12:40 ` [PATCH v10 6/9] mm: move pgoff_address() to vma_pgoff_address() Shiyang Ruan
2022-02-16  1:37   ` Dan Williams
2022-01-27 12:40 ` [PATCH v10 7/9] mm: Introduce mf_dax_kill_procs() for fsdax case Shiyang Ruan
2022-02-16  1:47   ` Dan Williams
2022-02-16  1:49   ` Dan Williams
2022-01-27 12:40 ` [PATCH v10 8/9] xfs: Implement ->notify_failure() for XFS Shiyang Ruan
2022-01-27 17:56   ` kernel test robot
2022-01-27 17:56     ` kernel test robot
2022-01-27 19:39   ` kernel test robot
2022-01-27 19:39     ` kernel test robot
2022-02-01 20:41   ` Darrick J. Wong
2022-02-13 13:02     ` [PATCH v10.1 " Shiyang Ruan
2022-02-15  1:46       ` Darrick J. Wong
2022-02-15  9:42         ` Shiyang Ruan
2022-02-16  1:56   ` [PATCH v10 " Dan Williams
2022-01-27 12:40 ` [PATCH v10 9/9] fsdax: set a CoW flag when associate reflink mappings Shiyang Ruan
2022-02-16  2:09   ` Dan Williams
2022-02-16  2:55     ` Shiyang Ruan
2022-02-16  3:09       ` Dan Williams
2022-01-28 21:03 kernel test robot
2022-01-30  3:32 ` kernel test robot
2022-01-30  3:32   ` kernel test robot

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.