Deleted Added
full compact
dmu_send.c (302408) dmu_send.c (307108)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 1333 unchanged lines hidden (view full) ---

1342 dsl_dataset_rele(ds, FTAG);
1343 return (SET_ERROR(EINVAL));
1344 }
1345
1346 error = recv_begin_check_existing_impl(drba, ds, fromguid);
1347 dsl_dataset_rele(ds, FTAG);
1348 } else if (error == ENOENT) {
1349 /* target fs does not exist; must be a full backup or clone */
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 1333 unchanged lines hidden (view full) ---

1342 dsl_dataset_rele(ds, FTAG);
1343 return (SET_ERROR(EINVAL));
1344 }
1345
1346 error = recv_begin_check_existing_impl(drba, ds, fromguid);
1347 dsl_dataset_rele(ds, FTAG);
1348 } else if (error == ENOENT) {
1349 /* target fs does not exist; must be a full backup or clone */
1350 char buf[MAXNAMELEN];
1350 char buf[ZFS_MAX_DATASET_NAME_LEN];
1351
1352 /*
1353 * If it's a non-clone incremental, we are missing the
1354 * target fs, so fail the recv.
1355 */
1356 if (fromguid != 0 && !(flags & DRR_FLAG_CLONE ||
1357 drba->drba_origin))
1358 return (SET_ERROR(ENOENT));
1359
1360 /*
1361 * If we're receiving a full send as a clone, and it doesn't
1362 * contain all the necessary free records and freeobject
1363 * records, reject it.
1364 */
1365 if (fromguid == 0 && drba->drba_origin &&
1366 !(flags & DRR_FLAG_FREERECORDS))
1367 return (SET_ERROR(EINVAL));
1368
1369 /* Open the parent of tofs */
1351
1352 /*
1353 * If it's a non-clone incremental, we are missing the
1354 * target fs, so fail the recv.
1355 */
1356 if (fromguid != 0 && !(flags & DRR_FLAG_CLONE ||
1357 drba->drba_origin))
1358 return (SET_ERROR(ENOENT));
1359
1360 /*
1361 * If we're receiving a full send as a clone, and it doesn't
1362 * contain all the necessary free records and freeobject
1363 * records, reject it.
1364 */
1365 if (fromguid == 0 && drba->drba_origin &&
1366 !(flags & DRR_FLAG_FREERECORDS))
1367 return (SET_ERROR(EINVAL));
1368
1369 /* Open the parent of tofs */
1370 ASSERT3U(strlen(tofs), <, MAXNAMELEN);
1370 ASSERT3U(strlen(tofs), <, sizeof (buf));
1371 (void) strlcpy(buf, tofs, strrchr(tofs, '/') - tofs + 1);
1372 error = dsl_dataset_hold(dp, buf, FTAG, &ds);
1373 if (error != 0)
1374 return (error);
1375
1376 /*
1377 * Check filesystem and snapshot limits before receiving. We'll
1378 * recheck snapshot limits again at the end (we create the

--- 167 unchanged lines hidden (view full) ---

1546 */
1547 if ((featureflags & DMU_BACKUP_FEATURE_EMBED_DATA) &&
1548 !spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_EMBEDDED_DATA))
1549 return (SET_ERROR(ENOTSUP));
1550 if ((featureflags & DMU_BACKUP_FEATURE_EMBED_DATA_LZ4) &&
1551 !spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_LZ4_COMPRESS))
1552 return (SET_ERROR(ENOTSUP));
1553
1371 (void) strlcpy(buf, tofs, strrchr(tofs, '/') - tofs + 1);
1372 error = dsl_dataset_hold(dp, buf, FTAG, &ds);
1373 if (error != 0)
1374 return (error);
1375
1376 /*
1377 * Check filesystem and snapshot limits before receiving. We'll
1378 * recheck snapshot limits again at the end (we create the

--- 167 unchanged lines hidden (view full) ---

1546 */
1547 if ((featureflags & DMU_BACKUP_FEATURE_EMBED_DATA) &&
1548 !spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_EMBEDDED_DATA))
1549 return (SET_ERROR(ENOTSUP));
1550 if ((featureflags & DMU_BACKUP_FEATURE_EMBED_DATA_LZ4) &&
1551 !spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_LZ4_COMPRESS))
1552 return (SET_ERROR(ENOTSUP));
1553
1554 char recvname[ZFS_MAXNAMELEN];
1554 /* 6 extra bytes for /%recv */
1555 char recvname[ZFS_MAX_DATASET_NAME_LEN + 6];
1555
1556 (void) snprintf(recvname, sizeof (recvname), "%s/%s",
1557 tofs, recv_clone_name);
1558
1559 if (dsl_dataset_hold(dp, recvname, FTAG, &ds) != 0) {
1560 /* %recv does not exist; continue in tofs */
1561 error = dsl_dataset_hold(dp, tofs, FTAG, &ds);
1562 if (error != 0)

--- 56 unchanged lines hidden (view full) ---

1619static void
1620dmu_recv_resume_begin_sync(void *arg, dmu_tx_t *tx)
1621{
1622 dmu_recv_begin_arg_t *drba = arg;
1623 dsl_pool_t *dp = dmu_tx_pool(tx);
1624 const char *tofs = drba->drba_cookie->drc_tofs;
1625 dsl_dataset_t *ds;
1626 uint64_t dsobj;
1556
1557 (void) snprintf(recvname, sizeof (recvname), "%s/%s",
1558 tofs, recv_clone_name);
1559
1560 if (dsl_dataset_hold(dp, recvname, FTAG, &ds) != 0) {
1561 /* %recv does not exist; continue in tofs */
1562 error = dsl_dataset_hold(dp, tofs, FTAG, &ds);
1563 if (error != 0)

--- 56 unchanged lines hidden (view full) ---

1620static void
1621dmu_recv_resume_begin_sync(void *arg, dmu_tx_t *tx)
1622{
1623 dmu_recv_begin_arg_t *drba = arg;
1624 dsl_pool_t *dp = dmu_tx_pool(tx);
1625 const char *tofs = drba->drba_cookie->drc_tofs;
1626 dsl_dataset_t *ds;
1627 uint64_t dsobj;
1627 char recvname[ZFS_MAXNAMELEN];
1628 /* 6 extra bytes for /%recv */
1629 char recvname[ZFS_MAX_DATASET_NAME_LEN + 6];
1628
1629 (void) snprintf(recvname, sizeof (recvname), "%s/%s",
1630 tofs, recv_clone_name);
1631
1632 if (dsl_dataset_hold(dp, recvname, FTAG, &ds) != 0) {
1633 /* %recv does not exist; continue in tofs */
1634 VERIFY0(dsl_dataset_hold(dp, tofs, FTAG, &ds));
1635 drba->drba_cookie->drc_newfs = B_TRUE;

--- 723 unchanged lines hidden (view full) ---

2359static void
2360dmu_recv_cleanup_ds(dmu_recv_cookie_t *drc)
2361{
2362 if (drc->drc_resumable) {
2363 /* wait for our resume state to be written to disk */
2364 txg_wait_synced(drc->drc_ds->ds_dir->dd_pool, 0);
2365 dsl_dataset_disown(drc->drc_ds, dmu_recv_tag);
2366 } else {
1630
1631 (void) snprintf(recvname, sizeof (recvname), "%s/%s",
1632 tofs, recv_clone_name);
1633
1634 if (dsl_dataset_hold(dp, recvname, FTAG, &ds) != 0) {
1635 /* %recv does not exist; continue in tofs */
1636 VERIFY0(dsl_dataset_hold(dp, tofs, FTAG, &ds));
1637 drba->drba_cookie->drc_newfs = B_TRUE;

--- 723 unchanged lines hidden (view full) ---

2361static void
2362dmu_recv_cleanup_ds(dmu_recv_cookie_t *drc)
2363{
2364 if (drc->drc_resumable) {
2365 /* wait for our resume state to be written to disk */
2366 txg_wait_synced(drc->drc_ds->ds_dir->dd_pool, 0);
2367 dsl_dataset_disown(drc->drc_ds, dmu_recv_tag);
2368 } else {
2367 char name[MAXNAMELEN];
2369 char name[ZFS_MAX_DATASET_NAME_LEN];
2368 dsl_dataset_name(drc->drc_ds, name);
2369 dsl_dataset_disown(drc->drc_ds, dmu_recv_tag);
2370 (void) dsl_destroy_head(name);
2371 }
2372}
2373
2374static void
2375receive_cksum(struct receive_arg *ra, int len, void *buf)

--- 802 unchanged lines hidden (view full) ---

3178}
3179
3180static int dmu_recv_end_modified_blocks = 3;
3181
3182static int
3183dmu_recv_existing_end(dmu_recv_cookie_t *drc)
3184{
3185 int error;
2370 dsl_dataset_name(drc->drc_ds, name);
2371 dsl_dataset_disown(drc->drc_ds, dmu_recv_tag);
2372 (void) dsl_destroy_head(name);
2373 }
2374}
2375
2376static void
2377receive_cksum(struct receive_arg *ra, int len, void *buf)

--- 802 unchanged lines hidden (view full) ---

3180}
3181
3182static int dmu_recv_end_modified_blocks = 3;
3183
3184static int
3185dmu_recv_existing_end(dmu_recv_cookie_t *drc)
3186{
3187 int error;
3186 char name[MAXNAMELEN];
3187
3188#ifdef _KERNEL
3189 /*
3190 * We will be destroying the ds; make sure its origin is unmounted if
3191 * necessary.
3192 */
3188
3189#ifdef _KERNEL
3190 /*
3191 * We will be destroying the ds; make sure its origin is unmounted if
3192 * necessary.
3193 */
3194 char name[ZFS_MAX_DATASET_NAME_LEN];
3193 dsl_dataset_name(drc->drc_ds, name);
3194 zfs_destroy_unmount_origin(name);
3195#endif
3196
3197 error = dsl_sync_task(drc->drc_tofs,
3198 dmu_recv_end_check, dmu_recv_end_sync, drc,
3199 dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL);
3200

--- 44 unchanged lines hidden ---
3195 dsl_dataset_name(drc->drc_ds, name);
3196 zfs_destroy_unmount_origin(name);
3197#endif
3198
3199 error = dsl_sync_task(drc->drc_tofs,
3200 dmu_recv_end_check, dmu_recv_end_sync, drc,
3201 dmu_recv_end_modified_blocks, ZFS_SPACE_CHECK_NORMAL);
3202

--- 44 unchanged lines hidden ---