Skip to content

Commit 49d4a33

Browse files
Liu Bomasoncl
authored andcommitted
Btrfs: fix regression in lock_delalloc_pages
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 <[email protected]> Reported-by: Dave Jones <[email protected]> Signed-off-by: Liu Bo <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 68598d2 commit 49d4a33

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/btrfs/extent_io.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1714,7 +1714,8 @@ static int __process_pages_contig(struct address_space *mapping,
17141714
* can we find nothing at @index.
17151715
*/
17161716
ASSERT(page_ops & PAGE_LOCK);
1717-
return ret;
1717+
err = -EAGAIN;
1718+
goto out;
17181719
}
17191720

17201721
for (i = 0; i < ret; i++) {

0 commit comments

Comments
 (0)