• A
    Revert "[PATCH] generic_file_buffered_write(): deadlock on vectored write" · 6814d7a9
    Andrew Morton 提交于
    This reverts commit 6527c2bd, which
    fixed the following bug:
    
      When prefaulting in the pages in generic_file_buffered_write(), we only
      faulted in the pages for the firts segment of the iovec.  If the second of
      successive segment described a mmapping of the page into which we're
      write()ing, and that page is not up-to-date, the fault handler tries to lock
      the already-locked page (to bring it up to date) and deadlocks.
    
      An exploit for this bug is in writev-deadlock-demo.c, in
      http://www.zip.com.au/~akpm/linux/patches/stuff/ext3-tools.tar.gz.
    
      (These demos assume blocksize < PAGE_CACHE_SIZE).
    
    The problem with this fix is that it takes the kernel back to doing a single
    prepare_write()/commit_write() per iovec segment.  So in the worst case we'll
    run prepare_write+commit_write 1024 times where we previously would have run
    it once. The other problem with the fix is that it fix all the locking problems.
    
    <insert numbers obtained via ext3-tools's writev-speed.c here>
    
    And apparently this change killed NFS overwrite performance, because, I
    suppose, it talks to the server for each prepare_write+commit_write.
    
    So just back that patch out - we'll be fixing the deadlock by other means.
    
    Nick says: also it only ever actually papered over the bug, because after
    faulting in the pages, they might be unmapped or reclaimed.
    Signed-off-by: NNick Piggin <npiggin@suse.de>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    6814d7a9
filemap.c 58.4 KB