Skip to content

Commit

Permalink
direct_io/diotest4: drop MAP_FIXED
Browse files Browse the repository at this point in the history
Hongzhi reports that this test is failing on mips64 with 5.1+:
  diotest4 10 TBROK : diotest4.c:368: can't mmap file: Invalid argument
  diotest4 11 TBROK : diotest4.c:368: Remaining cases broken
I could reproduce it on emulated 5kc-malta, running 5.2.0-rc7.

Test is trying to map into area immediately following heap as MAP_SHARED,
but it used wrong alignment (fixed by 'lapi/mmap.h: include config.h').

Usage of MAP_FIXED seems unnecessary, so drop that too and let the kernel
pick an address.

Reported-by: Hongzhi.Song <hongzhi.song@windriver.com>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
  • Loading branch information
jstancek committed Jul 4, 2019
1 parent 9ecb13e commit f5444ee
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions testcases/kernel/io/direct_io/diotest4.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,18 +352,14 @@ int main(int argc, char *argv[])
total++;

/* Test-10: read, write to a mmaped file */
shm_base = (char *)(((long)sbrk(0) + (shmsz - 1)) & ~(shmsz - 1));
if (shm_base == NULL) {
tst_brkm(TBROK, cleanup, "sbrk failed: %s", strerror(errno));
}
offset = 4096;
count = bufsize;
if ((fd = open(filename, O_DIRECT | O_RDWR)) < 0) {
tst_brkm(TBROK, cleanup, "can't open %s: %s",
filename, strerror(errno));
}
shm_base = mmap(shm_base, 0x100000, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_FIXED, fd, 0);
shm_base = mmap(0, 0x100000, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0);
if (shm_base == (caddr_t) - 1) {
tst_brkm(TBROK, cleanup, "can't mmap file: %s",
strerror(errno));
Expand Down

0 comments on commit f5444ee

Please sign in to comment.