mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-29 12:29:35 +03:00
c0c4866f8a
When ZFS overwrites a whole block, it does not bother to read the old content from disk. It is a good optimization, but if the buffer fill fails due to page fault or something else, the buffer ends up corrupted, neither keeping old content, nor getting the new one. On FreeBSD this is additionally complicated by page faults being blocked by VFS layer, always returning EFAULT on attempt to write from mmap()'ed but not yet cached address range. Normally it is not a big problem, since after original failure VFS will retry the write after reading the required data. The problem becomes worse in specific case when somebody tries to write into a file its own mmap()'ed content from the same location. In that situation the only copy of the data is getting corrupted on the page fault and the following retries only fixate the status quo. Block cloning makes this issue easier to reproduce, since it does not read the old data, unlike traditional file copy, that may work by chance. This patch provides the fill status to dmu_buf_fill_done(), that in case of error can destroy the corrupted buffer as if no write happened. One more complication in case of block cloning is that if error is possible during fill, dmu_buf_will_fill() must read the data via fall-back to dmu_buf_will_dirty(). It is required to allow in case of error restoring the buffer to a state after the cloning, not not before it, that would happen if we just call dbuf_undirty(). Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Rob Norris <robn@despairlabs.com> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #15665 |
||
---|---|---|
.. | ||
ia32 | ||
acl.h | ||
atomic.h | ||
byteorder.h | ||
callb.h | ||
callo.h | ||
cmn_err.h | ||
condvar.h | ||
cred.h | ||
ctype.h | ||
debug.h | ||
disp.h | ||
dkio.h | ||
errno.h | ||
fcntl.h | ||
file.h | ||
inttypes.h | ||
isa_defs.h | ||
kmem_cache.h | ||
kmem.h | ||
kstat.h | ||
list.h | ||
misc.h | ||
mod_os.h | ||
mutex.h | ||
param.h | ||
proc.h | ||
processor.h | ||
procfs_list.h | ||
random.h | ||
rwlock.h | ||
shrinker.h | ||
sid.h | ||
signal.h | ||
simd.h | ||
stat.h | ||
string.h | ||
sunddi.h | ||
sysmacros.h | ||
systeminfo.h | ||
taskq.h | ||
thread.h | ||
time.h | ||
timer.h | ||
trace_spl.h | ||
trace_taskq.h | ||
trace.h | ||
tsd.h | ||
types32.h | ||
types.h | ||
uio.h | ||
user.h | ||
vfs.h | ||
vmem.h | ||
vmsystm.h | ||
vnode.h | ||
wait.h | ||
wmsum.h | ||
zmod.h | ||
zone.h |