]> git.proxmox.com Git - mirror_zfs.git/commit - cmd/zfs/zfs_main.c
Add option for forcible unmounting dataset while receiving snapshot.
authorMariusz Zaborski <oshogbo@vexillium.org>
Tue, 17 Mar 2020 17:08:32 +0000 (18:08 +0100)
committerGitHub <noreply@github.com>
Tue, 17 Mar 2020 17:08:32 +0000 (10:08 -0700)
commita57d3d45d6efdff935421e2ef3f97e3dc089d93d
treedac886a88e2c50cd450f1684f93d8549e24469e9
parent80d98a8f3addfbfa1feefef70774193ed18c1013
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 <pjd@FreeBSD.org>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Allan Jude <allanjude@freebsd.org>
External-issue: https://reviews.freebsd.org/D22306
Closes #9904
cmd/zfs/zfs_main.c
include/libzfs.h
lib/libzfs/libzfs_sendrecv.c
man/man8/zfs-receive.8
tests/runfiles/common.run
tests/zfs-tests/tests/functional/cli_root/zfs_receive/Makefile.am
tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_016_pos.ksh [new file with mode: 0755]