From: Chris Mason Date: Fri, 11 Sep 2009 16:33:12 +0000 (-0400) Subject: Btrfs: fix btrfs page_mkwrite to return locked page X-Git-Tag: v2.6.32-rc1~57^2^2~26^2~1 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=50a9b214bc6c052caa05a210ebfc1bdf0d7085b2;p=~shefty%2Frdma-dev.git 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 --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 233fe6f2612..c846482e798 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4552,11 +4552,14 @@ again: } 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;