]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
gfs2: Another gfs2_find_jhead fix
authorAndreas Gruenbacher <agruenba@redhat.com>
Sun, 8 Dec 2019 13:12:49 +0000 (13:12 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Feb 2020 21:22:40 +0000 (21:22 +0000)
commit73774def78ece8a3521a6160c883b40eb8ffdd4a
tree98d3afe2e8c4042e80c2503fcb503287787c7c14
parentd635e7c4b34e6a630c7a1e8f1a8fd52c3e3ceea7
gfs2: Another gfs2_find_jhead fix

commit eed0f953b90e86e765197a1dad06bb48aedc27fe upstream.

On filesystems with a block size smaller than the page size,
gfs2_find_jhead can split a page across two bios (for example, when
blocks are not allocated consecutively).  When that happens, the first
bio that completes will unlock the page in its bi_end_io handler even
though the page hasn't been read completely yet.  Fix that by using a
chained bio for the rest of the page.

While at it, clean up the sector calculation logic in
gfs2_log_alloc_bio.  In gfs2_find_jhead, simplify the disk block and
offset calculation logic and fix a variable name.

Fixes: f4686c26ecc3 ("gfs2: read journal in large chunks")
Cc: stable@vger.kernel.org # v5.2+
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/gfs2/lops.c