MFC r284301: MFV r284040: check that datasets are snapshots
This commit is contained in:
parent
77286cbd99
commit
f0758faa12
@ -855,6 +855,10 @@ dmu_send_estimate(dsl_dataset_t *ds, dsl_dataset_t *fromds, uint64_t *sizep)
|
||||
if (!dsl_dataset_is_snapshot(ds))
|
||||
return (SET_ERROR(EINVAL));
|
||||
|
||||
/* fromsnap, if provided, must be a snapshot */
|
||||
if (fromds != NULL && !dsl_dataset_is_snapshot(fromds))
|
||||
return (SET_ERROR(EINVAL));
|
||||
|
||||
/*
|
||||
* fromsnap must be an earlier snapshot from the same fs as tosnap,
|
||||
* or the origin's fs.
|
||||
|
@ -5364,11 +5364,19 @@ zfs_ioc_space_snaps(const char *lastsnap, nvlist_t *innvl, nvlist_t *outnvl)
|
||||
return (error);
|
||||
|
||||
error = dsl_dataset_hold(dp, lastsnap, FTAG, &new);
|
||||
if (error == 0 && !dsl_dataset_is_snapshot(new)) {
|
||||
dsl_dataset_rele(new, FTAG);
|
||||
error = SET_ERROR(EINVAL);
|
||||
}
|
||||
if (error != 0) {
|
||||
dsl_pool_rele(dp, FTAG);
|
||||
return (error);
|
||||
}
|
||||
error = dsl_dataset_hold(dp, firstsnap, FTAG, &old);
|
||||
if (error == 0 && !dsl_dataset_is_snapshot(old)) {
|
||||
dsl_dataset_rele(old, FTAG);
|
||||
error = SET_ERROR(EINVAL);
|
||||
}
|
||||
if (error != 0) {
|
||||
dsl_dataset_rele(new, FTAG);
|
||||
dsl_pool_rele(dp, FTAG);
|
||||
|
Loading…
x
Reference in New Issue
Block a user