diff mbox series

[ndctl,3/4] ndctl/test: Fix device-dax mremap() test

Message ID 161052210936.1804207.17896246772670985157.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State New
Headers show
Series ndctl/test: softoffline, mremap, and misc fixups | expand

Commit Message

Williams, Dan J Jan. 13, 2021, 7:15 a.m. UTC
The test_dax_remap() test is a regression check for mishandling of mremap()
in the presence of pmd_devmap(). My understanding is that it was a fuzzing
condition not something an application would want to do in practice.

On recent kernels with commit 73d5e0629919 ("mremap: check if it's possible
to split original vma"), the test fails for device-dax. That seems an
equally acceptable result of attempting this remap, so update the test
rather than ask the kernel to preserve the old behaviour.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/dax-pmd.c |    5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/test/dax-pmd.c b/test/dax-pmd.c
index b1251db63041..7648e348b0a6 100644
--- a/test/dax-pmd.c
+++ b/test/dax-pmd.c
@@ -69,6 +69,11 @@  int test_dax_remap(struct ndctl_test *test, int dax_fd, unsigned long align, voi
 
 	remap = mremap(addr, REMAP_SIZE, REMAP_SIZE, MREMAP_MAYMOVE|MREMAP_FIXED, anon);
 
+	if (remap == MAP_FAILED) {
+		fprintf(stderr, "%s: mremap failed, that's ok too\n", __func__);
+		return 0;
+	}
+
 	if (remap != anon) {
 		rc = -ENXIO;
 		perror("mremap");