Skip to content

Commit 50a9b21

Browse files
committed
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 <[email protected]>
1 parent a1ed835 commit 50a9b21

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/btrfs/inode.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4552,11 +4552,14 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
45524552
}
45534553
ClearPageChecked(page);
45544554
set_page_dirty(page);
4555+
SetPageUptodate(page);
45554556

45564557
BTRFS_I(inode)->last_trans = root->fs_info->generation + 1;
45574558
unlock_extent(io_tree, page_start, page_end, GFP_NOFS);
45584559

45594560
out_unlock:
4561+
if (!ret)
4562+
return VM_FAULT_LOCKED;
45604563
unlock_page(page);
45614564
out:
45624565
return ret;

0 commit comments

Comments
 (0)