4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
9 # A full copy of the text of the CDDL should have accompanied this
10 # source. A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
15 # Copyright (c) 2017 by Lawrence Livermore National Security, LLC.
18 . $STF_SUITE/include/libtest.shlib
19 . $STF_SUITE/tests/functional/rsend/rsend.kshlib
23 # Verify FREEOBJECTS record frees sequential objects (See
24 # https://github.com/openzfs/zfs/issues/6694)
27 # 1. Create three files with sequential object numbers, f1 f2 and f3
32 # 6. Receive a full send of A
33 # 7. Receive an incremental send of B
34 # 8. Fail test if f3 exists on received snapshot B
37 verify_runnable "both"
39 log_assert "Verify FREEOBJECTS record frees sequential objects"
48 # We need to set xattr=sa and dnodesize=legacy to guarantee sequential
49 # object numbers for this test. Otherwise, if we used directory-based
50 # xattrs, SELinux extended attributes might consume intervening object
53 log_must zfs create -o xattr=sa -o dnodesize=legacy $POOL/$sendds
56 for ((i=0; i<$tries; i++)); do
58 o1=$(ls -li $f1 | awk '{print $1}')
59 o2=$(ls -li $f2 | awk '{print $1}')
60 o3=$(ls -li $f3 | awk '{print $1}')
62 if [[ $o2 -ne $(( $o1 + 1 )) ]] || [[ $o3 -ne $(( $o2 + 1 )) ]]; then
69 if [[ $i -eq $tries ]]; then
70 log_fail "Failed to create three sequential objects"
74 log_must zfs snap $POOL/$sendds@A
76 log_must zfs snap $POOL/$sendds@B
77 log_must eval "zfs send $POOL/$sendds@A | zfs recv $POOL/$recvds"
78 log_must eval "zfs send -i $POOL/$sendds@A $POOL/$sendds@B |" \
79 "zfs recv $POOL/$recvds"
80 log_mustnot zdb $POOL/$recvds@B $o3
81 log_pass "Verify FREEOBJECTS record frees sequential objects"