Skip to contentSkip to conversation

GFS2: force a log flush when invalidating the rindex glock

PATCH New Benjamin Marzinski 2 participants 2 messages Jun 13, 2011 – Jun 14, 2011 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GFS2: force a log flush when invalidating the rindex glock

Right now, there is nothing that forces the log to get flushed when a node drops its rindex glock so that another node can grow the filesystem. If the log doesn't get flushed, GFS2 can corrupt the sd_log_le_rg list in the following way.

A node puts an rgd on the list in rg_lo_add(), and then the rindex glock is dropped so the other node can grow the filesystem. When the node reacquires the rindex glock, that rgd gets deleted in clear_rgrpdi() before ever being removed from the list by gfs2_log_flush().

This code simply forces a log flush when the rindex glock is invalidated, solving the problem.

---
 fs/gfs2/glops.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/gfs2/glops.c +3 -1
Index: gfs2-2.6-nmw/fs/gfs2/glops.c
===================================================================
@@ -221,8 +221,10 @@ static void inode_go_inval(struct gfs2_g
 		}
 	}
 
-	if (ip == GFS2_I(gl->gl_sbd->sd_rindex))
+	if (ip == GFS2_I(gl->gl_sbd->sd_rindex)) {
+		gfs2_log_flush(gl->gl_sbd, NULL);
 		gl->gl_sbd->sd_rindex_uptodate = 0;
+	}
 	if (ip && S_ISREG(ip->i_inode.i_mode))
 		truncate_inode_pages(ip->i_inode.i_mapping, 0);
 }
#1 lore raw

PATCH 1/1 GFS2: force a log flush when invalidating the rindex glock

Hi,

Quoted 25 lines · Benjamin Marzinski

Right now, there is nothing that forces the log to get flushed when a node drops its rindex glock so that another node can grow the filesystem. If the log doesn't get flushed, GFS2 can corrupt the sd_log_le_rg list in the following way.

A node puts an rgd on the list in rg_lo_add(), and then the rindex glock is dropped so the other node can grow the filesystem. When the node reacquires the rindex glock, that rgd gets deleted in clear_rgrpdi() before ever being removed from the list by gfs2_log_flush().

This code simply forces a log flush when the rindex glock is invalidated, solving the problem.

---
 fs/gfs2/glops.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: gfs2-2.6-nmw/fs/gfs2/glops.c
===================================================================

fs/gfs2/glops.c +0 -0
@@ -221,8 +221,10 @@ static void inode_go_inval(struct gfs2_g
 		}

fs/gfs2/glops.c static void inode_go_inval(struct gfs2_g · line 230

Quoted 10 lines
fs/gfs2/glops.c +3 -1
 	}
 
-	if (ip == GFS2_I(gl->gl_sbd->sd_rindex))
+	if (ip == GFS2_I(gl->gl_sbd->sd_rindex)) {
+		gfs2_log_flush(gl->gl_sbd, NULL);
 		gl->gl_sbd->sd_rindex_uptodate = 0;
+	}
 	if (ip && S_ISREG(ip->i_inode.i_mode))
 		truncate_inode_pages(ip->i_inode.i_mapping, 0);
 }

Now in the -nmw git tree. Thanks,

Steve.