lzc_clone() returns ENOENT for different conditions
lzc_clone() returns ENOENT if either an origin snapshot does not exist or a parent for a target dataset does not exist.
It's impossible to distinguish between the situations without making additional dataset checks, but that would not be atomic, of course.
Distinct error codes are desirable. Maybe ENODEV could be used for one of the cases.
Updated by Andriy Gapon about 6 years ago
That's a really good point and a good suggestion.
On the other hand, arranging for lzc_hold() adds extra boilerplate code.
Also, I think that it would be nicer to enrich lzc error reporting than put a burden on a user.
We are not constrained by limitations that existed several decades ago and it seems that the general software design evolution has been towards more specific and detailed error reporting.
This is beyond the scope of this issue, but IMHO it would be if the ZFS kernel code reported zfs_error_t kind of errors to the userland instead of the userland having to re-construct a specific error meaning from errno and a context.