diff options
| author | 2015-08-04 14:10:48 +1000 | |
|---|---|---|
| committer | 2015-08-04 14:10:48 +1000 | |
| commit | 0e2a022a670b21769dc4cb7c9a0e24cb38c25b99 (patch) | |
| tree | fdbf383fcb2a71f60bb4bb6d3cd686db73cc80e0 /tests/btrfs/089 | |
| parent | 46e088e7be5cafd88dc896fd1440b20c1bf6113b (diff) | |
| download | xfstests-dev-0e2a022a670b21769dc4cb7c9a0e24cb38c25b99.tar.gz | |
btrfs: test premature submount unmounting when deleting default subvolume
Add a regression test for a problem where attempting to delete the
default subvolume would fail (as expected), but not until after all
submounts under the subvolume were unmounted.
Signed-off-by: Omar Sandoval <osandov@osandov.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'tests/btrfs/089')
| -rwxr-xr-x | tests/btrfs/089 | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/tests/btrfs/089 b/tests/btrfs/089 new file mode 100755 index 00000000..53726982 --- /dev/null +++ b/tests/btrfs/089 @@ -0,0 +1,79 @@ +#! /bin/bash +# 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". +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 Omar Sandoval. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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. +_need_to_be_root +_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 |
