The test case Linus sent me boils down to this:
fd = open(file)
buffer = mmap(fd, 128 pages);
close(fd);
fd = open(file, O_DIRECT);
write(fd, buffer, 66 pages);
Yeah, though I bet the inner close/open isn't needed.
I think the deadlock is limited to cases where get_user_pages will get
stuck in filemap_nopage waiting for placeholders inserted by this DIO.
Yeah.
It looks like that can only happen when buffer is mapped at the
start of
the dio.
At the *start* of the dio or by the time get_user_pages() is called?
The dio and mmap() aren't serialized, are they? mmap() just sets up
the vma, I thought, and will only touch the mmap_sem.
I'm fearing threads racing write(fd, buffer, ) and mmap(buffer,
MAP_FIXED...).
I might just be missing the locking that serializes them. If nothing
else, this should be mentioned in the comment above the code that
looks like a racy test against the presence of a mapping.
- z
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html