blob: 16fc052ccebca448c5bf018c7251417497dbc901 (
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
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022 Fujitsu Limited. All Rights Reserved.
#
# FS QA Test No. 554
#
# Create a filesystem which contains an inode with a lower number
# than the root inode. Set the lower number to a dump file as the root inode
# and ensure that 'xfsrestore -x' handles this wrong inode.
#
. ./common/preamble
_begin_fstest auto quick dump prealloc
# Import common functions.
. ./common/dump
_supported_fs xfs
_fixed_by_git_commit xfsdump \
"XXXXXXXXXXXX xfsrestore: fix rootdir due to xfsdump bulkstat misuse"
_require_xfs_io_command "falloc"
_require_scratch
_require_xfsrestore_xflag
# Create a filesystem which contains a fake root inode
inums=($(_scratch_xfs_create_fake_root))
root_inum=${inums[0]}
fake_inum=${inums[1]}
# Now try a dump and restore. Cribbed from xfs/068
_create_dumpdir_stress
echo -n "Before: " >> $seqres.full
_count_dumpdir_files | tee $tmp.before >> $seqres.full
_do_dump_file
# Set the wrong root inode number to the dump file
# as problematic xfsdump used to do.
$here/src/fake-dump-rootino $dump_file $fake_inum
_do_restore_file -x | \
sed -e "s/rootino #${fake_inum}/rootino #FAKENO/g" \
-e "s/# to ${root_inum}/# to ROOTNO/g" \
-e "/entries processed$/s/[0-9][0-9]*/NUM/g"
echo -n "After: " >> $seqres.full
_count_restoredir_files | tee $tmp.after >> $seqres.full
diff -u $tmp.before $tmp.after
# success, all done
status=0
exit
|