summaryrefslogtreecommitdiffstats
path: root/cddl/contrib/opensolaris/cmd/zfs
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2012-05-10 08:57:58 +0000
committermm <mm@FreeBSD.org>2012-05-10 08:57:58 +0000
commite290b949d0f602e9af6839f2f35666c98b1470b5 (patch)
tree69c342a520ee7283a86d49dfe4e46a9e7f06ec86 /cddl/contrib/opensolaris/cmd/zfs
parent10f60d496c9e9392a60ebec9350215094cae9472 (diff)
downloadFreeBSD-src-e290b949d0f602e9af6839f2f35666c98b1470b5.zip
FreeBSD-src-e290b949d0f602e9af6839f2f35666c98b1470b5.tar.gz
Add support for force unmounting ZFS filesystems during "zfs rename"
with the -f flag. Reimplementation of the illumos changeset 13677:a0cbef703c12 2635 'zfs rename -f' to perform force unmount References: https://www.illumos.org/issues/2635 PR: kern/164447 Suggested by: Marcelo Araujo <araujo@FreeBSD.org> Obtained from: illumos (issue #2635) MFC after: 1 week
Diffstat (limited to 'cddl/contrib/opensolaris/cmd/zfs')
-rw-r--r--cddl/contrib/opensolaris/cmd/zfs/zfs.811
-rw-r--r--cddl/contrib/opensolaris/cmd/zfs/zfs_main.c18
2 files changed, 21 insertions, 8 deletions
diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs.8 b/cddl/contrib/opensolaris/cmd/zfs/zfs.8
index fdbae4e..cfdfab0 100644
--- a/cddl/contrib/opensolaris/cmd/zfs/zfs.8
+++ b/cddl/contrib/opensolaris/cmd/zfs/zfs.8
@@ -18,7 +18,7 @@
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
-.\" Copyright (c) 2011 by Delphix. All rights reserved.
+.\" Copyright (c) 2012 by Delphix. All rights reserved.
.\" Copyright (c) 2012 Nexenta Systems, Inc. All Rights Reserved.
.\" Copyright (c) 2011, Pawel Jakub Dawidek <pjd@FreeBSD.org>
.\"
@@ -77,10 +77,12 @@
.Ar clone-filesystem
.Nm
.Cm rename
+.Op Fl f
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Nm
.Cm rename
+.Op Fl f
.Fl p
.Ar filesystem Ns | Ns Ar volume
.Ar filesystem Ns | Ns Ar volume
@@ -1646,12 +1648,14 @@ subcommand can be used to rename any conflicting snapshots.
.It Xo
.Nm
.Cm rename
+.Op Fl f
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Xc
.It Xo
.Nm
.Cm rename
+.Op Fl f
.Fl p
.Ar filesystem Ns | Ns Ar volume
.Ar filesystem Ns | Ns Ar volume
@@ -1685,6 +1689,11 @@ property is set to
or
.Cm none ,
file system is not unmounted even if this option is not given.
+.It Fl f
+Force unmount any filesystems that need to be unmounted in the process.
+This flag has no effect if used together with the
+.Fl u
+flag.
.El
.It Xo
.Nm
diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
index c322f08..cc20127 100644
--- a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
+++ b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
@@ -22,10 +22,10 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
- * Copyright (c) 2011 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
+ * Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
*/
#include <assert.h>
@@ -256,9 +256,10 @@ get_usage(zfs_help_t idx)
"snapshot>\n"
"\treceive [-vnFu] [-d | -e] <filesystem>\n"));
case HELP_RENAME:
- return (gettext("\trename <filesystem|volume|snapshot> "
+ return (gettext("\trename [-f] <filesystem|volume|snapshot> "
"<filesystem|volume|snapshot>\n"
- "\trename -p <filesystem|volume> <filesystem|volume>\n"
+ "\trename [-f] -p <filesystem|volume> "
+ "<filesystem|volume>\n"
"\trename -r <snapshot> <snapshot>\n"
"\trename -u [-p] <filesystem> <filesystem>"));
case HELP_ROLLBACK:
@@ -3091,8 +3092,8 @@ zfs_do_list(int argc, char **argv)
}
/*
- * zfs rename <fs | snap | vol> <fs | snap | vol>
- * zfs rename -p <fs | vol> <fs | vol>
+ * zfs rename [-f] <fs | snap | vol> <fs | snap | vol>
+ * zfs rename [-f] -p <fs | vol> <fs | vol>
* zfs rename -r <snap> <snap>
* zfs rename -u [-p] <fs> <fs>
*
@@ -3112,7 +3113,7 @@ zfs_do_rename(int argc, char **argv)
boolean_t parents = B_FALSE;
/* check options */
- while ((c = getopt(argc, argv, "pru")) != -1) {
+ while ((c = getopt(argc, argv, "fpru")) != -1) {
switch (c) {
case 'p':
parents = B_TRUE;
@@ -3123,6 +3124,9 @@ zfs_do_rename(int argc, char **argv)
case 'u':
flags.nounmount = B_TRUE;
break;
+ case 'f':
+ flags.forceunmount = B_TRUE;
+ break;
case '?':
default:
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
OpenPOWER on IntegriCloud