mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
1ff4192932
Fully scripted conversion, see script in initial SPDX license commit message. Signed-off-by: Dave Chinner <dchinner@redhat.com>
66 lines
1.7 KiB
Bash
Executable File
66 lines
1.7 KiB
Bash
Executable File
#! /bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (C) 2014 SUSE Linux Products GmbH. All Rights Reserved.
|
|
#
|
|
# FS QA Test No. btrfs/058
|
|
#
|
|
# Regression test for a btrfs issue where we create a RO snapshot to use for
|
|
# a send operation which fails with a -ESTALE error, due to the presence of
|
|
# orphan inodes accessible through the snapshot's commit root but no longer
|
|
# present through the main root.
|
|
#
|
|
# This issue is fixed by the following linux kernel btrfs patch:
|
|
#
|
|
# Btrfs: update commit root on snapshot creation after orphan cleanup
|
|
#
|
|
seq=`basename $0`
|
|
seqres=$RESULT_DIR/$seq
|
|
echo "QA output created by $seq"
|
|
|
|
tmp=/tmp/$$
|
|
status=1 # failure is the default!
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
_cleanup()
|
|
{
|
|
if [ ! -z $XFS_IO_PID ]; then
|
|
kill $XFS_IO_PID > /dev/null 2>&1
|
|
fi
|
|
rm -fr $tmp
|
|
}
|
|
|
|
# get standard environment, filters and checks
|
|
. ./common/rc
|
|
. ./common/filter
|
|
|
|
# real QA test starts here
|
|
_supported_fs btrfs
|
|
_supported_os Linux
|
|
_require_scratch
|
|
_require_xfs_io_command "-T"
|
|
|
|
rm -f $seqres.full
|
|
|
|
_scratch_mkfs >/dev/null 2>&1
|
|
_scratch_mount
|
|
|
|
# Create a tmpfile file, write some data to it and leave it open, so that our
|
|
# main subvolume has an orphan inode item.
|
|
$XFS_IO_PROG -T $SCRATCH_MNT >>$seqres.full 2>&1 < <(
|
|
echo "pwrite 0 65536"
|
|
read
|
|
) &
|
|
XFS_IO_PID=$!
|
|
|
|
# Give it some time to the xfs_io process to create the tmpfile.
|
|
sleep 3
|
|
|
|
# With the tmpfile open, create a RO snapshot and use it for a send operation.
|
|
# The send operation used to fail with -ESTALE due to the presence of the
|
|
# orphan inode.
|
|
_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap
|
|
_run_btrfs_util_prog send -f /dev/null $SCRATCH_MNT/mysnap
|
|
|
|
status=0
|
|
exit
|