Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 302272 Details for
Bug 440897
GFS: gfs_fsck should repair gfs_grow corruption (see bug #436383)
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch to fix the problem
bz440897.gfs_fsck.patch (text/plain), 3.71 KB, created by
Robert Peterson
on 2008-04-13 15:37:32 UTC
(
hide
)
Description:
Patch to fix the problem
Filename:
MIME Type:
Creator:
Robert Peterson
Created:
2008-04-13 15:37:32 UTC
Size:
3.71 KB
patch
obsolete
> 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..3a674f5 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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 440897
: 302272