Skip to contentSkip to conversation

ndctl, test: add start/wait scrub to injection tests

PATCH In review Vishal Verma 2 participants 2 messages Jun 28, 2018 – Jun 30, 2018 libnvdimm: non-volatile memory device

lore
Share & tools
lore

Vishal Verma

author maintainer
#0 lore raw

PATCH 1/1 ndctl, test: add start/wait scrub to injection tests

A number of tests that perform error injection were missing the start/wait scrub workaround needed for nfit_test namespaces, causing these tests to ocassionally fail. Fix it by starting and waiting for a scrub after injection in these remaining places.

---
 test/btt-errors.sh   | 2 ++
 test/clear.sh        | 1 +
 test/inject-error.sh | 1 +
 3 files changed, 4 insertions(+)
test/btt-errors.sh +2 -0
index e9cc209..cb35865 100755
@@ -115,6 +115,7 @@ bb_inj=$((dataoff/512))
 
 # inject badblocks for one page at the start of the file
 $NDCTL inject-error --block="$bb_inj" --count=8 $dev
+$NDCTL start-scrub && $NDCTL wait-scrub
 
 force_raw 0
 mount -o nodelalloc "/dev/$blockdev" $MNT
@@ -148,6 +149,7 @@ map=$(hexdump -s 96 -n 4 "/dev/$raw_bdev" | head -1 | cut -d' ' -f2-)
 map=$(tr -d ' ' <<< "0x${map#* }${map%% *}")
 bb_inj=$((map/512))
 $NDCTL inject-error --block="$bb_inj" --count=1 $dev
+$NDCTL start-scrub && $NDCTL wait-scrub
 force_raw 0
 
 # make sure reading the first block of the namespace fails
test/clear.sh +1 -0
index 6cc43db..17d5bed 100755
@@ -41,6 +41,7 @@ err_sector="$(((size/512) / 2))"
 err_count=8
 if ! read sector len < /sys/block/$blockdev/badblocks; then
 	$NDCTL inject-error --block="$err_sector" --count=$err_count $dev
+	$NDCTL start-scrub && $NDCTL wait-scrub
 fi
 read sector len < /sys/block/$blockdev/badblocks
 [ $((sector * 2)) -ne $((size /512)) ] && echo "fail: $LINENO" && exit 1
test/inject-error.sh +1 -0
index 7bda35b..49e68b3 100755
@@ -77,6 +77,7 @@ do_tests()
 
 	# inject normally
 	$NDCTL inject-error --block=$err_block --count=$err_count $dev
+	$NDCTL start-scrub && $NDCTL wait-scrub
 	check_status "$err_block" "$err_count"
 	if read -r sector len < /sys/block/$blockdev/badblocks; then
 		test "$sector" -eq "$err_block"
Signature · 6 lines
2.14.4

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Tested-by on v1 1/1
#1 lore raw
Quoted 7 lines · Vishal Verma

A number of tests that perform error injection were missing the start/wait scrub workaround needed for nfit_test namespaces, causing these tests to ocassionally fail. Fix it by starting and waiting for a scrub after injection in these remaining places.

Looks good.

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm