linux/fs/gfs2
Bob Peterson 888d9b829c gfs2: Never call gfs2_block_zero_range with an open transaction
[ Upstream commit 70499cdfeb ]

Before this patch, some functions started transactions then they called
gfs2_block_zero_range. However, gfs2_block_zero_range, like writes, can
start transactions, which results in a recursive transaction error.
For example:

do_shrink
   trunc_start
      gfs2_trans_begin <------------------------------------------------
         gfs2_block_zero_range
            iomap_zero_range(inode, from, length, NULL, &gfs2_iomap_ops);
               iomap_apply ... iomap_zero_range_actor
                  iomap_begin
                     gfs2_iomap_begin
                        gfs2_iomap_begin_write
                  actor (iomap_zero_range_actor)
		     iomap_zero
			iomap_write_begin
			   gfs2_iomap_page_prepare
			      gfs2_trans_begin <------------------------

This patch reorders the callers of gfs2_block_zero_range so that they
only start their transactions after the call. It also adds a BUG_ON to
ensure this doesn't happen again.

Fixes: 2257e468a6 ("gfs2: implement gfs2_block_zero_range using iomap_zero_range")
Cc: stable@vger.kernel.org # v5.5+
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-08-26 10:40:48 +02:00
..
Kconfig
Makefile
acl.c
acl.h
aops.c
aops.h
bmap.c gfs2: Never call gfs2_block_zero_range with an open transaction 2020-08-26 10:40:48 +02:00
bmap.h
dentry.c
dir.c
dir.h
export.c
file.c
gfs2.h
glock.c
glock.h
glops.c
glops.h
incore.h
inode.c
inode.h
lock_dlm.c
log.c
log.h
lops.c
lops.h
main.c
meta_io.c
meta_io.h
ops_fstype.c gfs2: read-only mounts should grab the sd_freeze_gl glock 2020-07-22 09:32:53 +02:00
quota.c
quota.h
recovery.c
recovery.h
rgrp.c
rgrp.h
super.c
super.h
sys.c
sys.h
trace_gfs2.h
trans.c
trans.h
util.c
util.h
xattr.c
xattr.h