• Trond Myklebust's avatar
    [PATCH] NFS: Fix race in nfs_release_page() · e3db7691
    Trond Myklebust authored
        NFS: Fix race in nfs_release_page()
    
        invalidate_inode_pages2() may find the dirty bit has been set on a page
        owing to the fact that the page may still be mapped after it was locked.
        Only after the call to unmap_mapping_range() are we sure that the page
        can no longer be dirtied.
        In order to fix this, NFS has hooked the releasepage() method and tries
        to write the page out between the call to unmap_mapping_range() and the
        call to remove_mapping(). This, however leads to deadlocks in the page
        reclaim code, where the page may be locked without holding a reference
        to the inode or dentry.
    
        Fix is to add a new address_space_operation, launder_page(), which will
        attempt to write out a dirty page without releasing the page lock.
    Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
    
        Also, the bare SetPageDirty() can skew all sort of accounting leading to
        other nasties.
    
    [akpm@osdl.org: cleanup]
    Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    e3db7691
truncate.c 11.9 KB