Skip to content
Commit 4adaa611 authored by Chris Mason's avatar Chris Mason
Browse files

Btrfs: fix race between mmap writes and compression



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: default avatarChris Mason <chris.mason@fusionio.com>
Reported-by: default avatarAlexandre Oliva <oliva@gnu.org>
cc: stable@vger.kernel.org
parent 1dd05682
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment