diff options
author | Mariusz Zaborski <[email protected]> | 2020-03-17 18:08:32 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-17 10:08:32 -0700 |
commit | a57d3d45d6efdff935421e2ef3f97e3dc089d93d (patch) | |
tree | dac886a88e2c50cd450f1684f93d8549e24469e9 /cmd/zfs | |
parent | 80d98a8f3addfbfa1feefef70774193ed18c1013 (diff) |
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.
Test cases were added to verify the expected behavior based on
the platform.
Discussed-with: Pawel Jakub Dawidek <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
External-issue: https://reviews.freebsd.org/D22306
Closes #9904
Diffstat (limited to 'cmd/zfs')
-rw-r--r-- | cmd/zfs/zfs_main.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index d2ec39893..82b91754e 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -298,10 +298,10 @@ get_usage(zfs_help_t idx) case HELP_PROMOTE: return (gettext("\tpromote <clone-filesystem>\n")); case HELP_RECEIVE: - return (gettext("\treceive [-vnsFhu] " + return (gettext("\treceive [-vMnsFhu] " "[-o <property>=<value>] ... [-x <property>] ...\n" "\t <filesystem|volume|snapshot>\n" - "\treceive [-vnsFhu] [-o <property>=<value>] ... " + "\treceive [-vMnsFhu] [-o <property>=<value>] ... " "[-x <property>] ... \n" "\t [-d | -e] <filesystem>\n" "\treceive -A <filesystem|volume>\n")); @@ -4552,7 +4552,7 @@ zfs_do_receive(int argc, char **argv) nomem(); /* check options */ - while ((c = getopt(argc, argv, ":o:x:dehnuvFsA")) != -1) { + while ((c = getopt(argc, argv, ":o:x:dehMnuvFsA")) != -1) { switch (c) { case 'o': if (!parseprop(props, optarg)) { @@ -4587,6 +4587,9 @@ zfs_do_receive(int argc, char **argv) case 'h': flags.skipholds = B_TRUE; break; + case 'M': + flags.forceunmount = B_TRUE; + break; case 'n': flags.dryrun = B_TRUE; break; |