Bug #6221
zfs_ioc_snapshot_list_next/zfs_ioc_dataset_list_next return ESRCH instead of ENOENT
0%
Description
zfs_ioc_snapshot_list_next()
and zfs_ioc_dataset_list_next()
convert ENOENT
returned from dmu_objset_hold(zc->zc_name)
to ESRCH
.
The latter is the same error that is returned when there is no next entry.
So, if zfs_ioc_snapshot_list_next()
or zfs_ioc_dataset_list_next()
is called on a missing dataset, then the return code would give an impression that the dataset exists but has not snapshots or children respectively.
I think that both should just return ENOENT
in that case.
One possible concern is an effect of the suggested change on the interaction with concurrent destruction of the dataset.
Currently we would iterate over as much entries as possible and then get ESRCH
meaning that the iteration is finished.
After the change we would get ENOENT
in the middle of the iteration signalling that the dataset has disappeared.
That may not be bad, but possibly could confuse existing consumers.
Updated by Andriy Gapon over 5 years ago
Also, very similarly to the original issue, an obviously illegal attempt to iterate children or snapshots of a snapshot results in ESRCH
implying an empty list rather than an error.