sw64: kvm: fix bug when open file with the O_DIRECT flag
Sunway inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I56WV8 -------------------------------- sw_64/kvm map the memory of VM instance to QEMU's user space by remap_pfn_range(), which set the vma flag with VM_IO and VM_PFNMAP. The previous commit set these pages as reserved and follow_pfn() method will get pfn of a PFNMAP vma correctly to fix bug if user do munmap on the vma. But in generic_file_read_iter() with O_DIRECT flag will call __get_user_pages() and return -EFAULT because of VM_IO and VM_PFNMAP, then bio_iov_iter_get_pages() failed to get the physical pages corresponding to the user virtual address. To solve this problem, VM_IO and VM_PFNMAP of the vma flag were cleared and set again before release this vma. Signed-off-by:Du Yilong <duyilong@wxiat.com> Signed-off-by:
Gu Zitao <guzitao@wxiat.com> Acked-by:
Xie XiuQi <xiexiuqi@huawei.com> Signed-off-by:
Zheng Zengkai <zhengzengkai@huawei.com>
Loading
Please sign in to comment