FAILED: patch "[PATCH] ext4: fix cgroup writeback accounting with fs-layer" failed to apply to 4.14-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.14.y
git checkout FETCH_HEAD
git cherry-pick -x ffec85d53d0f39ee4680a2cf0795255e000e1feb
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 4.14.y' HEAD^..
Possible dependencies:
ffec85d53d0f ("ext4: fix cgroup writeback accounting with fs-layer encryption") 29b83c574b0a ("ext4: remove nr_submitted from ext4_bio_write_page()") 04e568a3b31c ("ext4: handle redirtying in ext4_bio_write_page()") c75e707fe1aa ("block: remove the per-bio/request write hint") 4c4dad11ff85 ("ext4: pass the operation to bio_alloc") 07888c665b40 ("block: pass a block_device and opf to bio_alloc") b77c88c2100c ("block: pass a block_device and opf to bio_alloc_kiocb") 609be1066731 ("block: pass a block_device and opf to bio_alloc_bioset") 0a3140ea0fae ("block: pass a block_device and opf to blk_next_bio") 3b005bf6acf0 ("block: move blk_next_bio to bio.c")7d8d0c658d48 ("xen-blkback: bio_alloc can't fail if it is allow to sleep") d7b78de2b155 ("rnbd-srv: remove struct rnbd_dev_blk_io") 1fe0640ff94f ("rnbd-srv: simplify bio mapping in process_rdma") 4b1dc86d1857 ("drbd: bio_alloc can't fail if it is allow to sleep") 3f868c09ea8f ("dm-crypt: remove clone_init")53db984e004c ("dm: bio_alloc can't fail if it is allowed to sleep") 39146b6f66ba ("ntfs3: remove ntfs_alloc_bio")5d2ca2132f88 ("nfs/blocklayout: remove bl_alloc_init_bio") f0d911927b3c ("nilfs2: remove nilfs_alloc_seg_bio")d5f68a42da7a ("fs: remove mpage_alloc")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From ffec85d53d0f39ee4680a2cf0795255e000e1feb Mon Sep 17 00:00:00 2001
From: Eric Biggers <[email protected]>
Date: Thu, 2 Feb 2023 16:55:03 -0800
Subject: [PATCH] ext4: fix cgroup writeback accounting with fs-layer
encryption
When writing a page from an encrypted file that is using filesystem-layer encryption (not inline encryption), ext4 encrypts the pagecache page into a bounce page, then writes the bounce page.
It also passes the bounce page to wbc_account_cgroup_owner(). That's incorrect, because the bounce page is a newly allocated temporary page that doesn't have the memory cgroup of the original pagecache page. This makes wbc_account_cgroup_owner() not account the I/O to the owner of the pagecache page as it should.
Fix this by always passing the pagecache page towbc_account_cgroup_owner().
fs/ext4/page-io.c +6 -5
@@ -409,7 +409,8 @@ static void io_submit_init_bio(struct ext4_io_submit *io,static void io_submit_add_bh (struct ext4_io_submit *io,struct inode *inode, -struct page *page, +struct page *pagecache_page, +struct page *bounce_page,struct buffer_head *bh) {int ret;
@@ -421,10 +422,11 @@ static void io_submit_add_bh(struct ext4_io_submit *io, }if (io->io_bio ==NULL )io_submit_init_bio (io, bh); - ret =bio_add_page (io->io_bio, page, bh->b_size,bh_offset (bh)); + ret =bio_add_page (io->io_bio, bounce_page ?: pagecache_page, + bh->b_size,bh_offset (bh));if (ret != bh->b_size) goto submit_and_retry; -wbc_account_cgroup_owner (io->io_wbc, page, bh->b_size); +wbc_account_cgroup_owner (io->io_wbc, pagecache_page, bh->b_size); io->io_next_block++; }
@@ -561,8 +563,7 @@ int ext4_bio_write_page(struct ext4_io_submit *io,do {if (!buffer_async_write (bh))continue ; -io_submit_add_bh (io, inode, - bounce_page ? bounce_page : page, bh); +io_submit_add_bh (io, inode, page, bounce_page, bh); }while ((bh = bh->b_this_page) != head); unlock:unlock_page (page);