Author: mm
Date: Thu Apr 25 06:55:57 2013
New Revision: 249883
URL: http://svnweb.freebsd.org/changeset/base/249883

Log:
  Respect the enoent_ok flag if reporting error for holding an non-existing
  snapshot.
  
  Related illumos ZFS issue:
    3699 zfs hold or release of a non-existent snapshot does not output error
  
  Reported by:  Steven Hartland <s...@freebsd.org>
  MFC after:    3 days

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c    Thu Apr 
25 06:29:23 2013        (r249882)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c    Thu Apr 
25 06:55:57 2013        (r249883)
@@ -4207,10 +4207,13 @@ zfs_hold(zfs_handle_t *zhp, const char *
        if (nvlist_next_nvpair(ha.nvl, NULL) == NULL) {
                fnvlist_free(ha.nvl);
                ret = ENOENT;
-               (void) snprintf(errbuf, sizeof (errbuf),
-                   dgettext(TEXT_DOMAIN, "cannot hold snapshot '%s@%s'"),
-                   zhp->zfs_name, snapname);
-               (void) zfs_standard_error(hdl, ret, errbuf);
+               if (!enoent_ok) {
+                       (void) snprintf(errbuf, sizeof (errbuf),
+                           dgettext(TEXT_DOMAIN,
+                           "cannot hold snapshot '%s@%s'"),
+                           zhp->zfs_name, snapname);
+                       (void) zfs_standard_error(hdl, ret, errbuf);
+               }
                return (ret);
        }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to