• Hugh Dickins's avatar
    [PATCH] vmtrunc: truncate_count not atomic · b37e39b0
    Hugh Dickins authored
    Why is mapping->truncate_count atomic?  It's incremented inside i_mmap_lock
    (and i_sem), and the reads don't need it to be atomic.
    
    And why smp_rmb() before call to ->nopage?  The compiler cannot reorder the
    initial assignment of sequence after the call to ->nopage, and no cpu (yet!)
    can read from the future, which is all that matters there.
    
    And delete totally bogus reset of truncate_count from blkmtd add_device.
    truncate_count is all about detecting i_size changes: i_size does not change
    there; and if it did, the count should be incremented not reset.
    Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    b37e39b0
inode.c 34.6 KB