diff --git a/tests/fsck-tests/022-qgroup-rescan-halfway/qgroup_rescan_halfway.raw.xz b/tests/fsck-tests/022-qgroup-rescan-halfway/qgroup_rescan_halfway.raw.xz
new file mode 100644
index 0000000000000000000000000000000000000000..09a2c716e79586961ae1ed264049c6c361ff173f
GIT binary patch
diff --git a/tests/fsck-tests/022-qgroup-rescan-halfway/test.sh b/tests/fsck-tests/022-qgroup-rescan-halfway/test.sh
new file mode 100755
index 0000000..eaeb1fc
--- /dev/null
+++ b/tests/fsck-tests/022-qgroup-rescan-halfway/test.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# check whether btrfsck can detect running qgroup rescan
+
+source $TOP/tests/common
+
+check_prereq btrfs
+
+for img in $(find . \( -iname '*.img' -o	\
+			-iname '*.img.xz' -o 	\
+			-iname '*.raw' -o 	\
+			-iname '*.raw.xz' \) | sort)
+do
+	image=$(extract_image $img)
+	run_check_stdout $TOP/btrfs check "$image" 2>&1 |\
+		grep -q "Counts for qgroup id"
+	if [ $? -eq 0 ]; then
+		rm -f "$image"
+		_fail "Btrfsck doesn't detect rescan correctly"
+	fi
+	rm -f "$image"
+done
