summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Williamson <[email protected]>2018-02-08 09:24:39 -0700
committerBrian Behlendorf <[email protected]>2018-02-08 15:29:24 -0800
commit234c91c50848fa74bd72efff4e555331a25d9fe1 (patch)
treee93accbb8799995afbc2d3d3714577b1f925471c /lib
parentaf0736898669eabe31e47405023c80b9a58e5e6c (diff)
OpenZFS 8600 - ZFS channel programs - snapshot
Authored by: Chris Williamson <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: John Kennedy <[email protected]> Reviewed by: Brad Lewis <[email protected]> Approved by: Robert Mustacchi <[email protected]> Ported-by: Don Brady <[email protected]> ZFS channel programs should be able to create snapshots. In addition to the base snapshot functionality, this entails extra logic to handle edge cases which were formerly not possible, such as creating then destroying a snapshot in the same transaction sync. OpenZFS-issue: https://www.illumos.org/issues/8600 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/68089b8b
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs_core/libzfs_core.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/libzfs_core/libzfs_core.c b/lib/libzfs_core/libzfs_core.c
index 2fa035e67..ca0b3cfb5 100644
--- a/lib/libzfs_core/libzfs_core.c
+++ b/lib/libzfs_core/libzfs_core.c
@@ -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) 2017 Datto Inc.
* Copyright 2017 RackTop Systems.
@@ -146,7 +146,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 == (uint64_t)0) {
@@ -160,7 +165,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 &&