Project

General

Profile

Bug #5847

libzfs_diff should check zfs_prop_get() return

Added by Alexander Eremin over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Category:
zfs - Zettabyte File System
Start date:
2015-04-16
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

get_snapshot_names() doesn’t check the return of zfs_prop_get(), and when target dataset or snapshot are not descendant
of source, zfs_open() gets origin which is NULL:

618 while (zhp != NULL) {
619 (void) zfs_prop_get(zhp, ZFS_PROP_ORIGIN,
620 origin, sizeof (origin), &src, NULL, 0, B_FALSE);
621
622 if (strncmp(origin, fromsnap, fsnlen) == 0)
623 break;
624
625 (void) zfs_close(zhp);
626 zhp = zfs_open(hdl, origin, ZFS_TYPE_FILESYSTEM);
627 }

Then this leads to unnecessary validation of empty path and ugly "cannot open" message:

# zfs diff data@predbuild7 data/ips@5
cannot open '': invalid dataset name
Not an earlier snapshot from the same fs: invalid name

History

#1

Updated by Electric Monk over 4 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

git commit 8430278980a48338e04c7dd52b495b7f1551367a

commit  8430278980a48338e04c7dd52b495b7f1551367a
Author: Alexander Eremin <a.eremin@nexenta.com>
Date:   2015-04-24T14:21:44.000Z

    5847 libzfs_diff should check zfs_prop_get() return
    Reviewed by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed by: Albert Lee <trisk@omniti.com>
    Approved by: Dan McDonald <danmcd@omniti.com>

Also available in: Atom PDF