mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
Fix handling of maxblkid for raw sends
Currently, the receive code can create an unreadable dataset from a correct raw send stream. This is because it is currently impossible to set maxblkid to a lower value without freeing the associated object. This means truncating files on the send side to a non-0 size could result in corruption. This patch solves this issue by adding a new 'force' flag to dnode_new_blkid() which will allow the raw receive code to force the DMU to accept the provided maxblkid even if it is a lower value than the existing one. For testing purposes the send_encrypted_files.ksh test has been extended to include a variety of truncated files and multiple snapshots. It also now leverages the xattrtest command to help ensure raw receives correctly handle xattrs. Reviewed-by: Paul Dagnelie <pcd@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Matt Ahrens <mahrens@delphix.com> Signed-off-by: Tom Caputi <tcaputi@datto.com> Closes #8168 Closes #8487
This commit is contained in:
committed by
Brian Behlendorf
parent
146bdc414c
commit
369aa501d1
@@ -384,12 +384,7 @@ dnode_sync_free_range_impl(dnode_t *dn, uint64_t blkid, uint64_t nblks,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Do not truncate the maxblkid if we are performing a raw
|
||||
* receive. The raw receive sets the mablkid manually and
|
||||
* must not be overriden.
|
||||
*/
|
||||
if (trunc && !dn->dn_objset->os_raw_receive) {
|
||||
if (trunc) {
|
||||
ASSERTV(uint64_t off);
|
||||
dn->dn_phys->dn_maxblkid = blkid == 0 ? 0 : blkid - 1;
|
||||
|
||||
@@ -765,11 +760,13 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx)
|
||||
|
||||
/*
|
||||
* This must be done after dnode_sync_free_range()
|
||||
* and dnode_increase_indirection().
|
||||
* and dnode_increase_indirection(). See dnode_new_blkid()
|
||||
* for an explanation of the high bit being set.
|
||||
*/
|
||||
if (dn->dn_next_maxblkid[txgoff]) {
|
||||
mutex_enter(&dn->dn_mtx);
|
||||
dnp->dn_maxblkid = dn->dn_next_maxblkid[txgoff];
|
||||
dnp->dn_maxblkid =
|
||||
dn->dn_next_maxblkid[txgoff] & ~DMU_NEXT_MAXBLKID_SET;
|
||||
dn->dn_next_maxblkid[txgoff] = 0;
|
||||
mutex_exit(&dn->dn_mtx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user