]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: fix cgroup writeback accounting with fs-layer encryption
authorEric Biggers <ebiggers@google.com>
Fri, 3 Feb 2023 00:55:03 +0000 (16:55 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:50:16 +0000 (08:50 +0100)
commitd44ea13539f9560b027e5a16b1d5e663e9497c19
treeecc3cf25e893336e5fc595c914c4dc76d7608c34
parent706f16338e12cec7699fba22d3135738358abe00
ext4: fix cgroup writeback accounting with fs-layer encryption

commit 0072177d3d71fbf549c9fc360106975c1be5f294 upstream.

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 to
wbc_account_cgroup_owner().

Fixes: d3ce8440b868 ("ext4: implement cgroup writeback support")
Cc: stable@vger.kernel.org
Reported-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20230203005503.141557-1-ebiggers@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/page-io.c