Cluster Project branch, STABLE2, updated. cluster-2.03.00-3-gb8a071f

rpeterso@sourceware.org rpeterso@sourceware.org
Sun Apr 13 16:33:00 GMT 2008


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=b8a071f51986e3a3e9fa670259dd012ec0a23141

The branch, STABLE2 has been updated
       via  b8a071f51986e3a3e9fa670259dd012ec0a23141 (commit)
      from  22663a865681ebcc2f3c921a3ef3967d66d5663f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b8a071f51986e3a3e9fa670259dd012ec0a23141
Author: Bob Peterson <rpeterso@redhat.com>
Date:   Sun Apr 13 11:23:49 2008 -0500

    bz440896/440897 GFS: gfs_fsck should repair gfs_grow corruption
    (see bug #436383)

-----------------------------------------------------------------------

Summary of changes:
 gfs/gfs_fsck/rgrp.c  |   10 ++++++++++
 gfs/gfs_fsck/super.c |   40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/gfs/gfs_fsck/rgrp.c b/gfs/gfs_fsck/rgrp.c
index 601f292..6ef6f74 100644
--- a/gfs/gfs_fsck/rgrp.c
+++ b/gfs/gfs_fsck/rgrp.c
@@ -35,6 +35,16 @@ int fs_compute_bitstructs(struct fsck_rgrp *rgd)
 	uint32 bytes_left, bytes;
 	int x;
 
+	/* Max size of an rg is 2GB.  A 2GB RG with (minimum) 512-byte blocks
+	   has 4194304 blocks.  We can represent 4 blocks in one bitmap byte.
+	   Therefore, all 4194304 blocks can be represented in 1048576 bytes.
+	   Subtract a metadata header for each 512-byte block and we get
+	   488 bytes of bitmap per block.  Divide 1048576 by 488 and we can
+	   be assured we should never have more than 2149 of them. */
+	if (length > 2149 || length == 0) {
+		log_err("Invalid length %u found in rindex.\n", length);
+		return -1;
+	}
 	if(!(rgd->rd_bits = (fs_bitmap_t *)malloc(length * sizeof(fs_bitmap_t)))) {
 		log_err("Unable to allocate bitmap structure\n");
 		stack;
diff --git a/gfs/gfs_fsck/super.c b/gfs/gfs_fsck/super.c
index 8bfb823..55ff997 100644
--- a/gfs/gfs_fsck/super.c
+++ b/gfs/gfs_fsck/super.c
@@ -1070,6 +1070,7 @@ int ri_update(struct fsck_sb *sdp)
 	struct gfs_rindex buf;
 	unsigned int rg, calc_rg_count;
 	int error, count1 = 0, count2 = 0;
+	int fix_grow_problems = 0, grow_problems = 0;
 	enum rgindex_trust_level { /* how far can we trust our RG index? */
 		blind_faith = 0, /* We'd like to trust the rgindex. We always used to
 							before bz 179069. This should cover most cases. */
@@ -1170,12 +1171,41 @@ int ri_update(struct fsck_sb *sdp)
 				osi_list_del(&expected_rgd->rd_list);
 				free(expected_rgd);
 			} /* if we can't trust the rg index */
+			else { /* blind faith -- just check for the gfs_grow problem */
+				if (rgd->rd_ri.ri_data == 4294967292) {
+					if (!fix_grow_problems) {
+						log_err("A problem with the rindex file caused by gfs_grow was detected.\n");
+						if(query(sdp, "Fix the rindex problem? (y/n)"))
+							fix_grow_problems = 1;
+					}
+					/* Keep a counter in case we hit it more than once. */
+					grow_problems++;
+					osi_list_del(&rgd->rd_list); /* take it out of the equation */
+					free(rgd);
+					continue;
+				} else if (fix_grow_problems) {
+					/* Once we detect the gfs_grow rindex problem, we have to */
+					/* rewrite the entire rest of the rindex file, starting   */
+					/* with the entry AFTER the one that has the problem.     */
+					gfs_rindex_out(&rgd->rd_ri, (char *)&buf);
+					error = writei(sdp->riinode, (char *)&buf,
+						       (rg - grow_problems) *
+						       sizeof(struct gfs_rindex),
+						       sizeof(struct gfs_rindex));
+					if (error != sizeof(struct gfs_rindex)) {
+						log_err("Unable to fix rindex entry %u.\n",
+							rg + 1);
+						goto fail;
+					}
+				}
+			}
 			error = fs_compute_bitstructs(rgd);
 			if (error)
 				break;
 			rgd->rd_open_count = 0;
 			count1++;
 		} /* for all RGs in the index */
+		rg -= grow_problems;
 		if (!error) {
 			log_info("%u resource groups found.\n", rg);
 			if (trust_lvl != blind_faith && rg != calc_rg_count)
@@ -1204,6 +1234,16 @@ int ri_update(struct fsck_sb *sdp)
 			}
 			sdp->rgcount = count1;
 		}
+		if (fix_grow_problems) {
+			osi_buf_t *dibh;
+
+			get_and_read_buf(sdp, sdp->sb.sb_rindex_di.no_addr, &dibh, 0);
+			sdp->riinode->i_di.di_size = rg * sizeof(struct gfs_rindex);
+			gfs_dinode_out(&sdp->riinode->i_di, BH_DATA(dibh));
+			write_buf(sdp, dibh, 0);
+			grow_problems = fix_grow_problems = 0;
+			relse_buf(sdp, dibh);
+		}
 		if (!error) { /* if no problems encountered with the rgs */
 			log_info("(passed)\n");
 			break;  /* no reason to distrust what we saw. Otherwise, we


hooks/post-receive
--
Cluster Project



More information about the Cluster-cvs mailing list