]> git.proxmox.com Git - mirror_zfs.git/commit
Fix corruption caused by mmap flushing problems
authorRobert Evans <rrevans@gmail.com>
Mon, 25 Mar 2024 21:56:49 +0000 (17:56 -0400)
committerGitHub <noreply@github.com>
Mon, 25 Mar 2024 21:56:49 +0000 (14:56 -0700)
commit102b468b5e190973fbaee6fe682727eb33079811
treeee46fb3f3ecdd125fcf0f787a97e20c5db0cc877
parentc28f94f32ef0f104b731be0e44c5e61bbdf3b9b7
Fix corruption caused by mmap flushing problems

1) Make mmap flushes synchronous. Linux may skip flushing dirty pages
   already in writeback unless data-integrity sync is requested.

2) Change zfs_putpage to use TXG_WAIT. Otherwise dirty pages may be
   skipped due to DMU pushing back on TX assign.

3) Add missing mmap flush when doing block cloning.

4) While here, pass errors from putpage to writepage/writepages.

This change fixes corruption edge cases, but unfortunately adds
synchronous ZIL flushes for dirty mmap pages to llseek and bclone
operations. It may be possible to avoid these sync writes later
but would need more tricky refactoring of the writeback code.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Robert Evans <evansr@google.com>
Closes #15933
Closes #16019
module/os/linux/zfs/zfs_vnops_os.c
module/os/linux/zfs/zpl_file.c
module/zfs/zfs_vnops.c