From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 608 invoked by alias); 14 Apr 2008 15:43:29 -0000 Received: (qmail 575 invoked by uid 9582); 14 Apr 2008 15:43:29 -0000 Date: Mon, 14 Apr 2008 15:43:00 -0000 Message-ID: <20080414154329.554.qmail@sourceware.org> From: rpeterso@sourceware.org To: cluster-cvs@sources.redhat.com, cluster-devel@redhat.com Subject: Cluster Project branch, RHEL4, updated. gfs-kernel_2_6_9_76-31-g5f03c06 X-Git-Refname: refs/heads/RHEL4 X-Git-Reftype: branch X-Git-Oldrev: 625364c99277445b97bbb3120736c358b802fb0f X-Git-Newrev: 5f03c06d964894819c182b5112af75e5ee44a256 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2008-q2/txt/msg00080.txt.bz2 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=5f03c06d964894819c182b5112af75e5ee44a256 The branch, RHEL4 has been updated via 5f03c06d964894819c182b5112af75e5ee44a256 (commit) from 625364c99277445b97bbb3120736c358b802fb0f (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 5f03c06d964894819c182b5112af75e5ee44a256 Author: Bob Peterson 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 3948106..cf8e3ed 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