diff mbox

ndctl: fix a pmd test case

Message ID 20151122051824.11455.39488.stgit@dwillia2-desk3.jf.intel.com (mailing list archive)
State Accepted
Commit cd1618c7cf3b
Headers show

Commit Message

Dan Williams Nov. 22, 2015, 5:18 a.m. UTC
With the pending kernel fixes the O_DIRECT read test is no longer
crashing the kernel.  Fix the buffer size and mishandling of the file
position.

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

Patch

diff --git a/lib/test-dax-pmd.c b/lib/test-dax-pmd.c
index 7ea4e6c7bdb6..0fee7bee8817 100644
--- a/lib/test-dax-pmd.c
+++ b/lib/test-dax-pmd.c
@@ -106,12 +106,12 @@  static int test_pmd(int fd)
 			break;
 		case 1: /* test O_DIRECT of pre-faulted address */
 			sprintf(addr, "odirect data");
-			if (write(fd2, addr, 4096) != 4096) {
+			if (pwrite(fd2, addr, 4096, 0) != 4096) {
 				faili(i);
 				rc = -ENXIO;
 			}
 			((char *) buf)[0] = 0;
-			read(fd2, buf, sizeof(buf));
+			pread(fd2, buf, 4096, 0);
 			if (strcmp(buf, "odirect data") != 0) {
 				faili(i);
 				rc = -ENXIO;