diff options
author | hs24103 <none@none> | 2008-03-07 16:22:19 -0800 |
---|---|---|
committer | hs24103 <none@none> | 2008-03-07 16:22:19 -0800 |
commit | a227b7f4f323ad89c40a86c430a5e891504a8e8b (patch) | |
tree | feffee4e7263ebf790e1aaf86c8d86a209c191fe /usr/src/lib/libzfs/common/libzfs_dataset.c | |
parent | e9958a6c9e7427ed38c0957f2c72bde3068b0f3b (diff) | |
download | illumos-joyent-a227b7f4f323ad89c40a86c430a5e891504a8e8b.tar.gz |
PSARC 2008/168 Support for ZFS property value canmount=noauto
6661070 need canmount=noauto option for datasets to allow mount point to be set, but no mount done
6664570 need support for zfs canmount=noauto property in smf scripts
Diffstat (limited to 'usr/src/lib/libzfs/common/libzfs_dataset.c')
-rw-r--r-- | usr/src/lib/libzfs/common/libzfs_dataset.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/usr/src/lib/libzfs/common/libzfs_dataset.c b/usr/src/lib/libzfs/common/libzfs_dataset.c index d1d058d3e4..a83226182d 100644 --- a/usr/src/lib/libzfs/common/libzfs_dataset.c +++ b/usr/src/lib/libzfs/common/libzfs_dataset.c @@ -1720,6 +1720,7 @@ zfs_prop_set(zfs_handle_t *zhp, const char *propname, const char *propval) libzfs_handle_t *hdl = zhp->zfs_hdl; nvlist_t *nvl = NULL, *realprops; zfs_prop_t prop; + int do_prefix = 1; (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot set property for '%s'"), @@ -1751,8 +1752,13 @@ zfs_prop_set(zfs_handle_t *zhp, const char *propname, const char *propval) goto error; } - if ((ret = changelist_prefix(cl)) != 0) - goto error; + + /* do not unmount dataset if canmount is being set to noauto */ + if (prop == ZFS_PROP_CANMOUNT && *propval == ZFS_CANMOUNT_NOAUTO) + do_prefix = 0; + + if (do_prefix && (ret = changelist_prefix(cl)) != 0) + goto error; /* * Execute the corresponding ioctl() to set this property. @@ -1827,11 +1833,14 @@ zfs_prop_set(zfs_handle_t *zhp, const char *propname, const char *propval) (void) zfs_standard_error(hdl, errno, errbuf); } } else { + if (do_prefix) + ret = changelist_postfix(cl); + /* * Refresh the statistics so the new property value * is reflected. */ - if ((ret = changelist_postfix(cl)) == 0) + if (ret == 0) (void) get_stats(zhp); } @@ -2096,7 +2105,7 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src, case ZFS_PROP_CANMOUNT: *val = getprop_uint64(zhp, prop, source); - if (*val == 0) + if (*val != ZFS_CANMOUNT_ON) *source = zhp->zfs_name; else *source = ""; /* default */ |