[PATCH 0/6] dax poison recovery with RWF_RECOVERY_DATA flag

Jane Chu
2021-10-21T00:12:26Z

This patch set is a follow up to below conversation
https://lore.kernel.org/linux-xfs/20210927210750.GH1756565@dread.disaster.area/
where Dave Chinner proposed a single flag RWF_RECOVER_DATA to
be added to the system calls preadv2() and pwritev2() for the
purpose of user directed recovery from data loss due to poison
in a dax range.

The idea is that when a dax range is poisoned, this flag gives
preadv2() permission to fetch as much clean data as possible,
and permission for pwritev2() to attempt to clear poison(s)
in the range and then store the good data over.

This feature maybe deployed by user process' signal handler
in response to SIGBUS with BUS_MCEERR_AR or BUS_ADRERR when
the 'si_addr' points to a dax range; or, simply when not sure
of a poison free range. This approach does not fragment the
dax backend, if it is unable to clear poison, it will fail
the pwritev2() so that the situation is explicit to the user.
This approach is not recommended to normal non-recovery
code path due to potential performance impact incurred by
poison checking.

Also, this approach is an alternative to the existing
punch-a-hole-followed-by-pwrite approach which does not clear
poison, but instead, allocates a discontiguous clean backend
range to satisfy the pwrite().

Jane Chu (6):
dax: introduce RWF_RECOVERY_DATA flag to preadv2() and pwritev2()
dax: prepare dax_direct_access() API with DAXDEV_F_RECOVERY flag
pmem: pmem_dax_direct_access() to honor the DAXDEV_F_RECOVERY flag
dm,dax,pmem: prepare dax_copy_to/from_iter() APIs with
DAXDEV_F_RECOVERY
dax,pmem: Add data recovery feature to pmem_copy_to/from_iter()
dm: Ensure dm honors DAXDEV_F_RECOVERY flag on dax only

drivers/dax/super.c | 19 ++++---
drivers/md/dm-linear.c | 12 ++---
drivers/md/dm-log-writes.c | 17 ++++---
drivers/md/dm-stripe.c | 12 ++---
drivers/md/dm-target.c | 2 +-
drivers/md/dm-writecache.c | 4 +-
drivers/md/dm.c | 16 +++---
drivers/nvdimm/pmem.c | 88 ++++++++++++++++++++++++++++-----
drivers/nvdimm/pmem.h | 2 +-
drivers/s390/block/dcssblk.c | 13 +++--
fs/dax.c | 24 ++++++---
fs/fuse/dax.c | 2 +-
fs/fuse/virtio_fs.c | 12 ++---
include/linux/dax.h | 15 +++---
include/linux/device-mapper.h | 4 +-
include/linux/fs.h | 1 +
include/linux/iomap.h | 1 +
include/uapi/linux/fs.h | 5 +-
tools/testing/nvdimm/pmem-dax.c | 2 +-
19 files changed, 173 insertions(+), 78 deletions(-)

--
2.18.4