diff --git a/tests/fsck-tests/020-bad-free-space-cache/default_case.raw.xz b/tests/fsck-tests/020-bad-free-space-cache/default_case.raw.xz
new file mode 100644
index 0000000000000000000000000000000000000000..5e08de426c5cc5faa9ccd430432b9c37f4e072ff
GIT binary patch
diff --git a/tests/fsck-tests/020-bad-free-space-cache/test.sh b/tests/fsck-tests/020-bad-free-space-cache/test.sh
new file mode 100755
index 0000000..8524d2a
--- /dev/null
+++ b/tests/fsck-tests/020-bad-free-space-cache/test.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+source $TOP/tests/common
+
+check_prereq btrfs
+
+image=$(extract_image "./default_case.raw.xz")
+run_check_stdout $TOP/btrfs check "$image" |\
+	grep -q "csum mismatch on free space cache" ||\
+	_fail "btrfs check didn't detect free space cache error"
+run_check $TOP/btrfs check --clear-space-cache "$image"
+run_check_stdout $TOP/btrfs check "$image" 2>&1 |
+	grep -q "csum mismatch on free space cache" &&
+	_fail "unexpected error message in the output"
+
+rm -f "$image"
