Project

General

Profile

Bug #8520

lzc_rollback_to should support rolling back to origin

Added by Andriy Gapon about 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
zfs - Zettabyte File System
Start date:
2017-07-21
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

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.


Related issues

Related to illumos gate - Bug #7198: libzfs should gracefully handle EINVAL from lzc_rollbackClosed2016-07-20

Actions

History

#1

Updated by Andriy Gapon about 2 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...

#2

Updated by Andriy Gapon about 2 years ago

  • Related to Bug #7198: libzfs should gracefully handle EINVAL from lzc_rollback added
#3

Updated by Electric Monk over 1 year ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 95643f75d23914a3e332adc9661ed51749e9858d

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 <mahrens@delphix.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF