blob: 98c9af5fe57fdd43b8cb6b956d446dcb064bcefc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2015 SUSE Linux Products GmbH. All Rights Reserved.
#
# FS QA Test No. btrfs/084
#
# Test for incremental send where the difference between the parent and send
# snapshots is that for a subtree with the same path in both snapshots (p1/p2),
# the root directories were swapped.
#
# This issue was fixed by the following linux kernel btrfs patch:
#
# Btrfs: incremental send, clear name from cache after orphanization
#
. ./common/preamble
_begin_fstest auto quick send
# Override the default cleanup function.
_cleanup()
{
rm -fr $send_files_dir
rm -f $tmp.*
}
. ./common/filter
_supported_fs btrfs
_require_scratch
_require_fssum
send_files_dir=$TEST_DIR/btrfs-test-$seq
rm -fr $send_files_dir
mkdir $send_files_dir
_scratch_mkfs >>$seqres.full 2>&1
_scratch_mount
mkdir -p $SCRATCH_MNT/data/n1/n2/p1/p2
mkdir $SCRATCH_MNT/data/n4
mkdir -p $SCRATCH_MNT/data/p1/p2
# Filesystem looks like:
#
# . (ino 256)
# |---- data (ino 257)
# |---- n1/ (ino 258)
# | |---- n2/ (ino 259)
# | |---- p1/ (ino 260)
# | |---- p2/ (ino 261)
# |
# |---- n4/ (ino 262)
# |---- p1/ (ino 263)
# |---- p2/ (ino 264)
#
_btrfs subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap1
# Now move directories around such that for the subtrees with the path "p1/p2"
# we end up swapping the parents, that is, inode 263 becomes the parent of
# inode 261 and inode 260 becomes the parent of inode 264. This makes the send
# stream orphanize the inodes 263 and 264, and we want to verify the respective
# rename operations don't fail, that they don't use incorrect paths.
mv $SCRATCH_MNT/data/p1/p2 $SCRATCH_MNT/data
mv $SCRATCH_MNT/data/n1/n2/p1/p2 $SCRATCH_MNT/data/p1
mv $SCRATCH_MNT/data/p2 $SCRATCH_MNT/data/n1/n2/p1
mv $SCRATCH_MNT/data/n1/n2 $SCRATCH_MNT/data/p1
mv $SCRATCH_MNT/data/p1 $SCRATCH_MNT/data/n4
mv $SCRATCH_MNT/data/n4/p1/n2/p1 $SCRATCH_MNT/data
# Filesystem now looks like:
#
# . (ino 256)
# |---- data (ino 257)
# |---- n1/ (ino 258)
# |---- n4/ (ino 262)
# | |---- p1/ (ino 263)
# | |---- n2/ (ino 259)
# | |---- p2/ (ino 261)
# |
# |---- p1/ (ino 260)
# |---- p2/ (ino 264)
#
_btrfs subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap2
run_check $FSSUM_PROG -A -f -w $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
run_check $FSSUM_PROG -A -f -w $send_files_dir/2.fssum \
-x $SCRATCH_MNT/mysnap2/mysnap1 $SCRATCH_MNT/mysnap2
_btrfs send -f $send_files_dir/1.snap $SCRATCH_MNT/mysnap1
_btrfs send -p $SCRATCH_MNT/mysnap1 -f $send_files_dir/2.snap \
$SCRATCH_MNT/mysnap2
# Now recreate the filesystem by receiving both send streams and verify we get
# the same content that the original filesystem had.
_scratch_unmount
_scratch_mkfs >>$seqres.full 2>&1
_scratch_mount
_btrfs receive -f $send_files_dir/1.snap $SCRATCH_MNT
run_check $FSSUM_PROG -r $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
_btrfs receive -f $send_files_dir/2.snap $SCRATCH_MNT
run_check $FSSUM_PROG -r $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2
echo "Silence is golden"
status=0
exit
|