Skip to content

Commit

Permalink
Btrfs: fix regression in lock_delalloc_pages
Browse files Browse the repository at this point in the history
The bug is a regression after commit
(da2c700 "btrfs: teach __process_pages_contig about PAGE_LOCK operation")
and commit
(76c0021 "Btrfs: use helper to simplify lock/unlock pages").

So if the dirty pages which are under writeback got truncated partially
before we lock the dirty pages, we couldn't find all pages mapping to the
delalloc range, and the bug didn't return an error so it kept going on and
found that the delalloc range got truncated and got to unlock the dirty
pages, and then the ASSERT could caught the error, and showed

-----------------------------------------------------------------------------
assertion failed: page_ops & PAGE_LOCK, file: fs/btrfs/extent_io.c, line: 1716
-----------------------------------------------------------------------------

This fixes the bug by returning the proper -EAGAIN.

Cc: David Sterba <dsterba@suse.com>
Reported-by: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Liu Bo authored and Chris Mason committed Mar 17, 2017
1 parent 68598d2 commit 49d4a33
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 @@ -1714,7 +1714,8 @@ static int __process_pages_contig(struct address_space *mapping,
* can we find nothing at @index.
*/
ASSERT(page_ops & PAGE_LOCK);
return ret;
err = -EAGAIN;
goto out;
}

for (i = 0; i < ret; i++) {
Expand Down

0 comments on commit 49d4a33

Please sign in to comment.