]> Git Repo - J-linux.git/commitdiff
Merge tag 'for-5.15-rc7-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
authorLinus Torvalds <[email protected]>
Fri, 29 Oct 2021 17:46:59 +0000 (10:46 -0700)
committerLinus Torvalds <[email protected]>
Fri, 29 Oct 2021 17:46:59 +0000 (10:46 -0700)
Pull btrfs fixes from David Sterba:
 "Last minute fixes for crash on 32bit architectures when compression is
  in use. It's a regression introduced in 5.15-rc and I'd really like
  not let this into the final release, fixes via stable trees would add
  unnecessary delay.

  The problem is on 32bit architectures with highmem enabled, the pages
  for compression may need to be kmapped, while the patches removed that
  as we don't use GFP_HIGHMEM allocations anymore. The pages that don't
  come from local allocation still may be from highmem. Despite being on
  32bit there's enough such ARM machines in use so it's not a marginal
  issue.

  I did full reverts of the patches one by one instead of a huge one.
  There's one exception for the "lzo" revert as there was an
  intermediate patch touching the same code to make it compatible with
  subpage. I can't revert that one too, so the revert in lzo.c is
  manual. Qu Wenruo has worked on that with me and verified the changes"

* tag 'for-5.15-rc7-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
  Revert "btrfs: compression: drop kmap/kunmap from lzo"
  Revert "btrfs: compression: drop kmap/kunmap from zlib"
  Revert "btrfs: compression: drop kmap/kunmap from zstd"
  Revert "btrfs: compression: drop kmap/kunmap from generic helpers"

1  2 
fs/btrfs/inode.c

diff --combined fs/btrfs/inode.c
index 487533c35ddb6bc6b69d0292969679850438c906,e6772f55943ea92652f671e319eab9d872ae10f2..7c096ab9bb5eb259b53af05a2d681da26216c3e8
@@@ -287,8 -287,9 +287,9 @@@ static int insert_inline_extent(struct 
                        cur_size = min_t(unsigned long, compressed_size,
                                       PAGE_SIZE);
  
-                       kaddr = page_address(cpage);
+                       kaddr = kmap_atomic(cpage);
                        write_extent_buffer(leaf, kaddr, ptr, cur_size);
+                       kunmap_atomic(kaddr);
  
                        i++;
                        ptr += cur_size;
@@@ -632,7 -633,7 +633,7 @@@ again
         * inode has not been flagged as nocompress.  This flag can
         * change at any time if we discover bad compression ratios.
         */
 -      if (nr_pages > 1 && inode_need_compress(BTRFS_I(inode), start, end)) {
 +      if (inode_need_compress(BTRFS_I(inode), start, end)) {
                WARN_ON(pages);
                pages = kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS);
                if (!pages) {
@@@ -8247,10 -8248,9 +8248,10 @@@ static struct btrfs_dio_private *btrfs_
        return dip;
  }
  
 -static blk_qc_t btrfs_submit_direct(struct inode *inode, struct iomap *iomap,
 +static blk_qc_t btrfs_submit_direct(const struct iomap_iter *iter,
                struct bio *dio_bio, loff_t file_offset)
  {
 +      struct inode *inode = iter->inode;
        const bool write = (btrfs_op(dio_bio) == BTRFS_MAP_WRITE);
        struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
        const bool raid56 = (btrfs_data_alloc_profile(fs_info) &
        int ret;
        blk_status_t status;
        struct btrfs_io_geometry geom;
 -      struct btrfs_dio_data *dio_data = iomap->private;
 +      struct btrfs_dio_data *dio_data = iter->iomap.private;
        struct extent_map *em = NULL;
  
        dip = btrfs_create_dio_private(dio_bio, inode, file_offset);
This page took 0.068659 seconds and 4 git commands to generate.