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, 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 |
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 |
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, |
1071 atp + 1, tx, B_FALSE); |
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 |
1337 error = dsl_dataset_snapshot_check_impl(ds, ddsta->ddsta_snapname, 1338 tx, B_FALSE); |
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 --- |