Skip to content

Commit

Permalink
ceph: handle -EAGAIN returned by ceph_update_writeable_page()
Browse files Browse the repository at this point in the history
when ceph_update_writeable_page() return -EAGAIN, caller should
lock the page and call ceph_update_writeable_page() again.

Signed-off-by: Yan, Zheng <[email protected]>
  • Loading branch information
ukernel authored and idryomov committed May 25, 2016
1 parent 6ce026e commit f0b33df
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions fs/ceph/addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1475,21 +1475,23 @@ static int ceph_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
/* Update time before taking page lock */
file_update_time(vma->vm_file);

lock_page(page);
do {
lock_page(page);

if ((off > size) || (page->mapping != inode->i_mapping)) {
unlock_page(page);
ret = VM_FAULT_NOPAGE;
goto out;
}
if ((off > size) || (page->mapping != inode->i_mapping)) {
unlock_page(page);
ret = VM_FAULT_NOPAGE;
break;
}

ret = ceph_update_writeable_page(vma->vm_file, off, len, page);
if (ret >= 0) {
/* success. we'll keep the page locked. */
set_page_dirty(page);
ret = VM_FAULT_LOCKED;
}
} while (ret == -EAGAIN);

ret = ceph_update_writeable_page(vma->vm_file, off, len, page);
if (ret >= 0) {
/* success. we'll keep the page locked. */
set_page_dirty(page);
ret = VM_FAULT_LOCKED;
}
out:
if (ret == VM_FAULT_LOCKED ||
ci->i_inline_version != CEPH_INLINE_NONE) {
int dirty;
Expand Down

0 comments on commit f0b33df

Please sign in to comment.