[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH 4 of 5]Bz #248176: GFS2: invalid metadata block, gfs2_meta_indirect_buffer



This is patch 4 of 5 for bug #248176.

There was metadata corruption caused because the clone bitmaps weren't
being kept in sync with the regular bitmaps in some cases.
Code was added to keep them in sync.
--
Signed-off-by: Bob Peterson <rpeterso redhat com> 
--
--- a/rgrp.c	2007-07-23 22:38:17.000000000 -0500
+++ b/rgrp.c	2007-07-23 22:07:37.000000000 -0500
@@ -54,6 +54,7 @@ static const char valid_change[16] = {
 
 static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal,
                         unsigned char old_state, unsigned char new_state);
+void gfs2_rgrp_repolish_clones(struct gfs2_rgrpd *rgd);
 
 /**
  * gfs2_setbit - Set a bit in the bitmaps
@@ -727,6 +728,9 @@ int gfs2_rgrp_bh_get(struct gfs2_rgrpd *
 	if (rgd->rd_rg_vn != gl->gl_vn) {
 		gfs2_rgrp_in(&rgd->rd_rg, (rgd->rd_bits[0].bi_bh)->b_data);
 		rgd->rd_rg_vn = gl->gl_vn;
+		bi = rgd->rd_bits + x;
+		if (bi->bi_clone)
+			gfs2_rgrp_repolish_clones(rgd);
 	}
 
 	spin_lock(&sdp->sd_rindex_spin);
@@ -1374,6 +1378,8 @@ static struct gfs2_rgrpd *rgblk_free(str
 		gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1);
 		gfs2_setbit(rgd, bi->bi_bh->b_data + bi->bi_offset,
 			    bi->bi_len, buf_blk, new_state);
+		gfs2_setbit(rgd, bi->bi_clone + bi->bi_offset,
+			    bi->bi_len, buf_blk, new_state);
 	}
 
 	return rgd;
@@ -1530,6 +1536,9 @@ void gfs2_free_data(struct gfs2_inode *i
 		return;
 
 	rgd->rd_rg.rg_free += blen;
+	spin_lock(&sdp->sd_rindex_spin);
+	rgd->rd_free_clone += blen;
+	spin_unlock(&sdp->sd_rindex_spin);
 
 	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
 	gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);
@@ -1558,6 +1567,9 @@ void gfs2_free_meta(struct gfs2_inode *i
 		return;
 
 	rgd->rd_rg.rg_free += blen;
+	spin_lock(&sdp->sd_rindex_spin);
+	rgd->rd_free_clone += blen;
+	spin_unlock(&sdp->sd_rindex_spin);
 
 	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
 	gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);
@@ -1598,6 +1610,9 @@ static void gfs2_free_uninit_di(struct g
 		gfs2_consist_rgrpd(rgd);
 	rgd->rd_rg.rg_dinodes--;
 	rgd->rd_rg.rg_free++;
+	spin_lock(&sdp->sd_rindex_spin);
+	rgd->rd_free_clone++;
+	spin_unlock(&sdp->sd_rindex_spin);
 
 	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
 	gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]