Skip to contentSkip to conversation

test/clear.sh: test to making sure cleared badblocks don't reappear

PATCH Superseded Vishal Verma 1 participant 1 message Sep 30, 2016 libnvdimm: non-volatile memory device

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Vishal Verma

author maintainer
#0 lore raw

PATCH v2 1/1 test/clear.sh: test to making sure cleared badblocks don't reappear

Quoted 1 line

From v4.9 onwards, cleared badblocks won't reappear on an ARS or simply

after disabling/re-enabling a namespace. Add a test to make sure this doesn't regress.

---

v2: Add a test to run the stale entries test only for kernels >= 4.9.0

 test/clear.sh | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
test/clear.sh +21 -0
index 7765c10..ddae0e6 100755
@@ -13,6 +13,15 @@ err() {
 	exit $rc
 }
 
+check_min_kver()
+{
+	local ver="$1"
+	${KVER:=$(uname -r)}
+
+	[ -n "$ver" ] || return 1
+	[[ "$ver" == "$(echo -e "$ver\n$KVER" | sort -V | head -1)" ]]
+}
+
 eval $(uname -r | awk -F. '{print "maj="$1 ";" "min="$2}')
 if [ $maj -lt 4 ]; then
 	echo "kernel $maj.$min lacks clear poison support"
@@ -69,6 +78,18 @@ if read sector len < /sys/block/$blockdev/badblocks; then
 	echo "fail: $LINENO" && exit 1
 fi
 
+if check_min_kver "4.9.0"; then
+	# check for re-appearance of stale badblocks from poison_list
+	$NDCTL disable-region $BUS all
+	$NDCTL enable-region $BUS all
+
+	# since we have cleared the errors, a disable/reenable shouldn't bring them back
+	if read sector len < /sys/block/$blockdev/badblocks; then
+		# fail if reading badblocks returns data
+		echo "fail: $LINENO" && exit 1
+	fi
+fi
+
 $NDCTL disable-region $BUS all
 $NDCTL disable-region $BUS1 all
 modprobe -r nfit_test
Signature · 6 lines
2.7.4

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