Hi Roger,
On Sat, Jan 04, 2020 at 12:54:56PM +0000, Roger Leigh wrote:
When you clone a source snapshot, we want to make that snapshot the
default
state for the original dataset when you end the session. The "file" chroot
type is the most comparable here; the LVM and Btrfs snapshots operate
directly on the original copy. Right now the ZFS source chroot clone looks
as ephemeral as a regular cloned session, so I'm not sure the current
behaviour is corect. We want the saving of the updated source chroot to be
done such that it appears atomic for any concurrent usage to clone the old
state or the new state, and never an intermediate state as the original is
updated. It's this part that I wasn't sure about. I don't see an
equivalent to "zfs promote" which would allow copying back a clone (or
snapshot of a clone) to the source dataset, and I don't see any
source-chroot-specific logic in 05zfs which would preserve any source chroot
changes.
Ok, you're right that I haven't done anything wrt 'zfs promote'. Prior to
switching to zfs, all of my schroot work used the lvm-snapshot type, which
has the same limitation you describe here: session clones taken while the
source chroot is in the process of being updated end up cloning some
intermediate state. I have never had a problem with this limitation in
practice, since my usage of schroot is entirely human-driven, so it's very
easy for me to avoid launching new schroots while in the middle of a
"maintenance window".
Being able to update the source atomically certainly seems like a nice
enhancement, but given that the implementation is currently at parity with
the lvm-snapshot type, I am not likely to invest effort in this myself at
this time.