]> git.baikalelectronics.ru Git - 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)
committerAndreas Gruenbacher <agruenba@redhat.com>
Fri, 13 May 2022 19:59:18 +0000 (21:59 +0200)
commit0602c52f23278921711a41ac488735ae9dbd4020
treeccd7942b2ac3df85369219f0352b2b3edff4d524
parent19f64bc69a46a2d35f21d055d7336884fee93a94
gfs2: Fix filesystem block deallocation for short writes

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: ff673b97c3a1 ("gfs2: iomap buffered write support")
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/bmap.c