Skip to content

Commit a33a8e9

Browse files
adam900710kdave
authored andcommitted
btrfs: update locked page dirty/writeback/error bits in __process_pages_contig
When __process_pages_contig() gets called for extent_clear_unlock_delalloc(), if we hit the locked page, only Private2 bit is updated, but dirty/writeback/error bits are all skipped. There are several call sites that call extent_clear_unlock_delalloc() with locked_page and PAGE_CLEAR_DIRTY/PAGE_SET_WRITEBACK/PAGE_END_WRITEBACK - cow_file_range() - run_delalloc_nocow() - cow_file_range_async() All for their error handling branches. For those call sites, since we skip the locked page for dirty/error/writeback bit update, the locked page will still have its subpage dirty bit remaining. Normally it's the call sites which locked the page to handle the locked page, but it won't hurt if we also do the update. Especially there are already other call sites doing the same thing by manually passing NULL as locked_page. Tested-by: Ritesh Harjani <riteshh@linux.ibm.com> # [ppc64] Tested-by: Anand Jain <anand.jain@oracle.com> # [aarch64] Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent b945a46 commit a33a8e9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/btrfs/extent_io.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,10 +1828,6 @@ static int process_one_page(struct btrfs_fs_info *fs_info,
18281828

18291829
if (page_ops & PAGE_SET_ORDERED)
18301830
btrfs_page_clamp_set_ordered(fs_info, page, start, len);
1831-
1832-
if (page == locked_page)
1833-
return 1;
1834-
18351831
if (page_ops & PAGE_SET_ERROR)
18361832
btrfs_page_clamp_set_error(fs_info, page, start, len);
18371833
if (page_ops & PAGE_START_WRITEBACK) {
@@ -1840,6 +1836,10 @@ static int process_one_page(struct btrfs_fs_info *fs_info,
18401836
}
18411837
if (page_ops & PAGE_END_WRITEBACK)
18421838
btrfs_page_clamp_clear_writeback(fs_info, page, start, len);
1839+
1840+
if (page == locked_page)
1841+
return 1;
1842+
18431843
if (page_ops & PAGE_LOCK) {
18441844
int ret;
18451845

0 commit comments

Comments
 (0)