gfs2: add some much needed cleanup for log flushes that fail
authorBob Peterson <rpeterso@redhat.com>
Fri, 21 Aug 2020 13:50:34 +0000 (08:50 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Sep 2020 17:14:09 +0000 (19:14 +0200)
commit4f3ffd5fcbf77a0bb497a89c1b28c2a4532a9101
treefd60849fe27364b8269e57198a414d17eea15154
parent2ed484c404e02ae83fc8a4108c35900c1236e8e6
gfs2: add some much needed cleanup for log flushes that fail

[ Upstream commit 462582b99b6079a6fbcdfc65bac49f5c2a27cfff ]

When a log flush fails due to io errors, it signals the failure but does
not clean up after itself very well. This is because buffers are added to
the transaction tr_buf and tr_databuf queue, but the io error causes
gfs2_log_flush to bypass the "after_commit" functions responsible for
dequeueing the bd elements. If the bd elements are added to the ail list
before the error, function ail_drain takes care of dequeueing them.
But if they haven't gotten that far, the elements are forgotten and
make the transactions unable to be freed.

This patch introduces new function trans_drain which drains the bd
elements from the transaction so they can be freed properly.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/gfs2/log.c
fs/gfs2/trans.c