7247 zfs receive of deduplicated stream fails
This resolves two 'zfs recv' issues. First, when receiving into an existing filesystem, a snapshot created during the receive process is not added to the guid->dataset map for the stream, resulting in failed lookups for deduped streams when a WRITE_BYREF record refers to a snapshot received earlier in the stream. Second, the newly created snapshot was also not set properly, referencing the snapshot before the new receiving dataset rather than the existing filesystem. Closes #159 Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Dan Kimmel <dan.kimmel@delphix.com> Author: Chris Williamson <chris.williamson@delphix.com> openzfs/openzfs@b09697c8c1
This commit is contained in:
parent
7b84e6dc6f
commit
6ee1596f02
@ -3047,6 +3047,9 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *tx)
|
|||||||
dsl_dataset_phys(origin_head)->ds_flags &=
|
dsl_dataset_phys(origin_head)->ds_flags &=
|
||||||
~DS_FLAG_INCONSISTENT;
|
~DS_FLAG_INCONSISTENT;
|
||||||
|
|
||||||
|
drc->drc_newsnapobj =
|
||||||
|
dsl_dataset_phys(origin_head)->ds_prev_snap_obj;
|
||||||
|
|
||||||
dsl_dataset_rele(origin_head, FTAG);
|
dsl_dataset_rele(origin_head, FTAG);
|
||||||
dsl_destroy_head_sync_impl(drc->drc_ds, tx);
|
dsl_destroy_head_sync_impl(drc->drc_ds, tx);
|
||||||
|
|
||||||
@ -3082,8 +3085,9 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *tx)
|
|||||||
(void) zap_remove(dp->dp_meta_objset, ds->ds_object,
|
(void) zap_remove(dp->dp_meta_objset, ds->ds_object,
|
||||||
DS_FIELD_RESUME_TONAME, tx);
|
DS_FIELD_RESUME_TONAME, tx);
|
||||||
}
|
}
|
||||||
|
drc->drc_newsnapobj =
|
||||||
|
dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj;
|
||||||
}
|
}
|
||||||
drc->drc_newsnapobj = dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj;
|
|
||||||
/*
|
/*
|
||||||
* Release the hold from dmu_recv_begin. This must be done before
|
* Release the hold from dmu_recv_begin. This must be done before
|
||||||
* we return to open context, so that when we free the dataset's dnode,
|
* we return to open context, so that when we free the dataset's dnode,
|
||||||
@ -3126,8 +3130,6 @@ static int dmu_recv_end_modified_blocks = 3;
|
|||||||
static int
|
static int
|
||||||
dmu_recv_existing_end(dmu_recv_cookie_t *drc)
|
dmu_recv_existing_end(dmu_recv_cookie_t *drc)
|
||||||
{
|
{
|
||||||
int error;
|
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
/*
|
/*
|
||||||
* We will be destroying the ds; make sure its origin is unmounted if
|
* We will be destroying the ds; make sure its origin is unmounted if
|
||||||
@ -3138,23 +3140,30 @@ dmu_recv_existing_end(dmu_recv_cookie_t *drc)
|
|||||||
zfs_destroy_unmount_origin(name);
|
zfs_destroy_unmount_origin(name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
error = dsl_sync_task(drc->drc_tofs,
|
return (dsl_sync_task(drc->drc_tofs,
|
||||||
dmu_recv_end_check, dmu_recv_end_sync, drc,
|
dmu_recv_end_check, dmu_recv_end_sync, drc,
|
||||||
dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL);
|
dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL));
|
||||||
|
|
||||||
if (error != 0)
|
|
||||||
dmu_recv_cleanup_ds(drc);
|
|
||||||
return (error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dmu_recv_new_end(dmu_recv_cookie_t *drc)
|
dmu_recv_new_end(dmu_recv_cookie_t *drc)
|
||||||
|
{
|
||||||
|
return (dsl_sync_task(drc->drc_tofs,
|
||||||
|
dmu_recv_end_check, dmu_recv_end_sync, drc,
|
||||||
|
dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL));
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
dmu_recv_end(dmu_recv_cookie_t *drc, void *owner)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = dsl_sync_task(drc->drc_tofs,
|
drc->drc_owner = owner;
|
||||||
dmu_recv_end_check, dmu_recv_end_sync, drc,
|
|
||||||
dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL);
|
if (drc->drc_newfs)
|
||||||
|
error = dmu_recv_new_end(drc);
|
||||||
|
else
|
||||||
|
error = dmu_recv_existing_end(drc);
|
||||||
|
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
dmu_recv_cleanup_ds(drc);
|
dmu_recv_cleanup_ds(drc);
|
||||||
@ -3166,17 +3175,6 @@ dmu_recv_new_end(dmu_recv_cookie_t *drc)
|
|||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
dmu_recv_end(dmu_recv_cookie_t *drc, void *owner)
|
|
||||||
{
|
|
||||||
drc->drc_owner = owner;
|
|
||||||
|
|
||||||
if (drc->drc_newfs)
|
|
||||||
return (dmu_recv_new_end(drc));
|
|
||||||
else
|
|
||||||
return (dmu_recv_existing_end(drc));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return TRUE if this objset is currently being received into.
|
* Return TRUE if this objset is currently being received into.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user