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)
committerBob Peterson <rpeterso@redhat.com>
Thu, 27 Feb 2020 13:53:18 +0000 (07:53 -0600)
commit9ff78289356af640941bbb0dd3f46af2063f0046
tree2e973bf0e97bafa63d3cae19421d35692bd5e85d
parentd93ae386ef3d1bf4d683f870ad8e838159ec451d
gfs2: Do log_flush in gfs2_ail_empty_gl even if ail list is empty

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>
fs/gfs2/glops.c
fs/gfs2/log.c
fs/gfs2/log.h