Deleted Added
full compact
dmu_send.c (263410) dmu_send.c (265754)
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

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

17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 * Copyright (c) 2013 by Delphix. All rights reserved.
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

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

17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 * Copyright (c) 2013 by Delphix. All rights reserved.
25 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
25 * Copyright (c) 2014, Joyent, Inc. All rights reserved.
26 * Copyright (c) 2012, Martin Matuska <mm@FreeBSD.org>. All rights reserved.
27 */
28
29#include <sys/dmu.h>
30#include <sys/dmu_impl.h>
31#include <sys/dmu_tx.h>
32#include <sys/dbuf.h>
33#include <sys/dnode.h>

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

801
802 /* new snapshot name must not exist */
803 error = zap_lookup(dp->dp_meta_objset,
804 ds->ds_phys->ds_snapnames_zapobj, drba->drba_cookie->drc_tosnap,
805 8, 1, &val);
806 if (error != ENOENT)
807 return (error == 0 ? EEXIST : error);
808
26 * Copyright (c) 2012, Martin Matuska <mm@FreeBSD.org>. All rights reserved.
27 */
28
29#include <sys/dmu.h>
30#include <sys/dmu_impl.h>
31#include <sys/dmu_tx.h>
32#include <sys/dbuf.h>
33#include <sys/dnode.h>

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

