Skip to contentSkip to conversation

GFS2: Patch to protect sd_log_num_jdata

PATCH New Bob Peterson 2 participants 2 messages Aug 22, 2007 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GFS2: Patch to protect sd_log_num_jdata

Hi,

This is a patch to GFS2 to protect sd_log_num_jdata with the gfs2_log_lock. Without this patch, there is a timing window where you can get hit the following assert from function gfs2_log_flush():

gfs2_assert_withdraw(sdp,

			sdp->sd_log_num_buf + sdp->sd_log_num_jdata ==
			sdp->sd_log_commited_buf +
			sdp->sd_log_commited_databuf);

I've tested it on my roth cluster and it fixes the problem.

Regards,

Bob Peterson
--

fs/gfs2/lops.c +2 -1
diff -pur a/fs/gfs2/lops.c b/fs/gfs2/lops.c
@@ -492,11 +492,12 @@ static void databuf_lo_add(struct gfs2_s
 
 	gfs2_trans_add_gl(bd->bd_gl);
 	if (gfs2_is_jdata(ip)) {
-		sdp->sd_log_num_jdata++;
 		gfs2_pin(sdp, bd->bd_bh);
 		tr->tr_num_databuf_new++;
 	}
 	gfs2_log_lock(sdp);
+	if (gfs2_is_jdata(ip))
+		sdp->sd_log_num_jdata++;
 	sdp->sd_log_num_databuf++;
 	list_add(&le->le_list, &sdp->sd_log_le_databuf);
 	gfs2_log_unlock(sdp);
#1 lore raw

PATCH 1/1 GFS2: Patch to protect sd_log_num_jdata

Hi,

Now in the -nmw git tree. Thanks,

Steve.

Quoted 37 lines · Bob Peterson

Hi,

This is a patch to GFS2 to protect sd_log_num_jdata with the gfs2_log_lock. Without this patch, there is a timing window where you can get hit the following assert from function gfs2_log_flush():

gfs2_assert_withdraw(sdp,

			sdp->sd_log_num_buf + sdp->sd_log_num_jdata ==
			sdp->sd_log_commited_buf +
			sdp->sd_log_commited_databuf);

I've tested it on my roth cluster and it fixes the problem.

Regards,

Bob Peterson
--
diff -pur a/fs/gfs2/lops.c b/fs/gfs2/lops.c

fs/gfs2/lops.c +2 -1
@@ -492,11 +492,12 @@ static void databuf_lo_add(struct gfs2_s
 
 	gfs2_trans_add_gl(bd->bd_gl);
 	if (gfs2_is_jdata(ip)) {
-		sdp->sd_log_num_jdata++;
 		gfs2_pin(sdp, bd->bd_bh);
 		tr->tr_num_databuf_new++;
 	}
 	gfs2_log_lock(sdp);
+	if (gfs2_is_jdata(ip))
+		sdp->sd_log_num_jdata++;
 	sdp->sd_log_num_databuf++;
 	list_add(&le->le_list, &sdp->sd_log_le_databuf);
 	gfs2_log_unlock(sdp);