Bug #5521
zfs hold with empty tag prints the wrong error message
0%
Description
The hold ioctl handler returns EINVAL in one of two
cases:
- 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.
http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libzfs/common/libzfs_dataset.c#4305
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
Related issues
Updated by Josef Sipek almost 6 years ago
Cool to see someone pick this up.
Beware, in order to see the EINVAL, you'll have to apply the patch from:
http://31bits.net/illumos/cr/5515-dataset-user-hold-doesnt-reject-empty-tags/
I filed the RTI, but the advocates requested more testing (zfstests) - which got delayed.