Browse Source

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>
Chris Mason 15 năm trước cách đây
mục cha
commit
50a9b214bc
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  1. 3 0
      fs/btrfs/inode.c

+ 3 - 0
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;