Project

General

Profile

Bug #5790

lzc_clone() returns ENOENT for different conditions

Added by Andriy Gapon about 6 years ago. Updated about 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
zfs - Zettabyte File System
Start date:
2015-04-03
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

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.

#1

Updated by Andrew Stormont about 6 years ago

This is really no different to how say, the link syscall works. I think what you want is perhaps to call lzc_hold before calling lzc_clone, and then to call lzc_release when you're done with the snapshot.

#2

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.

Also available in: Atom PDF