mbox series

[v3,0/2] btrfs: fixes related to btrfs_folio_start_writer_lock()

Message ID cover.1728428503.git.wqu@suse.com (mailing list archive)
Headers show
Series btrfs: fixes related to btrfs_folio_start_writer_lock() | expand

Message

Qu Wenruo Oct. 8, 2024, 11:07 p.m. UTC
[Changelog]
v2:
- Remove the unused btrfs_folio_start_writer_lock()

v3:
- Split out the btrfs_folio_start_writer_lock() removal
  As the initial fix needs to go backported to 5.15+, keeps the
  modification as small as possible

The function lacks the proper folio->mapping check, thus we can even get
a folio not belonging to btrfs, and cause unexpeceted folio->private
updates.

Fix the only caller of btrfs_folio_start_writer_lock() inside
lock_delalloc_folios() and other sector size < page size handling of
lock_delalloc_folios().

Then finally remove btrfs_folio_start_writer_lock()

Qu Wenruo (2):
  btrfs: fix the delalloc range locking if sector size < page size
  btrfs: remove unused btrfs_folio_start_writer_lock()

 fs/btrfs/extent_io.c | 17 ++++++++--------
 fs/btrfs/subpage.c   | 47 --------------------------------------------
 fs/btrfs/subpage.h   |  2 --
 3 files changed, 9 insertions(+), 57 deletions(-)

Comments

David Sterba Oct. 16, 2024, 3:16 p.m. UTC | #1
On Wed, Oct 09, 2024 at 09:37:02AM +1030, Qu Wenruo wrote:
> [Changelog]
> v2:
> - Remove the unused btrfs_folio_start_writer_lock()
> 
> v3:
> - Split out the btrfs_folio_start_writer_lock() removal
>   As the initial fix needs to go backported to 5.15+, keeps the
>   modification as small as possible
> 
> The function lacks the proper folio->mapping check, thus we can even get
> a folio not belonging to btrfs, and cause unexpeceted folio->private
> updates.
> 
> Fix the only caller of btrfs_folio_start_writer_lock() inside
> lock_delalloc_folios() and other sector size < page size handling of
> lock_delalloc_folios().
> 
> Then finally remove btrfs_folio_start_writer_lock()
> 
> Qu Wenruo (2):
>   btrfs: fix the delalloc range locking if sector size < page size
>   btrfs: remove unused btrfs_folio_start_writer_lock()

Reviewed-by: David Sterba <dsterba@suse.com>