nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: linux-nvdimm@lists.01.org
Subject: [ndctl PATCH v2 18/26] ndctl/test: Exercise sub-section sized namespace creation/deletion
Date: Sat, 27 Jul 2019 14:40:58 -0700	[thread overview]
Message-ID: <156426365799.531577.4076109633772194960.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)
In-Reply-To: <156426356088.531577.14828880045306313118.stgit@dwillia2-desk3.amr.corp.intel.com>

For kernels that have removed the section-aligned namespace constraint
validate that multiple namespaces can be created / deleted that collide
within a given section.

While this test acts on the ACPI.NFIT bus it is not marked "destructive"
because it only operates in available capacity and marks each namespace
created with a unique volume name ("subsection-test").

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/Makefile.am    |    1 +
 test/sub-section.sh |   78 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+)
 create mode 100755 test/sub-section.sh

diff --git a/test/Makefile.am b/test/Makefile.am
index 2a1e03d26f6c..decc8377258a 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -45,6 +45,7 @@ if ENABLE_DESTRUCTIVE
 TESTS +=\
 	blk-ns \
 	pmem-ns \
+	sub-section.sh \
 	dax-dev \
 	dax.sh \
 	device-dax \
diff --git a/test/sub-section.sh b/test/sub-section.sh
new file mode 100755
index 000000000000..c624fbdb2ce0
--- /dev/null
+++ b/test/sub-section.sh
@@ -0,0 +1,78 @@
+#!/bin/bash -x
+
+# SPDX-License-Identifier: GPL-2.0
+# Copyright(c) 2015-2019 Intel Corporation. All rights reserved.
+
+set -e
+
+SKIP=77
+FAIL=1
+SUCCESS=0
+
+. ./common
+
+check_min_kver "5.3" || do_skip "may lack align sub-section hotplug support"
+
+MNT=test_dax_mnt
+mkdir -p $MNT
+
+TEST_SIZE=$((16<<20))
+MIN_AVAIL=$((TEST_SIZE*4))
+MAX_NS=10
+NAME="subsection-test"
+
+ndctl list -N | jq -r ".[] | select(.name==\"subsection-test\") | .dev"
+
+rc=$FAIL
+cleanup() {
+	if [ $rc -ne $SUCCESS ]; then
+		echo "test/sub-section.sh: failed at line $1"
+	fi
+	if mountpoint -q $MNT; then
+		umount $MNT
+	fi
+	rmdir $MNT
+	# opportunistic cleanup, not fatal if these fail
+	namespaces=$($NDCTL list -N | jq -r ".[] | select(.name==\"$NAME\") | .dev")
+	for i in $namespaces
+	do
+		if ! $NDCTL destroy-namespace -f $i; then
+			echo "test/sub-section.sh: cleanup() failed to destroy $i"
+		fi
+	done
+	exit $rc
+}
+
+trap 'err $LINENO cleanup' ERR
+
+json=$($NDCTL list -R -b ACPI.NFIT)
+region=$(echo $json | jq -r "[.[] | select(.available_size >= $MIN_AVAIL)][0].dev")
+avail=$(echo $json | jq -r "[.[] | select(.available_size >= $MIN_AVAIL)][0].available_size")
+if [ -z $region ]; then
+	exit $SKIP
+fi
+
+iter=$((avail/TEST_SIZE))
+if [ $iter -gt $MAX_NS ]; then
+	iter=$MAX_NS;
+fi
+
+for i in $(seq 1 $iter)
+do
+	json=$($NDCTL create-namespace -s $TEST_SIZE --no-autorecover -r $region -n "$NAME")
+	dev=$(echo $json | jq -r ".blockdev")
+	mkfs.ext4 -b 4096 /dev/$dev
+	mount -o dax /dev/$dev $MNT
+	umount $MNT
+done
+
+namespaces=$($NDCTL list -N | jq -r ".[] | select(.name==\"$NAME\") | .dev")
+for i in $namespaces
+do
+	$NDCTL disable-namespace $i
+	$NDCTL enable-namespace $i
+	$NDCTL destroy-namespace $i -f
+done
+
+rc=$SUCCESS
+cleanup $LINENO

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  parent reply	other threads:[~2019-07-27 21:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-27 21:39 [ndctl PATCH v2 00/26] Improvements for namespace creation/interrogation Dan Williams
2019-07-27 21:39 ` [ndctl PATCH v2 01/26] ndctl/dimm: Add 'flags' field to read-labels output Dan Williams
2019-08-02 18:01   ` Verma, Vishal L
2019-08-02 18:19     ` Dan Williams
2019-07-27 21:39 ` [ndctl PATCH v2 02/26] ndctl/dimm: Add --human support to read-labels Dan Williams
2019-07-27 21:39 ` [ndctl PATCH v2 03/26] ndctl/build: Drop -Wpointer-arith Dan Williams
2019-07-27 21:39 ` [ndctl PATCH v2 04/26] ndctl/namespace: Add read-infoblock command Dan Williams
2019-07-27 21:39 ` [ndctl PATCH v2 05/26] ndctl/test: Update dax-dev to handle multiple e820 ranges Dan Williams
2019-07-27 21:39 ` [ndctl PATCH v2 06/26] ndctl/test: Make dax.sh more robust vs small namespaces Dan Williams
2019-07-27 21:39 ` [ndctl PATCH v2 07/26] ndctl/namespace: Always zero info-blocks Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 08/26] ndctl/dimm: Support small label reads/writes Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 09/26] ndctl/dimm: Minimize data-transfer for init-labels Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 10/26] ndctl/dimm: Add offset and size options to {read, write, zero}-labels Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 11/26] ndctl/dimm: Limit read-labels with --index option Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 12/26] ndctl/namespace: Minimize label data transfer for autolabel Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 13/26] ndctl/namespace: Disable autorecovery of create-namespace failures Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 14/26] ndctl/namespace: Handle 'create-namespace' in label-less mode Dan Williams
2019-08-21 12:56   ` Michal Suchánek
2019-08-21 18:03     ` Verma, Vishal L
2019-08-21 18:19       ` Michal Suchánek
2019-07-27 21:40 ` [ndctl PATCH v2 15/26] ndctl/dimm: Fix init-labels success reporting Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 16/26] ndctl/test: Fix device-dax bus-model detection Dan Williams
2019-07-27 21:40 ` [ndctl PATCH v2 17/26] ndctl/test: Checkout device-mapper + dax operation Dan Williams
2019-07-27 21:40 ` Dan Williams [this message]
2019-07-27 21:41 ` [ndctl PATCH v2 19/26] ndctl/namespace: Kill off the legacy mode names Dan Williams
2019-07-27 21:41 ` [ndctl PATCH v2 20/26] ndctl/namespace: Introduce mode-to-name and name-to-mode helpers Dan Williams
2019-07-27 21:41 ` [ndctl PATCH v2 21/26] ndctl/namespace: Validate namespace size within validate_namespace_options() Dan Williams
2019-07-27 21:41 ` [ndctl PATCH v2 22/26] ndctl/namespace: Clarify 16M minimum size requirement Dan Williams
2019-07-27 21:41 ` [ndctl PATCH v2 23/26] ndctl/namespace: Report ENOSPC when regions are full Dan Williams
2019-07-27 21:41 ` [ndctl PATCH v2 24/26] ndctl/test: Regression test 'failed to track' Dan Williams
2019-07-27 21:41 ` [ndctl PATCH v2 25/26] ndctl/namespace: Continue region search on 'missing seed' event Dan Williams
2019-07-27 21:41 ` [ndctl PATCH v2 26/26] ndctl/monitor: Allow monitor to be manually moved to the background Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=156426365799.531577.4076109633772194960.stgit@dwillia2-desk3.amr.corp.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).