summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2013-05-23 22:52:21 +0000
committermm <mm@FreeBSD.org>2013-05-23 22:52:21 +0000
commit1d6cf18ca23db79bc10b83e37de4874bca25fd63 (patch)
tree64c2679d2c65b6a04b60fca72c259bb07ac4f680
parent73d9b47b2a7a8df111f99bb69b7879f98cd3b57c (diff)
downloadFreeBSD-src-1d6cf18ca23db79bc10b83e37de4874bca25fd63.zip
FreeBSD-src-1d6cf18ca23db79bc10b83e37de4874bca25fd63.tar.gz
Update vendor/illumos/dist and vendor-sys/illumos/dist
to illumos-gate 14031:e4eb37f33d60 Illumos ZFS issues: 3699 zfs hold or release of a non-existent snapshot does not output error 3739 cannot set zfs quota or reservation on pool version < 22
-rw-r--r--lib/libzfs/common/libzfs_dataset.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/lib/libzfs/common/libzfs_dataset.c b/lib/libzfs/common/libzfs_dataset.c
index 6121a0f..bad24ea 100644
--- a/lib/libzfs/common/libzfs_dataset.c
+++ b/lib/libzfs/common/libzfs_dataset.c
@@ -24,6 +24,7 @@
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2013 Martin Matuska. All rights reserved.
*/
#include <ctype.h>
@@ -4116,6 +4117,20 @@ zfs_hold(zfs_handle_t *zhp, const char *snapname, const char *tag,
ha.tag = tag;
ha.recursive = recursive;
(void) zfs_hold_one(zfs_handle_dup(zhp), &ha);
+
+ if (nvlist_next_nvpair(ha.nvl, NULL) == NULL) {
+ fnvlist_free(ha.nvl);
+ ret = ENOENT;
+ 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);
+ }
+
ret = lzc_hold(ha.nvl, cleanup_fd, &errors);
fnvlist_free(ha.nvl);
@@ -4217,12 +4232,25 @@ zfs_release(zfs_handle_t *zhp, const char *snapname, const char *tag,
nvlist_t *errors;
nvpair_t *elem;
libzfs_handle_t *hdl = zhp->zfs_hdl;
+ char errbuf[1024];
ha.nvl = fnvlist_alloc();
ha.snapname = snapname;
ha.tag = tag;
ha.recursive = recursive;
(void) zfs_release_one(zfs_handle_dup(zhp), &ha);
+
+ if (nvlist_next_nvpair(ha.nvl, NULL) == NULL) {
+ fnvlist_free(ha.nvl);
+ ret = ENOENT;
+ (void) snprintf(errbuf, sizeof (errbuf),
+ dgettext(TEXT_DOMAIN,
+ "cannot release hold from snapshot '%s@%s'"),
+ zhp->zfs_name, snapname);
+ (void) zfs_standard_error(hdl, ret, errbuf);
+ return (ret);
+ }
+
ret = lzc_release(ha.nvl, &errors);
fnvlist_free(ha.nvl);
@@ -4231,8 +4259,6 @@ zfs_release(zfs_handle_t *zhp, const char *snapname, const char *tag,
if (nvlist_next_nvpair(errors, NULL) == NULL) {
/* no hold-specific errors */
- char errbuf[1024];
-
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
"cannot release"));
switch (errno) {
@@ -4249,8 +4275,6 @@ zfs_release(zfs_handle_t *zhp, const char *snapname, const char *tag,
for (elem = nvlist_next_nvpair(errors, NULL);
elem != NULL;
elem = nvlist_next_nvpair(errors, elem)) {
- char errbuf[1024];
-
(void) snprintf(errbuf, sizeof (errbuf),
dgettext(TEXT_DOMAIN,
"cannot release hold from snapshot '%s'"),
OpenPOWER on IntegriCloud