mirror of
https://github.com/versity/scoutfs.git
synced 2025-12-23 05:25:18 +00:00
scoutfs-tests: add persistent-item-vers test
Add a test which makes sure that we don't initialize the lock server's write version to a version less than existing log tree items. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
4
tests/golden/persistent-item-vers
Normal file
4
tests/golden/persistent-item-vers
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
== advance lock version by creating unrelated files
|
||||||
|
== create before file version
|
||||||
|
== verify before version, touch after version
|
||||||
|
== verify after version
|
||||||
@@ -19,6 +19,7 @@ dirent-consistency.sh
|
|||||||
lock-ex-race-processes.sh
|
lock-ex-race-processes.sh
|
||||||
lock-conflicting-batch-commit.sh
|
lock-conflicting-batch-commit.sh
|
||||||
cross-mount-data-free.sh
|
cross-mount-data-free.sh
|
||||||
|
persistent-item-vers.sh
|
||||||
setup-error-teardown.sh
|
setup-error-teardown.sh
|
||||||
mount-unmount-race.sh
|
mount-unmount-race.sh
|
||||||
createmany-parallel-mounts.sh
|
createmany-parallel-mounts.sh
|
||||||
|
|||||||
45
tests/tests/persistent-item-vers.sh
Normal file
45
tests/tests/persistent-item-vers.sh
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#
|
||||||
|
# make sure we increment item vers from persistent items
|
||||||
|
#
|
||||||
|
# Make sure that new locks are given a write_version that is greater
|
||||||
|
# than all existing items so that new items with greater versions are
|
||||||
|
# preferred over old versions with lesser versions.
|
||||||
|
#
|
||||||
|
# We create an inode in a mount that has been granted multiple locks,
|
||||||
|
# which could lead to a greater version. We then modify the item very
|
||||||
|
# early in a mount so that it's lock could have a lesser version.
|
||||||
|
#
|
||||||
|
# This was all written to test a bug where the write_version was
|
||||||
|
# statically initialized as the module was inserted.
|
||||||
|
#
|
||||||
|
|
||||||
|
t_require_commands mkdir createmany touch stat sleep diff
|
||||||
|
|
||||||
|
echo "== advance lock version by creating unrelated files"
|
||||||
|
mkdir "$T_D0/a"
|
||||||
|
createmany -o "$T_D0/a/file-" 10240 2>&1 > /dev/null
|
||||||
|
mkdir "$T_D0/b"
|
||||||
|
createmany -o "$T_D0/b/file-" 10240 2>&1 > /dev/null
|
||||||
|
|
||||||
|
echo "== create before file version"
|
||||||
|
touch "$T_D0/file"
|
||||||
|
stat "$T_D0/file" | grep Modify: > "$T_TMP.before"
|
||||||
|
|
||||||
|
# remount, possibly wiping the lock server's write_version
|
||||||
|
t_reinsert_remount_all
|
||||||
|
|
||||||
|
echo "== verify before version, touch after version"
|
||||||
|
stat "$T_D0/file" | grep Modify: > "$T_TMP.b"
|
||||||
|
diff -u "$T_TMP.before" "$T_TMP.b"
|
||||||
|
sleep 1
|
||||||
|
touch "$T_D0/file"
|
||||||
|
stat "$T_D0/file" | grep Modify: > "$T_TMP.after"
|
||||||
|
|
||||||
|
# remount and make sure we got the newest version
|
||||||
|
t_remount_all
|
||||||
|
|
||||||
|
echo "== verify after version"
|
||||||
|
stat "$T_D0/file" | grep Modify: > "$T_TMP.a"
|
||||||
|
diff -u "$T_TMP.after" "$T_TMP.a"
|
||||||
|
|
||||||
|
t_pass
|
||||||
Reference in New Issue
Block a user