btrfs-progs: tests: check that qgroup show does not crash on stale qgroups

Create subvolumes and delete every N-th to generate output where we can
also see how the stale qgroups are placed (at the end).

Issue: #687
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2023-10-09 17:39:16 +02:00
parent 8473ab8131
commit 777b1d8c27

View File

@ -0,0 +1,22 @@
#!/bin/bash
# Create a stale qgroup and check that 'qgroup show' does not crash when trying
# to print the path
source "$TEST_TOP/common" || exit
setup_root_helper
prepare_test_dev
run_check_mkfs_test_dev
run_check_mount_test_dev
count=24
run_check $SUDO_HELPER dd if=/dev/zero of="$TEST_MNT"/file bs=1M count=1
run_check $SUDO_HELPER "$TOP/btrfs" quota enable "$TEST_MNT"
for i in `seq $count`; do
run_check $SUDO_HELPER "$TOP/btrfs" subvolume create "$TEST_MNT/subv${i}"
if [ "$(($i % 2))" = "0" ]; then
run_check $SUDO_HELPER "$TOP/btrfs" subvolume delete "$TEST_MNT/subv${i}"
fi
done
run_check $SUDO_HELPER "$TOP/btrfs" qgroup show --sort path "$TEST_MNT"
run_check_umount_test_dev