Bob Peterson 70499cdfeb gfs2: Never call gfs2_block_zero_range with an open transaction
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: 2257e468a63b ("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>
2020-08-07 17:22:55 +02:00
..
2020-03-27 09:29:56 +00:00
2020-06-27 22:04:24 -07:00
2020-07-08 08:27:56 +02:00
2020-07-12 10:58:35 -07:00
2020-06-01 12:10:17 -07:00
2020-06-05 16:43:16 -07:00
2020-06-09 11:28:59 -07:00
2020-06-09 15:48:24 -07:00
2020-06-02 15:29:19 -07:00
2020-06-13 12:44:30 -07:00
2020-06-02 15:29:19 -07:00
2020-06-02 20:11:35 -07:00
2020-06-09 15:40:50 -07:00
\n
2020-06-04 13:53:10 -07:00
2020-06-05 14:05:57 -07:00
2020-06-02 15:29:19 -07:00
2020-06-04 13:50:13 -07:00
2020-06-14 09:47:25 -07:00
2020-05-14 16:44:25 +02:00
2020-06-05 16:26:36 -07:00
2020-06-15 08:51:38 -06:00
2020-06-11 10:33:13 -07:00
2020-05-14 16:44:24 +02:00
2020-07-08 08:27:57 +02:00
2020-06-02 19:45:12 -07:00
2020-06-09 15:40:50 -07:00
2020-05-14 16:44:24 +02:00
2020-04-09 15:33:09 -04:00