gfs2: Recursive gfs2_quota_hold in gfs2_iomap_end
authorAndreas Gruenbacher <agruenba@redhat.com>
Tue, 9 Feb 2021 17:32:32 +0000 (18:32 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:38:44 +0000 (11:38 +0100)
commiteb8128c5bb7f03541515fb90364ca5d488eb901c
tree99567cf54b7ec7e963b07d3781d22e44c3bb0b06
parenta646a3164b42658f54c493c6061624afb05f85f8
gfs2: Recursive gfs2_quota_hold in gfs2_iomap_end

commit 7009fa9cd9a5262944b30eb7efb1f0561d074b68 upstream.

When starting an iomap write, gfs2_quota_lock_check -> gfs2_quota_lock
-> gfs2_quota_hold is called from gfs2_iomap_begin.  At the end of the
write, before unlocking the quotas, punch_hole -> gfs2_quota_hold can be
called again in gfs2_iomap_end, which is incorrect and leads to a failed
assertion.  Instead, move the call to gfs2_quota_unlock before the call
to punch_hole to fix that.

Fixes: 64bc06bb32ee ("gfs2: iomap buffered write support")
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/gfs2/bmap.c