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>
64 lines
1.6 KiB
Bash
Executable File
64 lines
1.6 KiB
Bash
Executable File
#! /bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (c) 2015 Omar Sandoval. All Rights Reserved.
|
|
#
|
|
# FS QA Test 089
|
|
#
|
|
# Test deleting the default subvolume, making sure that submounts under it are
|
|
# not unmounted prematurely. This is a regression test for Linux commit "Btrfs:
|
|
# don't invalidate root dentry when subvolume deletion fails".
|
|
#
|
|
seq=`basename $0`
|
|
seqres=$RESULT_DIR/$seq
|
|
echo "QA output created by $seq"
|
|
|
|
here=`pwd`
|
|
tmp=/tmp/$$
|
|
status=1 # failure is the default!
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
_cleanup()
|
|
{
|
|
cd /
|
|
rm -f $tmp.*
|
|
}
|
|
|
|
# get standard environment, filters and checks
|
|
. ./common/rc
|
|
. ./common/filter
|
|
. ./common/filter.btrfs
|
|
|
|
# real QA test starts here
|
|
|
|
# Modify as appropriate.
|
|
_supported_fs btrfs
|
|
_supported_os Linux
|
|
_require_scratch
|
|
|
|
rm -f $seqres.full
|
|
|
|
_scratch_mkfs >>$seqres.full 2>&1
|
|
_scratch_mount
|
|
|
|
# Create a new subvolume and make it the default subvolume.
|
|
$BTRFS_UTIL_PROG subvolume create "$SCRATCH_MNT/testvol" >>$seqres.full 2>&1 \
|
|
|| _fail "couldn't create subvol"
|
|
testvol_id=$(_btrfs_get_subvolid "$SCRATCH_MNT" testvol)
|
|
$BTRFS_UTIL_PROG subvolume set-default $testvol_id "$SCRATCH_MNT" >>$seqres.full 2>&1 \
|
|
|| _fail "couldn't set default"
|
|
|
|
# Bind-mount a directory under the default subvolume.
|
|
mkdir "$SCRATCH_MNT/testvol/testdir"
|
|
mkdir "$SCRATCH_MNT/testvol/mnt"
|
|
mount --bind "$SCRATCH_MNT/testvol/testdir" "$SCRATCH_MNT/testvol/mnt"
|
|
|
|
# Now attempt to delete the default subvolume.
|
|
$BTRFS_UTIL_PROG subvolume delete "$SCRATCH_MNT/testvol" >>$seqres.full 2>&1
|
|
|
|
# Unmount the bind mount, which should still be alive.
|
|
$UMOUNT_PROG "$SCRATCH_MNT/testvol/mnt"
|
|
|
|
echo "Silence is golden"
|
|
status=0
|
|
exit
|