Project

General

Profile

Bug #6221

zfs_ioc_snapshot_list_next/zfs_ioc_dataset_list_next return ESRCH instead of ENOENT

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

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

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

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.

History

#1

Updated by Andriy Gapon about 4 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.

Also available in: Atom PDF