5 # This file and its contents are supplied under the terms of the
6 # Common Development and Distribution License ("CDDL"), version 1.0.
7 # You may only use this file in accordance with the terms of version
10 # A full copy of the text of the CDDL should have accompanied this
11 # source. A copy of the CDDL is also available via the Internet at
12 # http://www.illumos.org/license/CDDL.
16 # Copyright (c) 2020 by Mariusz Zaborski <oshogbo@FreeBSD.org>.
20 # Verify 'zfs recv' can forcibly unmount filesystem while receiving
24 # 1. Create snapshot of file system
25 # 2. Make a zfs filesystem mountpoint busy
26 # 3. Receive filesystem with force flag.
27 # 4. Verify that stream was received or failed on Linux.
30 . $STF_SUITE/tests/functional/cli_root/cli_common.kshlib
32 verify_runnable "both"
38 for snap in $init_snap $rst_snap; do
40 destroy_snapshot $snap
43 datasetexists $rst_root && \
44 destroy_dataset $rst_root
46 for file in $full_bkup
52 [[ -d $TESTDIR1 ]] && \
53 log_must rm -rf $TESTDIR1
56 log_assert "Verify 'zfs recv' can forcibly unmount busy filesystem."
60 init_snap=$TESTPOOL/$TESTFS@init_snap
61 full_bkup=$TEST_BASE_DIR/fullbkup.$$
62 rst_root=$TESTPOOL/rst_ctr
63 rst_snap=$rst_root@init_snap
65 log_note "Verify 'zfs recv' can forcible unmount busy filesystem."
68 log_must zfs create $rst_root
69 [[ ! -d $TESTDIR1 ]] && \
70 log_must mkdir -p $TESTDIR1
71 log_must zfs set mountpoint=$TESTDIR1 $rst_root
73 log_must zfs snapshot $init_snap
74 log_must eval "zfs send $init_snap > $full_bkup"
79 # Linux does not support it.
80 log_mustnot zfs receive -MF $rst_snap < $full_bkup
82 log_must zfs receive -MF $rst_snap < $full_bkup
85 log_pass "The busy filesystem was unmounted or busy as expected."