801
802 /* new snapshot name must not exist */
803 error = zap_lookup(dp->dp_meta_objset,
804 ds->ds_phys->ds_snapnames_zapobj, drba->drba_cookie->drc_tosnap,
805 8, 1, &val);
806 if (error != ENOENT)
807 return (error == 0 ? EEXIST : error);
808
809 /*
810 * Check snapshot limit before receiving. We'll recheck again at the
811 * end, but might as well abort before receiving if we're already over
812 * the limit.
813 *
814 * Note that we do not check the file system limit with
815 * dsl_dir_fscount_check because the temporary %clones don't count
816 * against that limit.
817 */
818 error = dsl_fs_ss_limit_check(ds->ds_dir, 1, ZFS_PROP_SNAPSHOT_LIMIT,
819 NULL, drba->drba_cred);
820 if (error != 0)
821 return (error);
822
809 if (fromguid != 0) {
810 dsl_dataset_t *snap;
811 uint64_t obj = ds->ds_phys->ds_prev_snap_obj;
812
813 /* Find snapshot in this dir that matches fromguid. */
814 while (obj != 0) {
815 error = dsl_dataset_hold_obj(dp, obj, FTAG,
816 &snap);

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

907
908 /* Open the parent of tofs */
909 ASSERT3U(strlen(tofs), <, MAXNAMELEN);
910 (void) strlcpy(buf, tofs, strrchr(tofs, '/') - tofs + 1);
911 error = dsl_dataset_hold(dp, buf, FTAG, &ds);
912 if (error != 0)
913 return (error);
914
823 if (fromguid != 0) {
824 dsl_dataset_t *snap;
825 uint64_t obj = ds->ds_phys->ds_prev_snap_obj;
826
827 /* Find snapshot in this dir that matches fromguid. */
828 while (obj != 0) {
829 error = dsl_dataset_hold_obj(dp, obj, FTAG,
830 &snap);

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

921
922 /* Open the parent of tofs */
923 ASSERT3U(strlen(tofs), <, MAXNAMELEN);
924 (void) strlcpy(buf, tofs, strrchr(tofs, '/') - tofs + 1);
925 error = dsl_dataset_hold(dp, buf, FTAG, &ds);
926 if (error != 0)
927 return (error);
928
929 /*
930 * Check filesystem and snapshot limits before receiving. We'll
931 * recheck snapshot limits again at the end (we create the
932 * filesystems and increment those counts during begin_sync).
933 */
934 error = dsl_fs_ss_limit_check(ds->ds_dir, 1,
935 ZFS_PROP_FILESYSTEM_LIMIT, NULL, drba->drba_cred);
936 if (error != 0) {
937 dsl_dataset_rele(ds, FTAG);
938 return (error);
939 }
940
941 error = dsl_fs_ss_limit_check(ds->ds_dir, 1,
942 ZFS_PROP_SNAPSHOT_LIMIT, NULL, drba->drba_cred);
943 if (error != 0) {
944 dsl_dataset_rele(ds, FTAG);
945 return (error);
946 }
947
915 if (drba->drba_origin != NULL) {
916 dsl_dataset_t *origin;
917 error = dsl_dataset_hold(dp, drba->drba_origin,
918 FTAG, &origin);
919 if (error != 0) {
920 dsl_dataset_rele(ds, FTAG);
921 return (error);
922 }

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

1016 dmu_recv_begin_arg_t drba = { 0 };
1017 dmu_replay_record_t *drr;
1018
1019 bzero(drc, sizeof (dmu_recv_cookie_t));
1020 drc->drc_drrb = drrb;
1021 drc->drc_tosnap = tosnap;
1022 drc->drc_tofs = tofs;
1023 drc->drc_force = force;
948 if (drba->drba_origin != NULL) {
949 dsl_dataset_t *origin;
950 error = dsl_dataset_hold(dp, drba->drba_origin,
951 FTAG, &origin);
952 if (error != 0) {
953 dsl_dataset_rele(ds, FTAG);
954 return (error);
955 }

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

1049 dmu_recv_begin_arg_t drba = { 0 };
1050 dmu_replay_record_t *drr;
1051
1052 bzero(drc, sizeof (dmu_recv_cookie_t));
1053 drc->drc_drrb = drrb;
1054 drc->drc_tosnap = tosnap;
1055 drc->drc_tofs = tofs;
1056 drc->drc_force = force;
1057 drc->drc_cred = CRED();
1024
1025 if (drrb->drr_magic == BSWAP_64(DMU_BACKUP_MAGIC))
1026 drc->drc_byteswap = B_TRUE;
1027 else if (drrb->drr_magic != DMU_BACKUP_MAGIC)
1028 return (SET_ERROR(EINVAL));
1029
1030 drr = kmem_zalloc(sizeof (dmu_replay_record_t), KM_SLEEP);
1031 drr->drr_type = DRR_BEGIN;

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

1735 }
1736 error = dsl_dataset_clone_swap_check_impl(drc->drc_ds,
1737 origin_head, drc->drc_force, drc->drc_owner, tx);
1738 if (error != 0) {
1739 dsl_dataset_rele(origin_head, FTAG);
1740 return (error);
1741 }
1742 error = dsl_dataset_snapshot_check_impl(origin_head,
1058
1059 if (drrb->drr_magic == BSWAP_64(DMU_BACKUP_MAGIC))
1060 drc->drc_byteswap = B_TRUE;
1061 else if (drrb->drr_magic != DMU_BACKUP_MAGIC)
1062 return (SET_ERROR(EINVAL));
1063
1064 drr = kmem_zalloc(sizeof (dmu_replay_record_t), KM_SLEEP);
1065 drr->drr_type = DRR_BEGIN;

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

1769 }
1770 error = dsl_dataset_clone_swap_check_impl(drc->drc_ds,
1771 origin_head, drc->drc_force, drc->drc_owner, tx);
1772 if (error != 0) {
1773 dsl_dataset_rele(origin_head, FTAG);
1774 return (error);
1775 }
1776 error = dsl_dataset_snapshot_check_impl(origin_head,
1743 drc->drc_tosnap, tx, B_TRUE);
1777 drc->drc_tosnap, tx, B_TRUE, 1, drc->drc_cred);
1744 dsl_dataset_rele(origin_head, FTAG);
1745 if (error != 0)
1746 return (error);
1747
1748 error = dsl_destroy_head_check_impl(drc->drc_ds, 1);
1749 } else {
1750 error = dsl_dataset_snapshot_check_impl(drc->drc_ds,
1778 dsl_dataset_rele(origin_head, FTAG);
1779 if (error != 0)
1780 return (error);
1781
1782 error = dsl_destroy_head_check_impl(drc->drc_ds, 1);
1783 } else {
1784 error = dsl_dataset_snapshot_check_impl(drc->drc_ds,
1751 drc->drc_tosnap, tx, B_TRUE);
1785 drc->drc_tosnap, tx, B_TRUE, 1, drc->drc_cred);
1752 }
1753 return (error);
1754}
1755
1756static void
1757dmu_recv_end_sync(void *arg, dmu_tx_t *tx)
1758{
1759 dmu_recv_cookie_t *drc = arg;

--- 170 unchanged lines hidden ---
1786 }
1787 return (error);
1788}
1789
1790static void
1791dmu_recv_end_sync(void *arg, dmu_tx_t *tx)
1792{
1793 dmu_recv_cookie_t *drc = arg;

--- 170 unchanged lines hidden ---