Before this patch, function rgrp_go_inval just assumed all the
writes submitted to the journal were finished and successful. But
if they're not, and a revoke fails to make its way to the journal,
a journal replay on another node will cause corruption if we
let the go_inval function continue and tell dlm to release the
glock to another node. This patch adds a couple assert_withdraws
in the rgrp_go_inval function. The assert should cause another
node to replay the journal before continuing, thus protecting the
rgrp glock and maintaining the integrity of the rgrp.

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

diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index f372a6f169a2..64b8e5e808d8 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -168,8 +168,7 @@ static void rgrp_go_sync(struct gfs2_glock *gl)
        error = filemap_fdatawait_range(mapping, gl->gl_vm.start, 
gl->gl_vm.end);
        mapping_set_error(mapping, error);
        gfs2_ail_empty_gl(gl);
-       gfs2_assert_withdraw(gl->gl_name.ln_sbd,
-                            gl->gl_name.ln_sbd->sd_log_error == 0);
+       gfs2_assert_withdraw(sdp, gl->gl_name.ln_sbd->sd_log_error == 0);
 
        spin_lock(&gl->gl_lockref.lock);
        rgd = gl->gl_object;
@@ -202,6 +201,8 @@ static void rgrp_go_inval(struct gfs2_glock *gl, int flags)
        truncate_inode_pages_range(mapping, gl->gl_vm.start, gl->gl_vm.end);
        gfs2_ail_empty_gl(gl);
 
+       gfs2_assert_withdraw(sdp, sdp->sd_log_error == 0);
+
        if (rgd)
                rgd->rd_flags &= ~GFS2_RDF_UPTODATE;
 }
-- 
2.20.1

Reply via email to