]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
gfs2: Fix filesystem block deallocation for short writes
authorAndreas Gruenbacher <agruenba@redhat.com>
Thu, 14 Apr 2022 15:52:39 +0000 (17:52 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 10 Aug 2022 07:22:11 +0000 (09:22 +0200)
commit7159d7908280127dbf39e906da2fb7abfeab17be
tree0394a3f3ce222dcb4bbcc33f2314edb04e7c5a3c
parent3d8c26124baa1fcc30b1f7281ab98f7818c2ba37
gfs2: Fix filesystem block deallocation for short writes

BugLink: https://bugs.launchpad.net/bugs/1980278
[ Upstream commit d031a8866e709c9d1ee5537a321b6192b4d2dc5b ]

When a write cannot be carried out in full, gfs2_iomap_end() releases
blocks that have been allocated for this write but haven't been used.

To compute the end of the allocation, gfs2_iomap_end() incorrectly
rounded the end of the attempted write down to the next block boundary
to arrive at the end of the allocation.  It would have to round up, but
the end of the allocation is also available as iomap->offset +
iomap->length, so just use that instead.

In addition, use round_up() for computing the start of the unused range.

Fixes: 64bc06bb32ee ("gfs2: iomap buffered write support")
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/gfs2/bmap.c