svn commit: r249883 - head/cddl/contrib/opensolaris/lib/libzfs/common

Martin Matuska mm at FreeBSD.org
Thu Apr 25 06:55:58 UTC 2013


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 <smh at 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);
 	}
 


More information about the svn-src-all mailing list