[PATCH blktests 1/2] nvme/{034,035}: skip when the test target namespace has metadata

Shin'ichiro Kawasaki shinichiro.kawasaki at wdc.com
Wed Jun 25 04:45:04 PDT 2025


According to the comment in nvmet_passthru_override_id_ns() in the
kernel code drivers/nvme/target/passthru.c, "Presently the NVMEof target
code does not support sending metadata, so we must disable it here".
Because of this limitation, when TEST_DEV namespace has the format with
metadata, the passthru target namespaces created in the test cases
nvme/034 and nvme/035 have zero capacity. This makes I/Os fail and the
test cases fail.

To avoid the failures, skip the test cases when TEST_DEV has metadata.
For that purpose, introduce the function _test_dev_has_no_metadata(),
which checks the sysfs attribute metadata_bytes.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
Cc: Logan Gunthorpe <logang at deltatee.com>
---
 tests/nvme/034 | 1 +
 tests/nvme/035 | 1 +
 tests/nvme/rc  | 8 ++++++++
 3 files changed, 10 insertions(+)

diff --git a/tests/nvme/034 b/tests/nvme/034
index a4c5e97..aa6fda3 100755
--- a/tests/nvme/034
+++ b/tests/nvme/034
@@ -16,6 +16,7 @@ requires() {
 
 device_requires() {
 	_require_test_dev_is_not_nvme_multipath
+	_test_dev_has_no_metadata
 }
 
 set_conditions() {
diff --git a/tests/nvme/035 b/tests/nvme/035
index 71039ad..9eef0d7 100755
--- a/tests/nvme/035
+++ b/tests/nvme/035
@@ -20,6 +20,7 @@ device_requires() {
 	_require_test_dev_is_not_nvme_multipath
 	_require_test_dev_size "${NVME_IMG_SIZE}"
 	_test_dev_suits_xfs
+	_test_dev_has_no_metadata
 }
 
 set_conditions() {
diff --git a/tests/nvme/rc b/tests/nvme/rc
index 215a10a..bca28ba 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -161,6 +161,14 @@ _test_dev_has_metadata() {
 	return 0
 }
 
+_test_dev_has_no_metadata() {
+	if (( $(<"${TEST_DEV_SYSFS}/metadata_bytes") )); then
+		SKIP_REASONS+=("$TEST_DEV has metadata")
+		return 1
+	fi
+	return 0
+}
+
 _test_dev_disables_extended_lba() {
 	local flbas
 
-- 
2.49.0




More information about the Linux-nvme mailing list