Before this patch,function gfs2_log_flush only did flush work if
it saw the LFLUSH flag on the given glock. However, that glock still
needs to be flushed if it has revokes attached that are still pending.
If we don't flush them, they can be missed in the journal and a
journal replay can replay metadata that should have been revoked.

This patch adds an additional check to gfs2_log_flush for this condition.

Signed-off-by: Bob Peterson <rpete...@redhat.com>
---
 fs/gfs2/log.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 6b5bac203d6d..80b8220c532f 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -789,7 +789,8 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock 
*gl, u32 flags)
        down_write(&sdp->sd_log_flush_lock);
 
        /* Log might have been flushed while we waited for the flush lock */
-       if (gl && !test_bit(GLF_LFLUSH, &gl->gl_flags)) {
+       if (gl && !test_bit(GLF_LFLUSH, &gl->gl_flags) &&
+           atomic_read(&gl->gl_revokes) == 0) {
                up_write(&sdp->sd_log_flush_lock);
                return;
        }
-- 
2.23.0

Reply via email to