#! /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