zfs hold with empty tag prints the wrong error message
The hold ioctl handler returns EINVAL in one of two
- the hold tag is empty (new)
- user wanted to put a hold on something that's not a snapshot (existing)
Sadly, the ioctl return value makes its way to libzfs (zfs_hold_nvl), which does what libzfs does - prints an error message.
It of course assumes that we got an EINVAL because of case #2 and so the user sees:
"operation not applicable to datasets of this type"
My best idea is to add a empty-tag check to libzfs.
A way to test:
$ zfs hold '' storage/upstream@9e835c7628dd0e7764a8341a1774a878dc0b024f cannot hold: operation not applicable to datasets of this type
Updated by Josef Sipek over 5 years ago
Cool to see someone pick this up.
Beware, in order to see the EINVAL, you'll have to apply the patch from:
I filed the RTI, but the advocates requested more testing (zfstests) - which got delayed.