lzc_rollback_to should support rolling back to origin
lzc_rollback_to() should support rolling back to a clone's origin.
The current checks in zfs_ioc_rollback() would not allow that because the origin snapshot belongs to a different filesystem.
The overly restrictive check was in introduced in 7600, but it was not a regression as none of the existing tools provided a way to rollback to the origin.
Updated by Andriy Gapon almost 5 years ago
Pull request for the change https://github.com/openzfs/openzfs/pull/434
The idea is to remove the overly restrictive checks based on the string comparison and to do the checks based on relations between the datasets.
While there I am also changing some return codes to make them less confusing and hopefully more consistent.
Now ESRCH is used to signal that the target snapshot is not found in the ancestry of the dataset.
That could be for a number of reasons such as: the snapshot does not exist (including the case when the dataset does not have any snapshots at all), the snapshot belongs to a different dataset (including the case of a different pool), etc.
EEXIST signals that there is at least one snapshot more recent than the target snapshot.
EINVAL is reserved for reporting invalid names.
libzfs is also updated to handle the new error codes including the situation that it didn't handle before.
See related issue 7198.
While libzfs checks for the error conditions even before trying the rollback, they can still occur because of an intervening DSL operation (such as creation or destruction of a snapshot).
I am not sure if I got the error messages for new conditions right...
Updated by Electric Monk over 4 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
commit 95643f75d23914a3e332adc9661ed51749e9858d Author: Andriy Gapon <avg@FreeBSD.org> Date: 2018-02-08T05:16:38.000Z 8520 lzc_rollback_to should support rolling back to origin 7198 libzfs should gracefully handle EINVAL from lzc_rollback Reviewed by: Matthew Ahrens <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>