• Andrew Morton's avatar
    [PATCH] tmpfs 3/7 swapoff/truncate race fix · eaec8c0c
    Andrew Morton authored
    From: Hugh Dickins <hugh@veritas.com>
    
    On 23 July, Sergey S. Kostyliov <rathamahata@php4.ru> reported a tmpfs
    BUG_ON(inode->i_blocks) during swapoff: my last version of the fix to
    swapoff/truncate race was inadequate, since I_FREEING might get set or
    i_size be reduced (from another cpu) the instant after it's tested here.
    
    So revert to the previous version of the fix, shmem_truncate calling
    truncate_inode_pages again, if pages still left in cache; but avoid the
    recall in usual cases of partial truncation, by having a "pagein" flag
    to indicate when recall might be necessary.  (Since those flags already
    use VM_ACCOUNT and VM_LOCKED, must redefine another VM_flag for this.)
    Sergey and 2.4-aa have run fine with this for a couple of months.
    eaec8c0c
shmem.c 49.2 KB