gfs2: Do log_flush in gfs2_ail_empty_gl even if ail list is empty
authorBob Peterson <rpeterso@redhat.com>
Wed, 13 Nov 2019 19:47:02 +0000 (13:47 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Apr 2020 08:50:03 +0000 (10:50 +0200)
commit46bbc5526dd72a6b248412769482c164f817a01d
tree3fcfdff730b5005f770dc9881b68e2e6fb6336dd
parentaa547b9dc20f23d51c74adf9d39a9c28084c9ca9
gfs2: Do log_flush in gfs2_ail_empty_gl even if ail list is empty

[ Upstream commit 9ff78289356af640941bbb0dd3f46af2063f0046 ]

Before this patch, if gfs2_ail_empty_gl saw there was nothing on
the ail list, it would return and not flush the log. The problem
is that there could still be a revoke for the rgrp sitting on the
sd_log_le_revoke list that's been recently taken off the ail list.
But that revoke still needs to be written, and the rgrp_go_inval
still needs to call log_flush_wait to ensure the revokes are all
properly written to the journal before we relinquish control of
the glock to another node. If we give the glock to another node
before we have this knowledge, the node might crash and its journal
replayed, in which case the missing revoke would allow the journal
replay to replay the rgrp over top of the rgrp we already gave to
another node, thus overwriting its changes and corrupting the
file system.

This patch makes gfs2_ail_empty_gl still call gfs2_log_flush rather
than returning.

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