static int do_zvol_remove(const char *dataset, void *data) { zpool_handle_t *zhp = data; return (zvol_remove_link(zhp->zpool_hdl, dataset)); }
/* * If the property is 'mountpoint', go through and unmount filesystems as * necessary. We don't do the same for 'sharenfs', because we can just re-share * with different options without interrupting service. */ int changelist_prefix(prop_changelist_t *clp) { prop_changenode_t *cn; int ret = 0; if (clp->cl_prop != ZFS_PROP_MOUNTPOINT) return (0); for (cn = uu_list_first(clp->cl_list); cn != NULL; cn = uu_list_next(clp->cl_list, cn)) { #ifndef __APPLE__ /* * If we are in the global zone, but this dataset is exported * to a local zone, do nothing. */ if (getzoneid() == GLOBAL_ZONEID && cn->cn_zoned) continue; #endif /*!__APPLE__*/ if (ZFS_IS_VOLUME(cn->cn_handle)) { switch (clp->cl_realprop) { case ZFS_PROP_NAME: /* * If this was a rename, unshare the zvol, and * remove the /dev/zvol links. */ (void) zfs_unshare_iscsi(cn->cn_handle); if (zvol_remove_link(cn->cn_handle->zfs_hdl, cn->cn_handle->zfs_name) != 0) ret = -1; break; case ZFS_PROP_VOLSIZE: /* * If this was a change to the volume size, we * need to unshare and reshare the volume. */ (void) zfs_unshare_iscsi(cn->cn_handle); break; } } else if (zfs_unmount(cn->cn_handle, NULL, clp->cl_flags) != 0) { ret = -1; } } return (ret); }
static int do_zvol(zfs_handle_t *zhp, void *data) { int linktype = (int)(uintptr_t)data; int ret; /* * We check for volblocksize intead of ZFS_TYPE_VOLUME so that we * correctly handle snapshots of volumes. */ if (zhp->zfs_volblocksize != 0) { if (linktype) ret = zvol_create_link(zhp->zfs_hdl, zhp->zfs_name); else ret = zvol_remove_link(zhp->zfs_hdl, zhp->zfs_name); } ret = zfs_iter_children(zhp, do_zvol, data); zfs_close(zhp); return (ret); }
/* * If the property is 'mountpoint', go through and unmount filesystems as * necessary. We don't do the same for 'sharenfs', because we can just re-share * with different options without interrupting service. */ int changelist_prefix(prop_changelist_t *clp) { prop_changenode_t *cn; int ret = 0; if (clp->cl_prop != ZFS_PROP_MOUNTPOINT) return (0); for (cn = uu_list_first(clp->cl_list); cn != NULL; cn = uu_list_next(clp->cl_list, cn)) { /* if a previous loop failed, set the remaining to false */ if (ret == -1) { cn->cn_needpost = B_FALSE; continue; } /* * If we are in the global zone, but this dataset is exported * to a local zone, do nothing. */ if (getzoneid() == GLOBAL_ZONEID && cn->cn_zoned) continue; if (ZFS_IS_VOLUME(cn->cn_handle)) { switch (clp->cl_realprop) { case ZFS_PROP_NAME: /* * If this was a rename, unshare the zvol, and * remove the /dev/zvol links. */ (void) zfs_unshare_iscsi(cn->cn_handle); if (zvol_remove_link(cn->cn_handle->zfs_hdl, cn->cn_handle->zfs_name) != 0) { ret = -1; cn->cn_needpost = B_FALSE; (void) zfs_share_iscsi(cn->cn_handle); } break; case ZFS_PROP_VOLSIZE: /* * If this was a change to the volume size, we * need to unshare and reshare the volume. */ (void) zfs_unshare_iscsi(cn->cn_handle); break; } } else if (zfs_unmount(cn->cn_handle, NULL, clp->cl_flags) != 0) { ret = -1; cn->cn_needpost = B_FALSE; } } if (ret == -1) (void) changelist_postfix(clp); return (ret); }