Project

General

Profile

Actions

Bug #3699

closed

zfs hold or release of a non-existent snapshot does not output error

Added by Martin Matuška over 10 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
zfs - Zettabyte File System
Start date:
2013-04-07
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

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

libzfs_dataset.c.patch (1.86 KB) libzfs_dataset.c.patch Martin Matuška, 2013-04-10 11:35 AM
3699.patch (2.35 KB) 3699.patch Martin Matuška, 2013-04-25 06:43 AM
Actions #1

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
Actions #2

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?

Actions #3

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.

Actions #4

Updated by Martin Matuška over 10 years ago

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.

Actions #5

Updated by Martin Matuška over 10 years ago

I have been informed by Steven Hartland <> that enoent_ok needs to be respected in this case, too.
Attaching updated patch.

Actions #6

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

Actions

Also available in: Atom PDF