Skip to content

Commit

Permalink
Btrfs: Make sure pages are dirty before doing delalloc for them
Browse files Browse the repository at this point in the history
This adds a PageDirty check to the writeback path that locks pages
for delalloc.  If a page wasn't dirty at this point, it is in the
process of being truncated away.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Chris Mason committed Nov 10, 2008
1 parent 5b7c3fc commit f2b1c41
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,8 @@ static noinline int lock_delalloc_pages(struct inode *inode,
*/
if (pages[i] != locked_page) {
lock_page(pages[i]);
if (pages[i]->mapping != inode->i_mapping) {
if (!PageDirty(pages[i]) ||
pages[i]->mapping != inode->i_mapping) {
ret = -EAGAIN;
unlock_page(pages[i]);
page_cache_release(pages[i]);
Expand Down

0 comments on commit f2b1c41

Please sign in to comment.