]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
btrfs: update locked page dirty/writeback/error bits in __process_pages_contig
authorQu Wenruo <wqu@suse.com>
Mon, 31 May 2021 08:50:47 +0000 (16:50 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 1 Jun 2021 19:00:05 +0000 (21:00 +0200)
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.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c

index 6fb1b1275eb8e0795230e2f5e5afd08ee2e59da5..b130195d6d4ff64e5a99e2fe1f6517de19a543b5 100644 (file)
@@ -1828,10 +1828,6 @@ static int process_one_page(struct btrfs_fs_info *fs_info,
 
        if (page_ops & PAGE_SET_ORDERED)
                btrfs_page_clamp_set_ordered(fs_info, page, start, len);
-
-       if (page == locked_page)
-               return 1;
-
        if (page_ops & PAGE_SET_ERROR)
                btrfs_page_clamp_set_error(fs_info, page, start, len);
        if (page_ops & PAGE_START_WRITEBACK) {
@@ -1840,6 +1836,10 @@ static int process_one_page(struct btrfs_fs_info *fs_info,
        }
        if (page_ops & PAGE_END_WRITEBACK)
                btrfs_page_clamp_clear_writeback(fs_info, page, start, len);
+
+       if (page == locked_page)
+               return 1;
+
        if (page_ops & PAGE_LOCK) {
                int ret;