[GIT PULL] Btrfs fixes for 5.16-rc2

From: David Sterba
Date: Thu Nov 18 2021 - 12:37:54 EST


Hi,

there are several fixes and one old ioctl deprecation. Namely there's
fix for crashes/warnings with lzo compression that was suspected to be
caused by first pull merge resolution, but it was a different bug.

The branch is based on the previous pull so there's still a conflict in
lzo.c but this time it's a trivial one (diff below). I've also tested
the branches with/without the fix and on both 64bit and 32bit hosts so
there should be no surprises.

The ioctl deprecation patch is new but it's just adding a warning
message, there's no reason to delay that for another full release.

Changes:

* regression, fix crash in lzo due to missing boundary checks of page
array

* fix crashes on ARM64 due to missing barriers when synchronizing
status bits between work queues

* silence lockdep when reading chunk tree during mount

* fix false positive warning in integrity checker on devices with
disabled write caching

* fix signedness of bitfields in scrub

* start deprecation of balance v1 ioctl

Please pull, thanks.

Conflict resolution:

diff --cc fs/btrfs/lzo.c
index 65cb0766e62d,f410ceabcdbd..9febb8025825
--- a/fs/btrfs/lzo.c
+++ b/fs/btrfs/lzo.c
@@@ -131,8 -132,10 +132,11 @@@ static int copy_compressed_data_to_page
u32 sector_bytes_left;
u32 orig_out;
struct page *cur_page;
+ char *kaddr;

+ if ((*cur_out / PAGE_SIZE) >= max_nr_page)
+ return -E2BIG;
+
/*
* We never allow a segment header crossing sector boundary, previous
* run should ensure we have enough space left inside the sector.
@@@ -160,7 -162,9 +164,11 @@@
u32 copy_len = min_t(u32, sectorsize - *cur_out % sectorsize,
orig_out + compressed_size - *cur_out);

+ kunmap(cur_page);
++
+ if ((*cur_out / PAGE_SIZE) >= max_nr_page)
+ return -E2BIG;
+
cur_page = out_pages[*cur_out / PAGE_SIZE];
/* Allocate a new page */
if (!cur_page) {
@@@ -202,7 -202,7 +210,8 @@@ int lzo_compress_pages(struct list_hea
struct workspace *workspace = list_entry(ws, struct workspace, list);
const u32 sectorsize = btrfs_sb(mapping->host->i_sb)->sectorsize;
struct page *page_in = NULL;
+ char *sizes_ptr;
+ const unsigned long max_nr_page = *out_pages;
int ret = 0;
/* Points to the file offset of input data */
u64 cur_in = start;

----------------------------------------------------------------
The following changes since commit d1ed82f3559e151804743df0594f45d7ff6e55fa:

btrfs: remove root argument from check_item_in_log() (2021-10-29 12:39:13 +0200)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-5.16-rc1-tag

for you to fetch changes up to 6c405b24097c24cbb11570b47fd382676014f72e:

btrfs: deprecate BTRFS_IOC_BALANCE ioctl (2021-11-16 16:51:19 +0100)

----------------------------------------------------------------
Colin Ian King (1):
btrfs: make 1-bit bit-fields of scrub_page unsigned int

Filipe Manana (1):
btrfs: silence lockdep when reading chunk tree during mount

Nikolay Borisov (2):
btrfs: fix memory ordering between normal and ordered work functions
btrfs: deprecate BTRFS_IOC_BALANCE ioctl

Qu Wenruo (1):
btrfs: fix a out-of-bound access in copy_compressed_data_to_page()

Wang Yugui (1):
btrfs: check-integrity: fix a warning on write caching disabled disk

fs/btrfs/async-thread.c | 14 ++++++++++++++
fs/btrfs/disk-io.c | 14 +++++++++++++-
fs/btrfs/ioctl.c | 4 ++++
fs/btrfs/lzo.c | 12 +++++++++++-
fs/btrfs/scrub.c | 4 ++--
fs/btrfs/volumes.c | 18 +++++++++++++-----
6 files changed, 57 insertions(+), 9 deletions(-)