1236884Smm/* 2236884Smm * CDDL HEADER START 3236884Smm * 4236884Smm * The contents of this file are subject to the terms of the 5236884Smm * Common Development and Distribution License (the "License"). 6236884Smm * You may not use this file except in compliance with the License. 7236884Smm * 8236884Smm * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9236884Smm * or http://www.opensolaris.org/os/licensing. 10236884Smm * See the License for the specific language governing permissions 11236884Smm * and limitations under the License. 12236884Smm * 13236884Smm * When distributing Covered Code, include this CDDL HEADER in each 14236884Smm * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15236884Smm * If applicable, add the following below this CDDL HEADER, with the 16236884Smm * fields enclosed by brackets "[]" replaced with your own identifying 17236884Smm * information: Portions Copyright [yyyy] [name of copyright owner] 18236884Smm * 19236884Smm * CDDL HEADER END 20236884Smm */ 21236884Smm 22236884Smm/* 23263389Sdelphij * Copyright (c) 2013 by Delphix. All rights reserved. 24252764Sdelphij * Copyright (c) 2013 Steven Hartland. All rights reserved. 25236884Smm */ 26236884Smm 27236884Smm/* 28236884Smm * zhack is a debugging tool that can write changes to ZFS pool using libzpool 29236884Smm * for testing purposes. Altering pools with zhack is unsupported and may 30236884Smm * result in corrupted pools. 31236884Smm */ 32236884Smm 33236884Smm#include <stdio.h> 34236884Smm#include <stdlib.h> 35236884Smm#include <ctype.h> 36236884Smm#include <sys/zfs_context.h> 37236884Smm#include <sys/spa.h> 38236884Smm#include <sys/spa_impl.h> 39236884Smm#include <sys/dmu.h> 40236884Smm#include <sys/zap.h> 41236884Smm#include <sys/zfs_znode.h> 42236884Smm#include <sys/dsl_synctask.h> 43236884Smm#include <sys/vdev.h> 44236884Smm#include <sys/fs/zfs.h> 45236884Smm#include <sys/dmu_objset.h> 46236884Smm#include <sys/dsl_pool.h> 47236884Smm#include <sys/zio_checksum.h> 48236884Smm#include <sys/zio_compress.h> 49236884Smm#include <sys/zfeature.h> 50249643Smm#include <sys/dmu_tx.h> 51236884Smm#undef ZFS_MAXNAMELEN 52236884Smm#undef verify 53236884Smm#include <libzfs.h> 54236884Smm 55236884Smmextern boolean_t zfeature_checks_disable; 56236884Smm 57236884Smmconst char cmdname[] = "zhack"; 58236884Smmlibzfs_handle_t *g_zfs; 59236884Smmstatic importargs_t g_importargs; 60236884Smmstatic char *g_pool; 61236884Smmstatic boolean_t g_readonly; 62236884Smm 63236884Smmstatic void 64236884Smmusage(void) 65236884Smm{ 66236884Smm (void) fprintf(stderr, 67236884Smm "Usage: %s [-c cachefile] [-d dir] <subcommand> <args> ...\n" 68236884Smm "where <subcommand> <args> is one of the following:\n" 69236884Smm "\n", cmdname); 70236884Smm 71236884Smm (void) fprintf(stderr, 72236884Smm " feature stat <pool>\n" 73236884Smm " print information about enabled features\n" 74236884Smm " feature enable [-d desc] <pool> <feature>\n" 75236884Smm " add a new enabled feature to the pool\n" 76236884Smm " -d <desc> sets the feature's description\n" 77236884Smm " feature ref [-md] <pool> <feature>\n" 78236884Smm " change the refcount on the given feature\n" 79236884Smm " -d decrease instead of increase the refcount\n" 80236884Smm " -m add the feature to the label if increasing refcount\n" 81236884Smm "\n" 82236884Smm " <feature> : should be a feature guid\n"); 83236884Smm exit(1); 84236884Smm} 85236884Smm 86236884Smm 87236884Smmstatic void 88263389Sdelphijfatal(spa_t *spa, void *tag, const char *fmt, ...) 89236884Smm{ 90236884Smm va_list ap; 91236884Smm 92263389Sdelphij if (spa != NULL) { 93263389Sdelphij spa_close(spa, tag); 94263389Sdelphij (void) spa_export(g_pool, NULL, B_TRUE, B_FALSE); 95263389Sdelphij } 96263389Sdelphij 97236884Smm va_start(ap, fmt); 98236884Smm (void) fprintf(stderr, "%s: ", cmdname); 99236884Smm (void) vfprintf(stderr, fmt, ap); 100236884Smm va_end(ap); 101236884Smm (void) fprintf(stderr, "\n"); 102236884Smm 103236884Smm exit(1); 104236884Smm} 105236884Smm 106236884Smm/* ARGSUSED */ 107236884Smmstatic int 108236884Smmspace_delta_cb(dmu_object_type_t bonustype, void *data, 109236884Smm uint64_t *userp, uint64_t *groupp) 110236884Smm{ 111236884Smm /* 112236884Smm * Is it a valid type of object to track? 113236884Smm */ 114236884Smm if (bonustype != DMU_OT_ZNODE && bonustype != DMU_OT_SA) 115236884Smm return (ENOENT); 116236884Smm (void) fprintf(stderr, "modifying object that needs user accounting"); 117236884Smm abort(); 118236884Smm /* NOTREACHED */ 119236884Smm} 120236884Smm 121236884Smm/* 122236884Smm * Target is the dataset whose pool we want to open. 123236884Smm */ 124236884Smmstatic void 125236884Smmimport_pool(const char *target, boolean_t readonly) 126236884Smm{ 127236884Smm nvlist_t *config; 128236884Smm nvlist_t *pools; 129236884Smm int error; 130236884Smm char *sepp; 131236884Smm spa_t *spa; 132236884Smm nvpair_t *elem; 133236884Smm nvlist_t *props; 134236884Smm const char *name; 135236884Smm 136236884Smm kernel_init(readonly ? FREAD : (FREAD | FWRITE)); 137236884Smm g_zfs = libzfs_init(); 138236884Smm ASSERT(g_zfs != NULL); 139236884Smm 140236884Smm dmu_objset_register_type(DMU_OST_ZFS, space_delta_cb); 141236884Smm 142236884Smm g_readonly = readonly; 143236884Smm 144236884Smm /* 145236884Smm * If we only want readonly access, it's OK if we find 146236884Smm * a potentially-active (ie, imported into the kernel) pool from the 147236884Smm * default cachefile. 148236884Smm */ 149236884Smm if (readonly && spa_open(target, &spa, FTAG) == 0) { 150236884Smm spa_close(spa, FTAG); 151236884Smm return; 152236884Smm } 153236884Smm 154236884Smm g_importargs.unique = B_TRUE; 155236884Smm g_importargs.can_be_active = readonly; 156236884Smm g_pool = strdup(target); 157236884Smm if ((sepp = strpbrk(g_pool, "/@")) != NULL) 158236884Smm *sepp = '\0'; 159236884Smm g_importargs.poolname = g_pool; 160236884Smm pools = zpool_search_import(g_zfs, &g_importargs); 161236884Smm 162252764Sdelphij if (nvlist_empty(pools)) { 163236884Smm if (!g_importargs.can_be_active) { 164236884Smm g_importargs.can_be_active = B_TRUE; 165236884Smm if (zpool_search_import(g_zfs, &g_importargs) != NULL || 166236884Smm spa_open(target, &spa, FTAG) == 0) { 167263389Sdelphij fatal(spa, FTAG, "cannot import '%s': pool is " 168263389Sdelphij "active; run " "\"zpool export %s\" " 169263389Sdelphij "first\n", g_pool, g_pool); 170236884Smm } 171236884Smm } 172236884Smm 173263389Sdelphij fatal(NULL, FTAG, "cannot import '%s': no such pool " 174263389Sdelphij "available\n", g_pool); 175236884Smm } 176236884Smm 177236884Smm elem = nvlist_next_nvpair(pools, NULL); 178236884Smm name = nvpair_name(elem); 179236884Smm verify(nvpair_value_nvlist(elem, &config) == 0); 180236884Smm 181236884Smm props = NULL; 182236884Smm if (readonly) { 183236884Smm verify(nvlist_alloc(&props, NV_UNIQUE_NAME, 0) == 0); 184236884Smm verify(nvlist_add_uint64(props, 185236884Smm zpool_prop_to_name(ZPOOL_PROP_READONLY), 1) == 0); 186236884Smm } 187236884Smm 188236884Smm zfeature_checks_disable = B_TRUE; 189236884Smm error = spa_import(name, config, props, ZFS_IMPORT_NORMAL); 190236884Smm zfeature_checks_disable = B_FALSE; 191236884Smm if (error == EEXIST) 192236884Smm error = 0; 193236884Smm 194236884Smm if (error) 195263389Sdelphij fatal(NULL, FTAG, "can't import '%s': %s", name, 196263389Sdelphij strerror(error)); 197236884Smm} 198236884Smm 199236884Smmstatic void 200236884Smmzhack_spa_open(const char *target, boolean_t readonly, void *tag, spa_t **spa) 201236884Smm{ 202236884Smm int err; 203236884Smm 204236884Smm import_pool(target, readonly); 205236884Smm 206236884Smm zfeature_checks_disable = B_TRUE; 207236884Smm err = spa_open(target, spa, tag); 208236884Smm zfeature_checks_disable = B_FALSE; 209236884Smm 210236884Smm if (err != 0) 211263389Sdelphij fatal(*spa, FTAG, "cannot open '%s': %s", target, 212263389Sdelphij strerror(err)); 213236884Smm if (spa_version(*spa) < SPA_VERSION_FEATURES) { 214263389Sdelphij fatal(*spa, FTAG, "'%s' has version %d, features not enabled", 215263389Sdelphij target, (int)spa_version(*spa)); 216236884Smm } 217236884Smm} 218236884Smm 219236884Smmstatic void 220236884Smmdump_obj(objset_t *os, uint64_t obj, const char *name) 221236884Smm{ 222236884Smm zap_cursor_t zc; 223236884Smm zap_attribute_t za; 224236884Smm 225236884Smm (void) printf("%s_obj:\n", name); 226236884Smm 227236884Smm for (zap_cursor_init(&zc, os, obj); 228236884Smm zap_cursor_retrieve(&zc, &za) == 0; 229236884Smm zap_cursor_advance(&zc)) { 230236884Smm if (za.za_integer_length == 8) { 231236884Smm ASSERT(za.za_num_integers == 1); 232236884Smm (void) printf("\t%s = %llu\n", 233236884Smm za.za_name, (u_longlong_t)za.za_first_integer); 234236884Smm } else { 235236884Smm ASSERT(za.za_integer_length == 1); 236236884Smm char val[1024]; 237236884Smm VERIFY(zap_lookup(os, obj, za.za_name, 238236884Smm 1, sizeof (val), val) == 0); 239236884Smm (void) printf("\t%s = %s\n", za.za_name, val); 240236884Smm } 241236884Smm } 242236884Smm zap_cursor_fini(&zc); 243236884Smm} 244236884Smm 245236884Smmstatic void 246236884Smmdump_mos(spa_t *spa) 247236884Smm{ 248236884Smm nvlist_t *nv = spa->spa_label_features; 249236884Smm 250236884Smm (void) printf("label config:\n"); 251236884Smm for (nvpair_t *pair = nvlist_next_nvpair(nv, NULL); 252236884Smm pair != NULL; 253236884Smm pair = nvlist_next_nvpair(nv, pair)) { 254236884Smm (void) printf("\t%s\n", nvpair_name(pair)); 255236884Smm } 256236884Smm} 257236884Smm 258236884Smmstatic void 259236884Smmzhack_do_feature_stat(int argc, char **argv) 260236884Smm{ 261236884Smm spa_t *spa; 262236884Smm objset_t *os; 263236884Smm char *target; 264236884Smm 265236884Smm argc--; 266236884Smm argv++; 267236884Smm 268236884Smm if (argc < 1) { 269236884Smm (void) fprintf(stderr, "error: missing pool name\n"); 270236884Smm usage(); 271236884Smm } 272236884Smm target = argv[0]; 273236884Smm 274236884Smm zhack_spa_open(target, B_TRUE, FTAG, &spa); 275236884Smm os = spa->spa_meta_objset; 276236884Smm 277236884Smm dump_obj(os, spa->spa_feat_for_read_obj, "for_read"); 278236884Smm dump_obj(os, spa->spa_feat_for_write_obj, "for_write"); 279236884Smm dump_obj(os, spa->spa_feat_desc_obj, "descriptions"); 280263398Sdelphij if (spa_feature_is_active(spa, SPA_FEATURE_ENABLED_TXG)) { 281263398Sdelphij dump_obj(os, spa->spa_feat_enabled_txg_obj, "enabled_txg"); 282263398Sdelphij } 283236884Smm dump_mos(spa); 284236884Smm 285236884Smm spa_close(spa, FTAG); 286236884Smm} 287236884Smm 288236884Smmstatic void 289263391Sdelphijzhack_feature_enable_sync(void *arg, dmu_tx_t *tx) 290236884Smm{ 291249643Smm spa_t *spa = dmu_tx_pool(tx)->dp_spa; 292249643Smm zfeature_info_t *feature = arg; 293236884Smm 294263391Sdelphij feature_enable_sync(spa, feature, tx); 295263391Sdelphij 296249643Smm spa_history_log_internal(spa, "zhack enable feature", tx, 297249643Smm "name=%s can_readonly=%u", 298249643Smm feature->fi_guid, feature->fi_can_readonly); 299236884Smm} 300236884Smm 301236884Smmstatic void 302236884Smmzhack_do_feature_enable(int argc, char **argv) 303236884Smm{ 304236884Smm char c; 305236884Smm char *desc, *target; 306236884Smm spa_t *spa; 307236884Smm objset_t *mos; 308236884Smm zfeature_info_t feature; 309263391Sdelphij spa_feature_t nodeps[] = { SPA_FEATURE_NONE }; 310236884Smm 311236884Smm /* 312236884Smm * Features are not added to the pool's label until their refcounts 313236884Smm * are incremented, so fi_mos can just be left as false for now. 314236884Smm */ 315236884Smm desc = NULL; 316236884Smm feature.fi_uname = "zhack"; 317236884Smm feature.fi_mos = B_FALSE; 318236884Smm feature.fi_can_readonly = B_FALSE; 319263398Sdelphij feature.fi_activate_on_enable = B_FALSE; 320236884Smm feature.fi_depends = nodeps; 321263398Sdelphij feature.fi_feature = SPA_FEATURE_NONE; 322236884Smm 323236884Smm optind = 1; 324236884Smm while ((c = getopt(argc, argv, "rmd:")) != -1) { 325236884Smm switch (c) { 326236884Smm case 'r': 327236884Smm feature.fi_can_readonly = B_TRUE; 328236884Smm break; 329236884Smm case 'd': 330236884Smm desc = strdup(optarg); 331236884Smm break; 332236884Smm default: 333236884Smm usage(); 334236884Smm break; 335236884Smm } 336236884Smm } 337236884Smm 338236884Smm if (desc == NULL) 339236884Smm desc = strdup("zhack injected"); 340236884Smm feature.fi_desc = desc; 341236884Smm 342236884Smm argc -= optind; 343236884Smm argv += optind; 344236884Smm 345236884Smm if (argc < 2) { 346236884Smm (void) fprintf(stderr, "error: missing feature or pool name\n"); 347236884Smm usage(); 348236884Smm } 349236884Smm target = argv[0]; 350236884Smm feature.fi_guid = argv[1]; 351236884Smm 352236884Smm if (!zfeature_is_valid_guid(feature.fi_guid)) 353263389Sdelphij fatal(NULL, FTAG, "invalid feature guid: %s", feature.fi_guid); 354236884Smm 355236884Smm zhack_spa_open(target, B_FALSE, FTAG, &spa); 356236884Smm mos = spa->spa_meta_objset; 357236884Smm 358263391Sdelphij if (zfeature_is_supported(feature.fi_guid)) 359263389Sdelphij fatal(spa, FTAG, "'%s' is a real feature, will not enable"); 360236884Smm if (0 == zap_contains(mos, spa->spa_feat_desc_obj, feature.fi_guid)) 361263389Sdelphij fatal(spa, FTAG, "feature already enabled: %s", 362263389Sdelphij feature.fi_guid); 363236884Smm 364249643Smm VERIFY0(dsl_sync_task(spa_name(spa), NULL, 365263391Sdelphij zhack_feature_enable_sync, &feature, 5)); 366236884Smm 367236884Smm spa_close(spa, FTAG); 368236884Smm 369236884Smm free(desc); 370236884Smm} 371236884Smm 372236884Smmstatic void 373249643Smmfeature_incr_sync(void *arg, dmu_tx_t *tx) 374236884Smm{ 375249643Smm spa_t *spa = dmu_tx_pool(tx)->dp_spa; 376249643Smm zfeature_info_t *feature = arg; 377263391Sdelphij uint64_t refcount; 378236884Smm 379263398Sdelphij VERIFY0(feature_get_refcount_from_disk(spa, feature, &refcount)); 380263391Sdelphij feature_sync(spa, feature, refcount + 1, tx); 381249643Smm spa_history_log_internal(spa, "zhack feature incr", tx, 382249643Smm "name=%s", feature->fi_guid); 383236884Smm} 384236884Smm 385236884Smmstatic void 386249643Smmfeature_decr_sync(void *arg, dmu_tx_t *tx) 387236884Smm{ 388249643Smm spa_t *spa = dmu_tx_pool(tx)->dp_spa; 389249643Smm zfeature_info_t *feature = arg; 390263391Sdelphij uint64_t refcount; 391236884Smm 392263398Sdelphij VERIFY0(feature_get_refcount_from_disk(spa, feature, &refcount)); 393263391Sdelphij feature_sync(spa, feature, refcount - 1, tx); 394249643Smm spa_history_log_internal(spa, "zhack feature decr", tx, 395249643Smm "name=%s", feature->fi_guid); 396236884Smm} 397236884Smm 398236884Smmstatic void 399236884Smmzhack_do_feature_ref(int argc, char **argv) 400236884Smm{ 401236884Smm char c; 402236884Smm char *target; 403236884Smm boolean_t decr = B_FALSE; 404236884Smm spa_t *spa; 405236884Smm objset_t *mos; 406236884Smm zfeature_info_t feature; 407263391Sdelphij spa_feature_t nodeps[] = { SPA_FEATURE_NONE }; 408236884Smm 409236884Smm /* 410236884Smm * fi_desc does not matter here because it was written to disk 411236884Smm * when the feature was enabled, but we need to properly set the 412236884Smm * feature for read or write based on the information we read off 413236884Smm * disk later. 414236884Smm */ 415236884Smm feature.fi_uname = "zhack"; 416236884Smm feature.fi_mos = B_FALSE; 417236884Smm feature.fi_desc = NULL; 418236884Smm feature.fi_depends = nodeps; 419263398Sdelphij feature.fi_feature = SPA_FEATURE_NONE; 420236884Smm 421236884Smm optind = 1; 422236884Smm while ((c = getopt(argc, argv, "md")) != -1) { 423236884Smm switch (c) { 424236884Smm case 'm': 425236884Smm feature.fi_mos = B_TRUE; 426236884Smm break; 427236884Smm case 'd': 428236884Smm decr = B_TRUE; 429236884Smm break; 430236884Smm default: 431236884Smm usage(); 432236884Smm break; 433236884Smm } 434236884Smm } 435236884Smm argc -= optind; 436236884Smm argv += optind; 437236884Smm 438236884Smm if (argc < 2) { 439236884Smm (void) fprintf(stderr, "error: missing feature or pool name\n"); 440236884Smm usage(); 441236884Smm } 442236884Smm target = argv[0]; 443236884Smm feature.fi_guid = argv[1]; 444236884Smm 445236884Smm if (!zfeature_is_valid_guid(feature.fi_guid)) 446263389Sdelphij fatal(NULL, FTAG, "invalid feature guid: %s", feature.fi_guid); 447236884Smm 448236884Smm zhack_spa_open(target, B_FALSE, FTAG, &spa); 449236884Smm mos = spa->spa_meta_objset; 450236884Smm 451263391Sdelphij if (zfeature_is_supported(feature.fi_guid)) { 452263391Sdelphij fatal(spa, FTAG, 453263391Sdelphij "'%s' is a real feature, will not change refcount"); 454263391Sdelphij } 455236884Smm 456236884Smm if (0 == zap_contains(mos, spa->spa_feat_for_read_obj, 457236884Smm feature.fi_guid)) { 458236884Smm feature.fi_can_readonly = B_FALSE; 459236884Smm } else if (0 == zap_contains(mos, spa->spa_feat_for_write_obj, 460236884Smm feature.fi_guid)) { 461236884Smm feature.fi_can_readonly = B_TRUE; 462236884Smm } else { 463263389Sdelphij fatal(spa, FTAG, "feature is not enabled: %s", feature.fi_guid); 464236884Smm } 465236884Smm 466263391Sdelphij if (decr) { 467263391Sdelphij uint64_t count; 468263398Sdelphij if (feature_get_refcount_from_disk(spa, &feature, 469263398Sdelphij &count) == 0 && count != 0) { 470263391Sdelphij fatal(spa, FTAG, "feature refcount already 0: %s", 471263391Sdelphij feature.fi_guid); 472263391Sdelphij } 473263391Sdelphij } 474236884Smm 475249643Smm VERIFY0(dsl_sync_task(spa_name(spa), NULL, 476249643Smm decr ? feature_decr_sync : feature_incr_sync, &feature, 5)); 477236884Smm 478236884Smm spa_close(spa, FTAG); 479236884Smm} 480236884Smm 481236884Smmstatic int 482236884Smmzhack_do_feature(int argc, char **argv) 483236884Smm{ 484236884Smm char *subcommand; 485236884Smm 486236884Smm argc--; 487236884Smm argv++; 488236884Smm if (argc == 0) { 489236884Smm (void) fprintf(stderr, 490236884Smm "error: no feature operation specified\n"); 491236884Smm usage(); 492236884Smm } 493236884Smm 494236884Smm subcommand = argv[0]; 495236884Smm if (strcmp(subcommand, "stat") == 0) { 496236884Smm zhack_do_feature_stat(argc, argv); 497236884Smm } else if (strcmp(subcommand, "enable") == 0) { 498236884Smm zhack_do_feature_enable(argc, argv); 499236884Smm } else if (strcmp(subcommand, "ref") == 0) { 500236884Smm zhack_do_feature_ref(argc, argv); 501236884Smm } else { 502236884Smm (void) fprintf(stderr, "error: unknown subcommand: %s\n", 503236884Smm subcommand); 504236884Smm usage(); 505236884Smm } 506236884Smm 507236884Smm return (0); 508236884Smm} 509236884Smm 510236884Smm#define MAX_NUM_PATHS 1024 511236884Smm 512236884Smmint 513236884Smmmain(int argc, char **argv) 514236884Smm{ 515236884Smm extern void zfs_prop_init(void); 516236884Smm 517236884Smm char *path[MAX_NUM_PATHS]; 518236884Smm const char *subcommand; 519236884Smm int rv = 0; 520236884Smm char c; 521236884Smm 522236884Smm g_importargs.path = path; 523236884Smm 524236884Smm dprintf_setup(&argc, argv); 525236884Smm zfs_prop_init(); 526236884Smm 527236884Smm while ((c = getopt(argc, argv, "c:d:")) != -1) { 528236884Smm switch (c) { 529236884Smm case 'c': 530236884Smm g_importargs.cachefile = optarg; 531236884Smm break; 532236884Smm case 'd': 533236884Smm assert(g_importargs.paths < MAX_NUM_PATHS); 534236884Smm g_importargs.path[g_importargs.paths++] = optarg; 535236884Smm break; 536236884Smm default: 537236884Smm usage(); 538236884Smm break; 539236884Smm } 540236884Smm } 541236884Smm 542236884Smm argc -= optind; 543236884Smm argv += optind; 544236884Smm optind = 1; 545236884Smm 546236884Smm if (argc == 0) { 547236884Smm (void) fprintf(stderr, "error: no command specified\n"); 548236884Smm usage(); 549236884Smm } 550236884Smm 551236884Smm subcommand = argv[0]; 552236884Smm 553236884Smm if (strcmp(subcommand, "feature") == 0) { 554236884Smm rv = zhack_do_feature(argc, argv); 555236884Smm } else { 556236884Smm (void) fprintf(stderr, "error: unknown subcommand: %s\n", 557236884Smm subcommand); 558236884Smm usage(); 559236884Smm } 560236884Smm 561263389Sdelphij if (!g_readonly && spa_export(g_pool, NULL, B_TRUE, B_FALSE) != 0) { 562263389Sdelphij fatal(NULL, FTAG, "pool export failed; " 563236884Smm "changes may not be committed to disk\n"); 564236884Smm } 565236884Smm 566236884Smm libzfs_fini(g_zfs); 567236884Smm kernel_fini(); 568236884Smm 569236884Smm return (rv); 570236884Smm} 571