MFV r284040: check that datasets are snapshots
5946 zfs_ioc_space_snaps must check that firstsnap and lastsnap refer to snapshots 5945 zfs_ioc_send_space must ensure that fromsnap refers to a snapshot Reviewed by: Steven Hartland <killing@multiplay.co.uk> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Approved by: Gordon Ross <gordon.ross@nexenta.com> illumos/illumos-gate@24218bebb4 Note that the upstream commit is modified during MFV: in the upstream the check is done by inspecting ds_is_snapshot field while in FreeBSD we call dsl_dataset_is_snapshot(). This is because illumos/illumos-gate@bc9014e6a8 (r277428 in vendor-sys/illumos) is not MFV-ed yet. MFC after: 10 days
This commit is contained in:
commit
dde4126314
@ -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.
|
||||
|
@ -5362,11 +5362,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…
Reference in New Issue
Block a user