Skip to content

Commit

Permalink
Btrfs: fix btrfs page_mkwrite to return locked page
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
chrismason-xx committed Sep 11, 2009
1 parent a1ed835 commit 50a9b21
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4552,11 +4552,14 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
}
ClearPageChecked(page);
set_page_dirty(page);
SetPageUptodate(page);

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

out_unlock:
if (!ret)
return VM_FAULT_LOCKED;
unlock_page(page);
out:
return ret;
Expand Down

0 comments on commit 50a9b21

Please sign in to comment.