ceph: switch to page_mkwrite_check_truncate in ceph_page_mkwrite
Use the "page has been truncated" logic in page_mkwrite_check_truncate instead of reimplementing it here. Other than with the existing code, fail with -EFAULT / VM_FAULT_NOPAGE when page_offset(page) == size here as well, as should be expected. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
f682dc713c
commit
cb03c14390
@ -1655,7 +1655,7 @@ static vm_fault_t ceph_page_mkwrite(struct vm_fault *vmf)
|
|||||||
do {
|
do {
|
||||||
lock_page(page);
|
lock_page(page);
|
||||||
|
|
||||||
if ((off > size) || (page->mapping != inode->i_mapping)) {
|
if (page_mkwrite_check_truncate(page, inode) < 0) {
|
||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
ret = VM_FAULT_NOPAGE;
|
ret = VM_FAULT_NOPAGE;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user