diff options
author | Keith M Wesolowski <[email protected]> | 2013-07-27 10:51:50 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-11-04 11:18:14 -0800 |
commit | 96c2e961938d4018ddb393fa60e004d8a91a58e9 (patch) | |
tree | 6f831e836b96ef81a5daac0ef712df6ac394c492 /lib/libzfs | |
parent | 1a077756e8ba946a55f999fa1cb5f0e7dcb9aa81 (diff) |
Illumos #3894
3894 zfs should not allow snapshot of inconsistent dataset
Reviewed by: Matthew Ahrens <[email protected]>
Approved by: Gordon Ross <[email protected]>
References:
https://www.illumos.org/issues/3894
illumos/illumos-gate@ca48f36f20f6098ceb19d5b084b6b3d4b8eca9fa
Ported-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #1775
Diffstat (limited to 'lib/libzfs')
-rw-r--r-- | lib/libzfs/libzfs_dataset.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index 3bbd653c6..3b5fc4549 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -1872,6 +1872,10 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src, zcmd_free_nvlists(&zc); break; + case ZFS_PROP_INCONSISTENT: + *val = zhp->zfs_dmustats.dds_inconsistent; + break; + default: switch (zfs_prop_get_type(prop)) { case PROP_TYPE_NUMBER: @@ -3514,13 +3518,16 @@ zfs_snapshot_cb(zfs_handle_t *zhp, void *arg) char name[ZFS_MAXNAMELEN]; int rv = 0; - (void) snprintf(name, sizeof (name), - "%s@%s", zfs_get_name(zhp), sd->sd_snapname); + if (zfs_prop_get_int(zhp, ZFS_PROP_INCONSISTENT) == 0) { + (void) snprintf(name, sizeof (name), + "%s@%s", zfs_get_name(zhp), sd->sd_snapname); - fnvlist_add_boolean(sd->sd_nvl, name); + fnvlist_add_boolean(sd->sd_nvl, name); - rv = zfs_iter_filesystems(zhp, zfs_snapshot_cb, sd); + rv = zfs_iter_filesystems(zhp, zfs_snapshot_cb, sd); + } zfs_close(zhp); + return (rv); } |