On Mon, Apr 17, 2017 at 03:14:15PM +0800, Xiong Zhou wrote: > Regression case that one can write to read-only > file in a DAX mountpoint. > > Signed-off-by: Xiong Zhou <xzhou@xxxxxxxxxx> > --- <> > diff --git a/src/t_mmap_write_ro.c b/src/t_mmap_write_ro.c > new file mode 100644 > index 0000000..08ec1d0 > --- /dev/null > +++ b/src/t_mmap_write_ro.c > @@ -0,0 +1,77 @@ > +#include <stdio.h> > +#include <stdlib.h> > +#include <string.h> > +#include <fcntl.h> > +#include <unistd.h> > +#include <libgen.h> > +#include <errno.h> > +#include <sys/mman.h> > + > +void > +err_exit(char *op) > +{ > + fprintf(stderr, "%s: %s\n", op, strerror(errno)); > + exit(1); > +} > + > +int > +main(int argc, char **argv) > +{ > + int fd, pfd, ret; > + char *buf; > + /* gcc -O2 will optimize foo's storage, preventing > + * reproduce this issue. > + * foo is never actually used after fault in value stored. > + */ > + volatile char foo __attribute__((__unused__)); > + int pagesize = getpagesize(); > + > + if (argc < 2) { > + printf("Usage: %s <file> <pmem file>\n", basename(argv[0])); This comparison should be: + if (argc < 3) { $ ./src/t_mmap_write_ro Usage: t_mmap_write_ro <file> <pmem file> $ ./src/t_mmap_write_ro a open: No such file or directory -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html