• Andrew Morton's avatar
    [PATCH] direct-io AIO fixes · 332c8cf1
    Andrew Morton authored
    From: Suparna Bhattacharya <suparna@in.ibm.com>
    
    Fixes the following remaining issues with the DIO code:
    
    1. During DIO file extends, intermediate writes could extend i_size
       exposing unwritten blocks to intermediate reads (Soln: Don't drop i_sem
       for file extends)
    
    2. AIO-DIO file extends may update i_size before I/O completes,
       exposing unwritten blocks to intermediate reads.  (Soln: Force AIO-DIO
       file extends to be synchronous)
    
    3. AIO-DIO writes to holes call aio_complete() before falling back to
       buffered I/O !  (Soln: Avoid calling aio_complete() if -ENOTBLK)
    
    4. AIO-DIO writes to an allocated region followed by a hole, falls back
       to buffered i/o without waiting for already submitted i/o to complete;
       might return to user-space, which could overwrite the buffer contents
       while they are still being written out by the kernel (Soln: Always wait
       for submitted i/o to complete before falling back to buffered i/o)
    332c8cf1
direct-io.c 30.7 KB