svn commit: r323913 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/lib/libzfs_core/common vendor/illumos/dist/man/man1m

Andriy Gapon avg at FreeBSD.org
Fri Sep 22 08:18:07 UTC 2017


Author: avg
Date: Fri Sep 22 08:18:05 2017
New Revision: 323913
URL: https://svnweb.freebsd.org/changeset/base/323913

Log:
  8600 ZFS channel programs - snapshot
  
  illumos/illumos-gate at 2840dce1a029098fb784afd951d5f98089f850d8
  https://github.com/illumos/illumos-gate/commit/2840dce1a029098fb784afd951d5f98089f850d8
  
  https://www.illumos.org/issues/8600
    ZFS channel programs should be able to create snapshots.
    In addition to the base snapshot functionality, this will likely entail adding
    extra logic to handle edge cases which were formerly not possible, such as
    creating then destroying a snapshot in the same transaction sync.
  
  Reviewed by: Matthew Ahrens <mahrens at delphix.com>
  Reviewed by: John Kennedy <john.kennedy at delphix.com>
  Reviewed by: Brad Lewis <brad.lewis at delphix.com>
  Approved by: Robert Mustacchi <rm at joyent.com>
  Author: Chris Williamson <chris.williamson at delphix.com>

Modified:
  vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c
  vendor/illumos/dist/man/man1m/zfs-program.1m

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zcp.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/zcp.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_global.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zcp_synctask.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c

Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c
==============================================================================
--- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c	Fri Sep 22 08:15:35 2017	(r323912)
+++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c	Fri Sep 22 08:18:05 2017	(r323913)
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  * Copyright 2017 RackTop Systems.
@@ -142,7 +142,12 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name,
 
 	if (resultp != NULL) {
 		*resultp = NULL;
-		zc.zc_nvlist_dst_size = MAX(size * 2, 128 * 1024);
+		if (ioc == ZFS_IOC_CHANNEL_PROGRAM) {
+			zc.zc_nvlist_dst_size = fnvlist_lookup_uint64(source,
+			    ZCP_ARG_MEMLIMIT);
+		} else {
+			zc.zc_nvlist_dst_size = MAX(size * 2, 128 * 1024);
+		}
 		zc.zc_nvlist_dst = (uint64_t)(uintptr_t)
 		    malloc(zc.zc_nvlist_dst_size);
 		if (zc.zc_nvlist_dst == NULL) {
@@ -156,7 +161,7 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name,
 		 * If ioctl exited with ENOMEM, we retry the ioctl after
 		 * increasing the size of the destination nvlist.
 		 *
-		 * Channel programs that exit with ENOMEM probably ran over the
+		 * Channel programs that exit with ENOMEM ran over the
 		 * lua memory sandbox; they should not be retried.
 		 */
 		if (errno == ENOMEM && resultp != NULL &&

Modified: vendor/illumos/dist/man/man1m/zfs-program.1m
==============================================================================
--- vendor/illumos/dist/man/man1m/zfs-program.1m	Fri Sep 22 08:15:35 2017	(r323912)
+++ vendor/illumos/dist/man/man1m/zfs-program.1m	Fri Sep 22 08:18:05 2017	(r323913)
@@ -372,6 +372,18 @@ filesystem (string)
 .Bd -ragged -compact -offset "xxxx"
 Filesystem to rollback.
 .Ed
+.It Em zfs.sync.snapshot(dataset)
+Create a snapshot of a filesystem.
+Returns 0 if the snapshot was successfully created,
+and a nonzero error code otherwise.
+.Pp
+Note: Taking a snapshot will fail on any pool older than legacy version 27.
+To enable taking snapshots from ZCP scripts, the pool must be upgraded.
+.Pp
+dataset (string)
+.Bd -ragged -compact -offset "xxxx"
+Name of snapshot to create.
+.Ed
 .El
 .It Sy zfs.check submodule
 For each function in the zfs.sync submodule, there is a corresponding zfs.check
@@ -392,6 +404,7 @@ The available zfs.check functions are:
 .It Em zfs.check.destroy(dataset, [defer=true|false])
 .It Em zfs.check.promote(dataset)
 .It Em zfs.check.rollback(filesystem)
+.It Em zfs.check.snapshot(dataset)
 .El
 .It Sy zfs.list submodule
 The zfs.list submodule provides functions for iterating over datasets and


More information about the svn-src-all mailing list