File man-pages-3.32-race-directIO-fork.patch of Package man-pages.openSUSE_11.4_Update
X-Git-Url: http://git.kernel.org/?p=docs%2Fman-pages%2Fman-pages.git;a=blobdiff_plain;f=man2%2Fopen.2;h=d53db24c89ba03685323e64ebdec5b508b24d45e;hp=a655faef2723fea0c079b75cbb41b1b7470c5232;hb=1847167b8b7d85a4d52acb86f4cb3755a4abcebd;hpb=be02e49f7c66b0e28d8baf44e72af8509b813b1b diff --git a/man2/open.2 b/man2/open.2 index a655fae..d53db24 100644 --- man2/open.2 +++ man2/open.2 @@ -768,8 +768,41 @@ operation in Under Linux 2.4, transfer sizes, and the alignment of the user buffer and the file offset must all be multiples of the logical block size of the file system. -Under Linux 2.6, alignment to 512-byte boundaries -suffices. +Under Linux 2.6, alignment to 512-byte boundaries suffices. +.LP +.B O_DIRECT +I/Os should never be run concurrently with the +.BR fork (2) +system call, +if the memory buffer is a private mapping +(i.e., any mapping created with the +.BR mmap(2) +.BR MAP_PRIVATE +flag; +this includes memory allocated on the heap and statically allocated buffers). +Any such I/Os, whether submitted via an asynchronous I/O interface or from +another thread in the process, +should be completed before +.BR fork (2) +is called. +Failure to do so can result in data corruption and undefined behavior in +parent and child processes. +This restriction does not apply when the memory buffer for the +.B O_DIRECT +I/Os was created using +.BR shmat (2) +or +.BR mmap (2) +with the +.B MAP_SHARED +flag. +Nor does this restriction apply when the memory buffer has been advised as +.B MADV_DONTFORK +with +.BR madvise(2), +ensuring that it will not be available +to the child after +.BR fork (2). .LP The .B O_DIRECT