@@ -10,7 +10,8 @@ TESTS =\
clear.sh \
dax-errors.sh \
btt-check.sh \
- label-compat.sh
+ label-compat.sh \
+ blk-exhaust.sh
check_PROGRAMS =\
libndctl \
new file mode 100755
@@ -0,0 +1,47 @@
+#!/bin/bash -x
+NDCTL="../ndctl/ndctl"
+BUS="-b nfit_test.0"
+BUS1="-b nfit_test.1"
+rc=77
+
+set -e
+
+err() {
+ echo "test/label-compat.sh: failed at line $1"
+ 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)" ]]
+}
+
+check_min_kver "4.11" || { echo "kernel $KVER may lack blk-exhaustion fix"; exit $rc; }
+
+set -e
+trap 'err $LINENO' ERR
+
+# setup (reset nfit_test dimms)
+modprobe nfit_test
+$NDCTL disable-region $BUS all
+$NDCTL zero-labels $BUS all
+$NDCTL enable-region $BUS all
+
+# if the kernel accounting is correct we should be able to create two
+# pmem and two blk namespaces on nfit_test.0
+rc=1
+$NDCTL create-namespace $BUS -t pmem
+$NDCTL create-namespace $BUS -t pmem
+$NDCTL create-namespace $BUS -t blk -m raw
+$NDCTL create-namespace $BUS -t blk -m raw
+
+# clearnup and exit
+$NDCTL disable-region $BUS all
+$NDCTL disable-region $BUS1 all
+modprobe -r nfit_test
+
+exit 0
Test that the kernel properly accounts for all blk allocations when all aliased pmem is allocated before un-aliased blk. This targets a regression that was introduced with commit a1f3e4d6a0c3 ("libnvdimm, region: update nd_region_available_dpa() for multi-pmem support"). Cc: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- test/Makefile.am | 3 ++- test/blk-exhaust.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100755 test/blk-exhaust.sh