Commit f2b1c41c authored by Chris Mason's avatar Chris Mason

Btrfs: Make sure pages are dirty before doing delalloc for them

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: default avatarChris Mason <chris.mason@oracle.com>
parent 5b7c3fcc
...@@ -1205,7 +1205,8 @@ static noinline int lock_delalloc_pages(struct inode *inode, ...@@ -1205,7 +1205,8 @@ static noinline int lock_delalloc_pages(struct inode *inode,
*/ */
if (pages[i] != locked_page) { if (pages[i] != locked_page) {
lock_page(pages[i]); lock_page(pages[i]);
if (pages[i]->mapping != inode->i_mapping) { if (!PageDirty(pages[i]) ||
pages[i]->mapping != inode->i_mapping) {
ret = -EAGAIN; ret = -EAGAIN;
unlock_page(pages[i]); unlock_page(pages[i]);
page_cache_release(pages[i]); page_cache_release(pages[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment