Skip to contentSkip to conversation

xfs: fix incorrect argument count check

PATCH New Ross Zwisler 1 participant 2 messages Apr 26, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 xfs: fix incorrect argument count check

t_mmap_dio.c actually requires 4 arguments, not 3 as the current check enforces:

	# ./src/t_mmap_dio
	usage: t_mmap_dio <src file> <dest file> <size> <msg>
	# ./src/t_mmap_dio  one two three
	open src(No such file or directory) len 0 (null)
Fixes 456581661b4d ("xfs: test per-inode DAX flag by IO")
---
 src/t_mmap_dio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/t_mmap_dio.c +1 -1
index 69b9ca8..6c8ca1a 100644
@@ -39,7 +39,7 @@ int main(int argc, char **argv)
 	char *dfile;
 	unsigned long len, opt;
 
-	if (argc < 4)
+	if (argc < 5)
 		usage(basename(argv[0]));
 
 	while ((opt = getopt(argc, argv, "b")) != -1)
Signature · 7 lines
2.9.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw

PATCH v3 2/2 dax: add regression test for stale mmap reads

This adds a regression test for the following kernel patch:

dax: fix data corruption due to stale mmap reads

The above patch fixes an issue where users of DAX can suffer data corruption from stale mmap reads via the following sequence:

- open an mmap over a 2MiB hole

- read from a 2MiB hole, faulting in a 2MiB zero page

- write to the hole with write(3p). The write succeeds but we incorrectly leave the 2MiB zero page mapping intact.

- via the mmap, read the data that was just written. Since the zero page mapping is still intact we read back zeroes instead of the new data.

---
 .gitignore             |  1 +
 src/Makefile           |  2 +-
 src/t_mmap_stale_pmd.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/427      | 59 ++++++++++++++++++++++++++++++++++++++++
 tests/generic/427.out  |  2 ++
 tests/generic/group    |  1 +
 6 files changed, 137 insertions(+), 1 deletion(-)
 create mode 100644 src/t_mmap_stale_pmd.c
 create mode 100755 tests/generic/427
 create mode 100644 tests/generic/427.out
.gitignore +1 -0
index ded4a61..4d64414 100644
@@ -134,6 +134,7 @@
 /src/renameat2
 /src/t_rename_overwrite
 /src/t_mmap_dio
+/src/t_mmap_stale_pmd
 
 # dmapi/ binaries
 /dmapi/src/common/cmd/read_invis
src/Makefile +1 -1
index abfd873..f1338ca 100644
@@ -12,7 +12,7 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \
 	godown resvtest writemod makeextents itrash rename \
 	multi_open_unlink dmiperf unwritten_sync genhashnames t_holes \
 	t_mmap_writev t_truncate_cmtime dirhash_collide t_rename_overwrite \
-	holetest t_truncate_self t_mmap_dio af_unix
+	holetest t_truncate_self t_mmap_dio af_unix t_mmap_stale_pmd
 
 LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
 	preallo_rw_pattern_writer ftrunc trunc fs_perms testx looptest \
src/t_mmap_stale_pmd.c new file +73 -0

73 lines not on this page · raw message

tests/generic/427 new file +59 -0

59 lines not on this page · raw message

tests/generic/427.out new file +2 -0
new file mode 100644
index 0000000..61295e5
@@ -0,0 +1,2 @@
+QA output created by 427
+Silence is golden
tests/generic/group +1 -0
index f29009c..06f6e9d 100644
@@ -429,3 +429,4 @@
 424 auto quick
 425 auto quick attr
 426 auto quick exportfs
+427 auto quick
Signature · 7 lines
2.9.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>