Deleted Added
full compact
dsl_dataset.c (253816) dsl_dataset.c (253819)
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

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

989typedef struct dsl_dataset_snapshot_arg {
990 nvlist_t *ddsa_snaps;
991 nvlist_t *ddsa_props;
992 nvlist_t *ddsa_errors;
993} dsl_dataset_snapshot_arg_t;
994
995int
996dsl_dataset_snapshot_check_impl(dsl_dataset_t *ds, const char *snapname,
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

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

989typedef struct dsl_dataset_snapshot_arg {
990 nvlist_t *ddsa_snaps;
991 nvlist_t *ddsa_props;
992 nvlist_t *ddsa_errors;
993} dsl_dataset_snapshot_arg_t;
994
995int
996dsl_dataset_snapshot_check_impl(dsl_dataset_t *ds, const char *snapname,
997 dmu_tx_t *tx)
997 dmu_tx_t *tx, boolean_t recv)
998{
999 int error;
1000 uint64_t value;
1001
1002 ds->ds_trysnap_txg = tx->tx_txg;
1003
1004 if (!dmu_tx_is_syncing(tx))
1005 return (0);

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

1015 * Check for conflicting snapshot name.
1016 */
1017 error = dsl_dataset_snap_lookup(ds, snapname, &value);
1018 if (error == 0)
1019 return (SET_ERROR(EEXIST));
1020 if (error != ENOENT)
1021 return (error);
1022
998{
999 int error;
1000 uint64_t value;
1001
1002 ds->ds_trysnap_txg = tx->tx_txg;
1003
1004 if (!dmu_tx_is_syncing(tx))
1005 return (0);

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

1015 * Check for conflicting snapshot name.
1016 */
1017 error = dsl_dataset_snap_lookup(ds, snapname, &value);
1018 if (error == 0)
1019 return (SET_ERROR(EEXIST));
1020 if (error != ENOENT)
1021 return (error);
1022
1023 /*
1024 * We don't allow taking snapshots of inconsistent datasets, such as
1025 * those into which we are currently receiving. However, if we are
1026 * creating this snapshot as part of a receive, this check will be
1027 * executed atomically with respect to the completion of the receive
1028 * itself but prior to the clearing of DS_FLAG_INCONSISTENT; in this
1029 * case we ignore this, knowing it will be fixed up for us shortly in
1030 * dmu_recv_end_sync().
1031 */
1032 if (!recv && DS_IS_INCONSISTENT(ds))
1033 return (SET_ERROR(EBUSY));
1034
1023 error = dsl_dataset_snapshot_reserve_space(ds, tx);
1024 if (error != 0)
1025 return (error);
1026
1027 return (0);
1028}
1029
1030static int

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

1051 error = SET_ERROR(EINVAL);
1052 if (error == 0)
1053 (void) strlcpy(dsname, name, atp - name + 1);
1054 }
1055 if (error == 0)
1056 error = dsl_dataset_hold(dp, dsname, FTAG, &ds);
1057 if (error == 0) {
1058 error = dsl_dataset_snapshot_check_impl(ds,
1035 error = dsl_dataset_snapshot_reserve_space(ds, tx);
1036 if (error != 0)
1037 return (error);
1038
1039 return (0);
1040}
1041
1042static int

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

1063 error = SET_ERROR(EINVAL);
1064 if (error == 0)
1065 (void) strlcpy(dsname, name, atp - name + 1);
1066 }
1067 if (error == 0)
1068 error = dsl_dataset_hold(dp, dsname, FTAG, &ds);
1069 if (error == 0) {
1070 error = dsl_dataset_snapshot_check_impl(ds,
1059 atp + 1, tx);
1071 atp + 1, tx, B_FALSE);
1060 dsl_dataset_rele(ds, FTAG);
1061 }
1062
1063 if (error != 0) {
1064 if (ddsa->ddsa_errors != NULL) {
1065 fnvlist_add_int32(ddsa->ddsa_errors,
1066 name, error);
1067 }

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

1317 dsl_pool_t *dp = dmu_tx_pool(tx);
1318 dsl_dataset_t *ds;
1319 int error;
1320
1321 error = dsl_dataset_hold(dp, ddsta->ddsta_fsname, FTAG, &ds);
1322 if (error != 0)
1323 return (error);
1324
1072 dsl_dataset_rele(ds, FTAG);
1073 }
1074
1075 if (error != 0) {
1076 if (ddsa->ddsa_errors != NULL) {
1077 fnvlist_add_int32(ddsa->ddsa_errors,
1078 name, error);
1079 }

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

1329 dsl_pool_t *dp = dmu_tx_pool(tx);
1330 dsl_dataset_t *ds;
1331 int error;
1332
1333 error = dsl_dataset_hold(dp, ddsta->ddsta_fsname, FTAG, &ds);
1334 if (error != 0)
1335 return (error);
1336
1325 error = dsl_dataset_snapshot_check_impl(ds, ddsta->ddsta_snapname, tx);
1337 error = dsl_dataset_snapshot_check_impl(ds, ddsta->ddsta_snapname,
1338 tx, B_FALSE);
1326 if (error != 0) {
1327 dsl_dataset_rele(ds, FTAG);
1328 return (error);
1329 }
1330
1331 if (spa_version(dp->dp_spa) < SPA_VERSION_USERREFS) {
1332 dsl_dataset_rele(ds, FTAG);
1333 return (SET_ERROR(ENOTSUP));

--- 1727 unchanged lines hidden ---
1339 if (error != 0) {
1340 dsl_dataset_rele(ds, FTAG);
1341 return (error);
1342 }
1343
1344 if (spa_version(dp->dp_spa) < SPA_VERSION_USERREFS) {
1345 dsl_dataset_rele(ds, FTAG);
1346 return (SET_ERROR(ENOTSUP));

--- 1727 unchanged lines hidden ---