Skip to content
Snippets Groups Projects
user avatar
Xin Zhong authored
This problem is found in meego testing:
http://bugs.meego.com/show_bug.cgi?id=6672


A file in btrfs is mmaped and the mmaped buffer is passed to pwrite to write to the same page
of the same file. In btrfs_file_aio_write(), the pages is locked by prepare_pages(). So when
btrfs_copy_from_user() is called, page fault happens and the same page needs to be locked again
in filemap_fault(). The fix is to move iov_iter_fault_in_readable() before prepage_pages() to make page
fault happen before pages are locked. And also disable page fault in critical region in
btrfs_copy_from_user().

Reviewed-by: default avatarYan, <Zheng&lt;zheng.z.yan@intel.com>
Signed-off-by: default avatarZhong, Xin <xin.zhong@intel.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
914ee295
Name Last commit Last update