zfs icon indicating copy to clipboard operation
zfs copied to clipboard

allow zfs holds -r command on datasets

Open avg-I opened this issue 3 years ago • 1 comments

Motivation and Context

Sometimes it is useful to list all user holds of all snapshots under certain dataset. For example, when those holds do not allow to destroy the dataset.

Description

The change allows to specify a dataset as an argument for zfs holds -r. In that case, all descendants and snapshots are traversed.

How Has This Been Tested?

Simply executed zfs holds -r on various targets.

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [X] New feature (non-breaking change which adds functionality)
  • [ ] Performance enhancement (non-breaking change which improves efficiency)
  • [ ] Code cleanup (non-breaking change which makes code smaller or more readable)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • [ ] Documentation (a change to man pages or other documentation)

Checklist:

  • [X] My code follows the OpenZFS code style requirements.
  • [X] I have updated the documentation accordingly.
  • [X] I have read the contributing document.
  • [ ] I have added tests to cover my changes.
  • [ ] I have run the ZFS Test Suite with this change applied.
  • [X] All commit messages are properly formatted and contain Signed-off-by.

avg-I avatar Aug 25 '22 13:08 avg-I

Relate to this, I have wondered about being able to use "snapspec" (@from-snap%to-snap) as part of hold/release

Would other find this useful?

allanjude avatar Aug 25 '22 20:08 allanjude

This is very similar to a feature that FreeBSD 12.x had that got lost when FreeBSD switched from illumos to openzfs as their upstream. You can find that change, created by @allanjude here: https://svnweb.freebsd.org/base?view=revision&revision=290015 You may find that patch provides some inspiration or ideas.

I had raised a bug with FreeBSD over that loss, see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260730

okapia avatar Jan 02 '23 13:01 okapia

Something I always intended to do, but never got around to, was making zfs hold and zfs release support snapspec for specifying a range, so you could hold/release a range of snapshots at once, something like:

zfs hold mytag pool/dataset@snap1%snap4 and it would place the mytag hold on those 4 snapshots

allanjude avatar Jan 02 '23 15:01 allanjude