anitazha / rpms / ndctl

Forked from rpms/ndctl a year ago
Clone

Blame SOURCES/0076-ndctl-test-Fix-support-for-missing-dax_pmem_compat-m.patch

e0018b
From 9bfb567715d1b45e6598e6b38bef531312c72db3 Mon Sep 17 00:00:00 2001
e0018b
From: Dan Williams <dan.j.williams@intel.com>
e0018b
Date: Wed, 5 Jan 2022 13:32:21 -0800
e0018b
Subject: [PATCH 076/217] ndctl/test: Fix support for missing dax_pmem_compat
e0018b
 module
e0018b
e0018b
The kernel is moving to drop CONFIG_DEV_DAX_PMEM_COMPAT. Update
e0018b
ndctl_test_init() to not error out if dax_pmem_compat is missing. It seems
e0018b
that the original implementation of support for missing dax_pmem_compat was
e0018b
broken, or since that time newer versions of kmod_module_new_from_name() no
e0018b
longer fail when the module is missing.
e0018b
e0018b
Link: https://lore.kernel.org/r/164141834155.3990253.5388773351209410262.stgit@dwillia2-desk3.amr.corp.intel.com
e0018b
Fixes: b7991dbc22f3 ("ndctl/test: Relax dax_pmem_compat requirement")
e0018b
Tested-by: Alison Schofield <alison.schofield@intel.com>
e0018b
Tested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
e0018b
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
e0018b
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
e0018b
---
e0018b
 test/core.c | 25 +++++++++++--------------
e0018b
 1 file changed, 11 insertions(+), 14 deletions(-)
e0018b
e0018b
diff --git a/test/core.c b/test/core.c
e0018b
index dc1405d..5d1aa23 100644
e0018b
--- a/test/core.c
e0018b
+++ b/test/core.c
e0018b
@@ -120,7 +120,6 @@ int ndctl_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
e0018b
 		"nfit",
e0018b
 		"device_dax",
e0018b
 		"dax_pmem",
e0018b
-		"dax_pmem_core",
e0018b
 		"dax_pmem_compat",
e0018b
 		"libnvdimm",
e0018b
 		"nd_btt",
e0018b
@@ -180,29 +179,27 @@ int ndctl_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
e0018b
 		/*
e0018b
 		 * Skip device-dax bus-model modules on pre-v5.1
e0018b
 		 */
e0018b
-		if ((strcmp(name, "dax_pmem_core") == 0
e0018b
-				|| strcmp(name, "dax_pmem_compat") == 0)
e0018b
-				&& !ndctl_test_attempt(test,
e0018b
-					KERNEL_VERSION(5, 1, 0)))
e0018b
+		if ((strcmp(name, "dax_pmem_compat") == 0) &&
e0018b
+		    !ndctl_test_attempt(test, KERNEL_VERSION(5, 1, 0)))
e0018b
 			continue;
e0018b
 
e0018b
 retry:
e0018b
 		rc = kmod_module_new_from_name(*ctx, name, mod);
e0018b
-
e0018b
-		/*
e0018b
-		 * dax_pmem_compat is not required, missing is ok,
e0018b
-		 * present-but-production is not ok.
e0018b
-		 */
e0018b
-		if (rc && strcmp(name, "dax_pmem_compat") == 0)
e0018b
-			continue;
e0018b
-
e0018b
 		if (rc) {
e0018b
-			log_err(&log_ctx, "%s.ko: missing\n", name);
e0018b
+			log_err(&log_ctx, "failed to interrogate %s.ko\n",
e0018b
+				name);
e0018b
 			break;
e0018b
 		}
e0018b
 
e0018b
 		path = kmod_module_get_path(*mod);
e0018b
 		if (!path) {
e0018b
+			/*
e0018b
+			 * dax_pmem_compat is not required, missing is
e0018b
+			 * ok, present-but-production is not ok.
e0018b
+			 */
e0018b
+			if (strcmp(name, "dax_pmem_compat") == 0)
e0018b
+				continue;
e0018b
+
e0018b
 			if (family != NVDIMM_FAMILY_INTEL &&
e0018b
 			    (strcmp(name, "nfit") == 0 ||
e0018b
 			     strcmp(name, "nd_e820") == 0))
e0018b
-- 
e0018b
2.27.0
e0018b