• C
    Btrfs: fix race between mmap writes and compression · 4adaa611
    Chris Mason 提交于
    Btrfs uses page_mkwrite to ensure stable pages during
    crc calculations and mmap workloads.  We call clear_page_dirty_for_io
    before we do any crcs, and this forces any application with the file
    mapped to wait for the crc to finish before it is allowed to change
    the file.
    
    With compression on, the clear_page_dirty_for_io step is happening after
    we've compressed the pages.  This means the applications might be
    changing the pages while we are compressing them, and some of those
    modifications might not hit the disk.
    
    This commit adds the clear_page_dirty_for_io before compression starts
    and makes sure to redirty the page if we have to fallback to
    uncompressed IO as well.
    Signed-off-by: NChris Mason <chris.mason@fusionio.com>
    Reported-by: NAlexandre Oliva <oliva@gnu.org>
    cc: stable@vger.kernel.org
    4adaa611
extent_io.h 12.6 KB