• Vladimir Saveliev's avatar
    reiserfs: avoid tail packing if an inode was ever mmapped · 4f3f184b
    Vladimir Saveliev authored
    This patch fixes a confusion reiserfs has for a long time.
    
    On release file operation reiserfs used to try to pack file data stored in
    last incomplete page of some files into metadata blocks.  After packing the
    page got cleared with clear_page_dirty.  It did not take into account that
    the page may be mmaped into other process's address space.  Recent
    replacement for clear_page_dirty cancel_dirty_page found the confusion with
    sanity check that page has to be not mapped.
    
    The patch fixes the confusion by making reiserfs avoid tail packing if an
    inode was ever mmapped.  reiserfs_mmap and reiserfs_file_release are
    serialized with mutex in reiserfs specific inode.  reiserfs_mmap locks the
    mutex and sets a bit in reiserfs specific inode flags.
    reiserfs_file_release checks the bit having the mutex locked.  If bit is
    set - tail packing is avoided.  This eliminates a possibility that mmapped
    page gets cancel_page_dirty-ed.
    Signed-off-by: default avatarVladimir Saveliev <vs@namesys.com>
    Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
    4f3f184b
inode.c 86.9 KB