diff options
| author | Qu Wenruo <[email protected]> | 2021-05-31 16:50:48 +0800 | 
|---|---|---|
| committer | David Sterba <[email protected]> | 2021-06-21 15:19:10 +0200 | 
| commit | 4750af3bbe5d975951b09afc61f18c7b29db7d44 (patch) | |
| tree | b6e1a41451573ed0459ba733ddd16717ebfe256a /scripts/gdb/linux/tasks.py | |
| parent | a33a8e9afcab270bfd8081ded8efb8c1e9eac7f3 (diff) | |
btrfs: prevent extent_clear_unlock_delalloc() to unlock page not locked by __process_pages_contig()
In cow_file_range(), after we have succeeded creating an inline extent,
we unlock the page with extent_clear_unlock_delalloc() by passing
locked_page == NULL.
For sectorsize == PAGE_SIZE case, this is just making the page lock and
unlock harder to grab.
But for incoming subpage case, it can be a big problem.
For incoming subpage case, page locking have two entry points:
- __process_pages_contig()
  In that case, we know exactly the range we want to lock (which only
  requires sector alignment).
  To handle the subpage requirement, we introduce btrfs_subpage::writers
  to page::private, and will update it in __process_pages_contig().
- Other directly lock/unlock_page() call sites
  Those won't touch btrfs_subpage::writers at all.
This means, page locked by __process_pages_contig() can only be unlocked
by __process_pages_contig().
Thankfully we already have the existing infrastructure in the form of
@locked_page in various call sites.
Unfortunately, extent_clear_unlock_delalloc() in cow_file_range() after
creating an inline extent is the exception.
It intentionally call extent_clear_unlock_delalloc() with locked_page ==
NULL, to also unlock current page (and clear its dirty/writeback bits).
To co-operate with incoming subpage modifications, and make the page
lock/unlock pair easier to understand, this patch will still call
extent_clear_unlock_delalloc() with locked_page, and only unlock the
page in __extent_writepage().
Tested-by: Ritesh Harjani <[email protected]> # [ppc64]
Tested-by: Anand Jain <[email protected]> # [aarch64]
Signed-off-by: Qu Wenruo <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'scripts/gdb/linux/tasks.py')
0 files changed, 0 insertions, 0 deletions