Bug #3699
closedzfs hold or release of a non-existent snapshot does not output error
100%
Description
If placing a hold or releasing a hold of a non-existent snapshot of a existent dataset, there is no error output and a zero return code.
Steps to reproduce:
zfs create tank/test zfs hold tank/test@s1 zfs release tank/test@s1
Prior to changeset 13973:4972ab336f54 (3464 zfs synctask code needs restructuring) the following error was returned:
cannot hold 'tank/test@s1': dataset does not exist
This case should be treated as an error. As to my investigation non-existing snapshots of existing datasets are skipped already in libzfs (there is no ioctl call).
Files
Updated by Martin Matuška over 10 years ago
The correct reproduction code:
zfs create tank/test zfs hold test tank/test@s1 zfs release test tank/test@s1
Updated by sham pavman over 10 years ago
i'm currently on 151a7 and everything checks out fine.
zfs hold samplehold testpool/a@s1 cannot hold 'testpool/a@s1' : dataset does not exist
can you please let us know what version your running on?
Updated by Martin Matuška over 10 years ago
You need to run the development version that is not downloadable :)
I am referring to latest changes in the code here that have not yet been released, but we have already tested them at FreeBSD.
Updated by Martin Matuška over 10 years ago
- File libzfs_dataset.c.patch libzfs_dataset.c.patch added
Attaching a patch that is a possible solution to fix this issue.
In libzfs_dataset.c the functions zfs_hold() and zfs_release() do not check after calling zfs_hold_one() or zfs_release_one() if the ha.nvl nvlist was populated. If it is empty, the ioctl call should be omitted and a error message printed as no matching snapshots have been found.
Updated by Martin Matuška over 10 years ago
- File 3699.patch 3699.patch added
I have been informed by Steven Hartland <smh@FreeBSD.org> that enoent_ok needs to be respected in this case, too.
Attaching updated patch.
Updated by Rich Lowe over 10 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
- Tags deleted (
needs-triage)
Resolved in 013023d