mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
Btrfs: fix btrfs page_mkwrite to return locked page
This closes a whole where the page may be written before the page_mkwrite caller has a chance to dirty it (thanks to Nick Piggin) Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
a1ed835e1a
commit
50a9b214bc
1 changed files with 3 additions and 0 deletions
|
@ -4552,11 +4552,14 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
|
||||||
}
|
}
|
||||||
ClearPageChecked(page);
|
ClearPageChecked(page);
|
||||||
set_page_dirty(page);
|
set_page_dirty(page);
|
||||||
|
SetPageUptodate(page);
|
||||||
|
|
||||||
BTRFS_I(inode)->last_trans = root->fs_info->generation + 1;
|
BTRFS_I(inode)->last_trans = root->fs_info->generation + 1;
|
||||||
unlock_extent(io_tree, page_start, page_end, GFP_NOFS);
|
unlock_extent(io_tree, page_start, page_end, GFP_NOFS);
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
|
if (!ret)
|
||||||
|
return VM_FAULT_LOCKED;
|
||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
out:
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue