Commit f2b1c41cf94d7f839fe9ede5f3ead92698a93fb3

Authored by Chris Mason
1 parent 5b7c3fcc46

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: Chris Mason <chris.mason@oracle.com>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

fs/btrfs/extent_io.c
... ... @@ -1205,7 +1205,8 @@
1205 1205 */
1206 1206 if (pages[i] != locked_page) {
1207 1207 lock_page(pages[i]);
1208   - if (pages[i]->mapping != inode->i_mapping) {
  1208 + if (!PageDirty(pages[i]) ||
  1209 + pages[i]->mapping != inode->i_mapping) {
1209 1210 ret = -EAGAIN;
1210 1211 unlock_page(pages[i]);
1211 1212 page_cache_release(pages[i]);