aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
diff options
context:
space:
mode:
authorMariusz Zaborski <oshogbo@FreeBSD.org>2020-04-11 17:54:35 +0000
committerMariusz Zaborski <oshogbo@FreeBSD.org>2020-04-11 17:54:35 +0000
commit23ee238fe5e3971569b3bd2ed2a2930110550466 (patch)
treed86f4ab8d193d4922ae377273be7ba1132f83c12 /cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
parenteec362ef5816b61b79a98d28830c5ff1d757b3ae (diff)
downloadsrc-23ee238fe5e3971569b3bd2ed2a2930110550466.tar.gz
src-23ee238fe5e3971569b3bd2ed2a2930110550466.zip
zfs: Add option for forcible unmounting dataset while receiving snapshot.
Currently when the dataset is in use we can't receive snapshots. zfs send test/1@asd | zfs recv -FM test/2 cannot unmount '/test/2': Device busy This commits add option 'M' which attempts to forcibly unmount the dataset. Thanks to this we can enforce receiving snapshots in a single step. Note that this functionality is not supported on Linux because the VFS will prevent active mounted filesystems from being unmounted, even with the force option. This is the intended VFS behavior. Discussed-with: Pawel Jakub Dawidek <pjd@FreeBSD.org> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Allan Jude <allanjude@freebsd.org> Differential Revision: https://reviews.freebsd.org/D22306 openzfs/zfs@a57d3d45d6efdff935421e2ef3f97e3dc089d93d
Notes
Notes: svn path=/head/; revision=359808
Diffstat (limited to 'cddl/contrib/opensolaris/cmd/zfs/zfs_main.c')
-rw-r--r--cddl/contrib/opensolaris/cmd/zfs/zfs_main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
index 3f389d1a51ff..851ba3f9523f 100644
--- a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
+++ b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
@@ -274,9 +274,9 @@ get_usage(zfs_help_t idx)
case HELP_PROMOTE:
return (gettext("\tpromote <clone-filesystem>\n"));
case HELP_RECEIVE:
- return (gettext("\treceive|recv [-vnsFu] <filesystem|volume|"
+ return (gettext("\treceive|recv [-vnsFMu] <filesystem|volume|"
"snapshot>\n"
- "\treceive|recv [-vnsFu] [-o origin=<snapshot>] [-d | -e] "
+ "\treceive|recv [-vnsFMu] [-o origin=<snapshot>] [-d | -e] "
"<filesystem>\n"
"\treceive|recv -A <filesystem|volume>\n"));
case HELP_RENAME:
@@ -4078,7 +4078,7 @@ zfs_do_receive(int argc, char **argv)
nomem();
/* check options */
- while ((c = getopt(argc, argv, ":o:denuvFsA")) != -1) {
+ while ((c = getopt(argc, argv, ":o:denuvMFsA")) != -1) {
switch (c) {
case 'o':
if (parseprop(props, optarg) != 0)
@@ -4106,6 +4106,9 @@ zfs_do_receive(int argc, char **argv)
case 'F':
flags.force = B_TRUE;
break;
+ case 'M':
+ flags.forceunmount = B_TRUE;
+ break;
case 'A':
abort_resumable = B_TRUE;
break;