2016-03-17 13:22:24 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2016-05-11 23:50:36 +00:00
|
|
|
# Verify that subvolume sync waits until the subvolume is cleaned and does not
|
2016-03-17 13:22:24 +00:00
|
|
|
# crash at the end
|
|
|
|
|
2018-02-08 06:34:19 +00:00
|
|
|
source "$TEST_TOP/common"
|
2016-03-17 13:22:24 +00:00
|
|
|
|
|
|
|
check_prereq mkfs.btrfs
|
|
|
|
check_prereq btrfs
|
|
|
|
|
|
|
|
setup_root_helper
|
|
|
|
|
2017-03-13 17:07:28 +00:00
|
|
|
prepare_test_dev
|
2019-06-05 17:09:38 +00:00
|
|
|
run_check_mkfs_test_dev
|
2017-03-13 17:07:28 +00:00
|
|
|
run_check_mount_test_dev
|
2018-03-23 15:34:30 +00:00
|
|
|
run_check $SUDO_HELPER chmod a+rw "$TEST_MNT"
|
2016-03-17 13:22:24 +00:00
|
|
|
|
2018-03-23 15:34:30 +00:00
|
|
|
cd "$TEST_MNT"
|
2016-03-17 13:22:24 +00:00
|
|
|
|
|
|
|
for i in `seq 5`; do
|
|
|
|
run_check dd if=/dev/zero of=file$i bs=1M count=10
|
|
|
|
done
|
|
|
|
|
|
|
|
# 128 is minimum
|
|
|
|
for sn in `seq 130`;do
|
2018-03-23 15:34:30 +00:00
|
|
|
run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot . snap$sn
|
2016-03-17 13:22:24 +00:00
|
|
|
for i in `seq 10`; do
|
2018-03-23 15:34:30 +00:00
|
|
|
run_check dd if=/dev/zero of="snap$sn/file$i" bs=1M count=1
|
2016-03-17 13:22:24 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2018-03-23 15:34:30 +00:00
|
|
|
run_check $SUDO_HELPER "$TOP/btrfs" subvolume list .
|
|
|
|
run_check $SUDO_HELPER "$TOP/btrfs" subvolume list -d .
|
2016-03-17 13:22:24 +00:00
|
|
|
|
2020-04-07 07:18:44 +00:00
|
|
|
idtodel=`$SUDO_HELPER "$TOP/btrfs" inspect-internal rootid snap3`
|
2016-03-17 13:22:24 +00:00
|
|
|
|
|
|
|
# delete, sync after some time
|
2018-03-23 15:34:30 +00:00
|
|
|
run_check $SUDO_HELPER "$TOP/btrfs" subvolume delete -c snap*
|
|
|
|
{ sleep 5; run_check "$TOP/btrfs" filesystem sync "$TEST_MNT"; } &
|
2016-03-17 13:22:24 +00:00
|
|
|
|
2018-03-23 15:34:30 +00:00
|
|
|
run_check $SUDO_HELPER "$TOP/btrfs" subvolume sync .
|
2016-03-17 13:22:24 +00:00
|
|
|
|
2018-03-23 15:34:30 +00:00
|
|
|
run_check "$TOP/btrfs" filesystem sync "$TEST_MNT"
|
|
|
|
run_check $SUDO_HELPER "$TOP/btrfs" subvolume list -d .
|
2016-03-17 13:22:24 +00:00
|
|
|
|
|
|
|
wait
|
|
|
|
cd ..
|
|
|
|
|
2017-03-13 17:07:28 +00:00
|
|
|
run_check_umount_test_dev
|