From a0a9776a5cd835b11247f9190d1b1005b828c7ed Mon Sep 17 00:00:00 2001 From: mm Date: Wed, 5 May 2010 18:22:29 +0000 Subject: Introduce hardforce export option (-F) for "zpool export". When exporting with this flag, zpool.cache remains untouched. OpenSolaris onnv revision: 8211:32722be6ad3b Approved by: pjd, delphij (mentor) Obtained from: OpenSolaris (Bug ID: 6775357) --- cddl/contrib/opensolaris/cmd/zpool/zpool_main.c | 12 ++++++++++-- cddl/contrib/opensolaris/cmd/ztest/ztest.c | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'cddl/contrib/opensolaris/cmd') diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c index 2970371..eef60e6 100644 --- a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c +++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c @@ -879,17 +879,21 @@ int zpool_do_export(int argc, char **argv) { boolean_t force = B_FALSE; + boolean_t hardforce = B_FALSE; int c; zpool_handle_t *zhp; int ret; int i; /* check options */ - while ((c = getopt(argc, argv, "f")) != -1) { + while ((c = getopt(argc, argv, "fF")) != -1) { switch (c) { case 'f': force = B_TRUE; break; + case 'F': + hardforce = B_TRUE; + break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); @@ -919,8 +923,12 @@ zpool_do_export(int argc, char **argv) continue; } - if (zpool_export(zhp, force) != 0) + if (hardforce) { + if (zpool_export_force(zhp) != 0) + ret = 1; + } else if (zpool_export(zhp, force) != 0) { ret = 1; + } zpool_close(zhp); } diff --git a/cddl/contrib/opensolaris/cmd/ztest/ztest.c b/cddl/contrib/opensolaris/cmd/ztest/ztest.c index b7ca302..9744a0a 100644 --- a/cddl/contrib/opensolaris/cmd/ztest/ztest.c +++ b/cddl/contrib/opensolaris/cmd/ztest/ztest.c @@ -3039,7 +3039,7 @@ ztest_spa_import_export(char *oldname, char *newname) /* * Export it. */ - error = spa_export(oldname, &config, B_FALSE); + error = spa_export(oldname, &config, B_FALSE, B_FALSE); if (error) fatal(0, "spa_export('%s') = %d", oldname, error); -- cgit v1.1