mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-27 04:32:16 +03:00
ZIL: Do not clone blocks from the future
ZIL claim can not handle block pointers cloned from the future, since they are not yet allocated at that point. It may happen either if the block was just written when it was cloned, or if the pool was frozen or somehow else rewound on import. Handle it from two sides: prevent cloning of blocks with physical birth time from not yet synced or frozen TXG, and abort ZIL claim if we still detect such blocks due to rewind or something else. While there, assert that any cloned blocks we claim are really allocated by calling metaslab_check_free(). Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #15617
This commit is contained in:
@@ -2274,6 +2274,21 @@ dmu_read_l0_bps(objset_t *os, uint64_t object, uint64_t offset, uint64_t length,
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the block was allocated in transaction group that is not
|
||||
* yet synced, we could clone it, but we couldn't write this
|
||||
* operation into ZIL, or it may be impossible to replay, since
|
||||
* the block may appear not yet allocated at that point.
|
||||
*/
|
||||
if (BP_PHYSICAL_BIRTH(bp) > spa_freeze_txg(os->os_spa)) {
|
||||
error = SET_ERROR(EINVAL);
|
||||
goto out;
|
||||
}
|
||||
if (BP_PHYSICAL_BIRTH(bp) > spa_last_synced_txg(os->os_spa)) {
|
||||
error = SET_ERROR(EAGAIN);
|
||||
goto out;
|
||||
}
|
||||
|
||||
bps[i] = *bp;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user