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 146215 Details for
Bug 223506
gfs2_fsck: fatal: invalid metadata block
[?]
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]
Proposed patch to fix the problem
223506.patch (text/plain), 15.56 KB, created by
Robert Peterson
on 2007-01-22 19:55:02 UTC
(
hide
)
Description:
Proposed patch to fix the problem
Filename:
MIME Type:
Creator:
Robert Peterson
Created:
2007-01-22 19:55:02 UTC
Size:
15.56 KB
patch
obsolete
>Index: fsck/fsck.h >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/fsck/fsck.h,v >retrieving revision 1.3 >diff -w -u -p -p -u -r1.3 fsck.h >--- fsck/fsck.h 12 Jun 2006 20:41:43 -0000 1.3 >+++ fsck/fsck.h 22 Jan 2007 19:45:12 -0000 >@@ -58,7 +58,8 @@ extern struct gfs2_inode *lf_dip; /* Los > extern osi_list_t dir_hash[FSCK_HASH_SIZE]; > extern osi_list_t inode_hash[FSCK_HASH_SIZE]; > extern struct gfs2_block_list *bl; >-extern uint64_t last_fs_block; >+extern uint64_t last_fs_block, last_reported_block; >+extern int skip_this_pass, fsck_abort, fsck_query; > extern uint64_t last_data_block; > extern uint64_t first_data_block; > extern osi_list_t dup_list; >Index: fsck/initialize.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/fsck/initialize.c,v >retrieving revision 1.6 >diff -w -u -p -p -u -r1.6 initialize.c >--- fsck/initialize.c 20 Sep 2006 16:43:25 -0000 1.6 >+++ fsck/initialize.c 22 Jan 2007 19:45:12 -0000 >@@ -95,6 +95,7 @@ static void empty_super_block(struct gfs > { > uint32_t i; > >+ log_info("Freeing buffers.\n"); > while(!osi_list_empty(&sdp->rglist)){ > struct rgrp_list *rgd; > >@@ -157,6 +158,12 @@ static int set_block_ranges(struct gfs2_ > } > > last_fs_block = rmax; >+ if (last_fs_block > 0xffffffff && sizeof(unsigned long) <= 4) { >+ log_crit("This file system is too big for this computer to handle.\n"); >+ log_crit("Last fs block = 0x%llx, but sizeof(unsigned long) is %d bytes.\n", >+ last_fs_block, sizeof(unsigned long)); >+ goto fail; >+ } > > last_data_block = rmax; > first_data_block = rmin; >Index: fsck/main.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/fsck/main.c,v >retrieving revision 1.4 >diff -w -u -p -p -u -r1.4 main.c >--- fsck/main.c 15 Jun 2006 18:48:45 -0000 1.4 >+++ fsck/main.c 22 Jan 2007 19:45:12 -0000 >@@ -17,6 +17,8 @@ > #include <libgen.h> > #include <string.h> > #include <stdarg.h> >+#include <ctype.h> >+#include <signal.h> > > #include "copyright.cf" > #include "libgfs2.h" >@@ -28,7 +30,9 @@ struct gfs2_inode *lf_dip; /* Lost and f > osi_list_t dir_hash[FSCK_HASH_SIZE]; > osi_list_t inode_hash[FSCK_HASH_SIZE]; > struct gfs2_block_list *bl; >-uint64_t last_fs_block; >+uint64_t last_fs_block, last_reported_block = -1; >+int skip_this_pass = FALSE, fsck_abort = FALSE; >+const char *pass = ""; > uint64_t last_data_block; > uint64_t first_data_block; > osi_list_t dup_list; >@@ -133,6 +137,61 @@ int read_cmdline(int argc, char **argv, > return 0; > } > >+void interrupt(int sig) >+{ >+ fd_set rfds; >+ struct timeval tv; >+ char response; >+ int err; >+ >+ if (opts.query) /* if we're asking them a question */ >+ return; /* ignore the interrupt signal */ >+ FD_ZERO(&rfds); >+ FD_SET(STDIN_FILENO, &rfds); >+ >+ tv.tv_sec = 0; >+ tv.tv_usec = 0; >+ /* Make sure there isn't extraneous input before asking the >+ * user the question */ >+ while((err = select(STDIN_FILENO + 1, &rfds, NULL, NULL, &tv))) { >+ if(err < 0) { >+ log_debug("Error in select() on stdin\n"); >+ break; >+ } >+ read(STDIN_FILENO, &response, sizeof(char)); >+ } >+ while (TRUE) { >+ printf("\ngfs_fsck interrupted in %s: ", pass); >+ if (!last_reported_block || last_reported_block == last_fs_block) >+ printf("progress unknown.\n"); >+ else >+ printf("processing block %" PRIu64 " out of %" PRIu64 "\n", >+ last_reported_block, last_fs_block); >+ printf("Do you want to abort gfs_fsck, skip the rest of %s or continue (a/s/c)?", pass); >+ >+ /* Make sure query is printed out */ >+ fflush(stdout); >+ read(STDIN_FILENO, &response, sizeof(char)); >+ >+ if(tolower(response) == 's') { >+ skip_this_pass = TRUE; >+ return; >+ } >+ else if (tolower(response) == 'a') { >+ fsck_abort = TRUE; >+ return; >+ } >+ else if (tolower(response) == 'c') >+ return; >+ else { >+ while(response != '\n') >+ read(STDIN_FILENO, &response, sizeof(char)); >+ printf("Bad response, please type 'c', 'a' or 's'.\n"); >+ continue; >+ } >+ } >+} >+ > int main(int argc, char **argv) > { > struct gfs2_sbd sb; >@@ -148,41 +207,97 @@ int main(int argc, char **argv) > if (initialize(sbp)) > return 1; > >+ signal(SIGINT, interrupt); > log_notice("Starting pass1\n"); >+ pass = "pass 1"; >+ last_reported_block = 0; > if (pass1(sbp)) > return 1; >+ if (skip_this_pass || fsck_abort) { >+ skip_this_pass = FALSE; >+ log_notice("Pass1 interrupted \n"); >+ } >+ else > log_notice("Pass1 complete \n"); > >+ if (!fsck_abort) { >+ last_reported_block = 0; >+ pass = "pass 1b"; > log_notice("Starting pass1b\n"); > if(pass1b(sbp)) > return 1; >+ if (skip_this_pass || fsck_abort) { >+ skip_this_pass = FALSE; >+ log_notice("Pass1b interrupted \n"); >+ } >+ else > log_notice("Pass1b complete\n"); >- >+ } >+ if (!fsck_abort) { >+ last_reported_block = 0; >+ pass = "pass 1c"; > log_notice("Starting pass1c\n"); > if(pass1c(sbp)) > return 1; >+ if (skip_this_pass || fsck_abort) { >+ skip_this_pass = FALSE; >+ log_notice("Pass1c interrupted \n"); >+ } >+ else > log_notice("Pass1c complete\n"); >- >+ } >+ if (!fsck_abort) { >+ last_reported_block = 0; >+ pass = "pass 2"; > log_notice("Starting pass2\n"); > if (pass2(sbp)) > return 1; >+ if (skip_this_pass || fsck_abort) { >+ skip_this_pass = FALSE; >+ log_notice("Pass2 interrupted \n"); >+ } >+ else > log_notice("Pass2 complete \n"); >- >+ } >+ if (!fsck_abort) { >+ last_reported_block = 0; >+ pass = "pass 3"; > log_notice("Starting pass3\n"); > if (pass3(sbp)) > return 1; >+ if (skip_this_pass || fsck_abort) { >+ skip_this_pass = FALSE; >+ log_notice("Pass3 interrupted \n"); >+ } >+ else > log_notice("Pass3 complete \n"); >- >+ } >+ if (!fsck_abort) { >+ last_reported_block = 0; >+ pass = "pass 4"; > log_notice("Starting pass4\n"); > if (pass4(sbp)) > return 1; >+ if (skip_this_pass || fsck_abort) { >+ skip_this_pass = FALSE; >+ log_notice("Pass4 interrupted \n"); >+ } >+ else > log_notice("Pass4 complete \n"); >- >+ } >+ if (!fsck_abort) { >+ last_reported_block = 0; >+ pass = "pass 5"; > log_notice("Starting pass5\n"); > if (pass5(sbp)) > return 1; >+ if (skip_this_pass || fsck_abort) { >+ skip_this_pass = FALSE; >+ log_notice("Pass5 interrupted \n"); >+ } >+ else > log_notice("Pass5 complete \n"); >- >+ } > /* Free up our system inodes */ > inode_put(sbp->md.inum, updated); > inode_put(sbp->md.statfs, updated); >Index: fsck/pass1.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/fsck/pass1.c,v >retrieving revision 1.4 >diff -w -u -p -p -u -r1.4 pass1.c >--- fsck/pass1.c 20 Jun 2006 18:30:55 -0000 1.4 >+++ fsck/pass1.c 22 Jan 2007 19:45:12 -0000 >@@ -801,6 +801,13 @@ int pass1(struct gfs2_sbd *sbp) > if (gfs2_next_rg_meta(rgd, &block, first)) > break; > warm_fuzzy_stuff(block); >+ if (fsck_abort) /* if asked to abort */ >+ return 0; >+ if (skip_this_pass) { >+ printf("Skipping pass 1 is not a good idea.\n"); >+ skip_this_pass = FALSE; >+ fflush(stdout); >+ } > bh = bread(sbp, block); > > if (scan_meta(sbp, bh, block)) { >Index: fsck/pass1b.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/fsck/pass1b.c,v >retrieving revision 1.3 >diff -w -u -p -p -u -r1.3 pass1b.c >--- fsck/pass1b.c 12 Jun 2006 20:41:43 -0000 1.3 >+++ fsck/pass1b.c 22 Jan 2007 19:45:13 -0000 >@@ -466,6 +466,7 @@ int pass1b(struct gfs2_sbd *sbp) > osi_list_t *tmp; > struct metawalk_fxns find_dirents = {0}; > find_dirents.check_dentry = &find_dentry; >+ int rc = 0; > > osi_list_init(&dup_list); > /* Shove all blocks marked as duplicated into a list */ >@@ -484,11 +485,15 @@ int pass1b(struct gfs2_sbd *sbp) > log_debug("Filesystem has %"PRIu64" (0x%" PRIx64 ") blocks total\n", > last_fs_block, last_fs_block); > for(i = 0; i < last_fs_block; i += 1) { >+ warm_fuzzy_stuff(i); >+ if (skip_this_pass || fsck_abort) /* if asked to skip the rest */ >+ goto out; > log_debug("Scanning block %" PRIu64 " (0x%" PRIx64 ") for inodes\n", > i, i); > if(gfs2_block_check(bl, i, &q)) { > stack; >- return -1; >+ rc = -1; >+ goto out; > } > if((q.block_type == gfs2_inode_dir) || > (q.block_type == gfs2_inode_file) || >@@ -501,33 +506,26 @@ int pass1b(struct gfs2_sbd *sbp) > b = osi_list_entry(tmp, struct blocks, list); > if(find_block_ref(sbp, i, b)) { > stack; >- return -1; >+ rc = -1; >+ goto out; > } > } > } >- } >- >- /* Rescan the fs looking for directory entries to the inodes >- * with duplicate blocks - might need this to deal with the >- * inode correctly */ >- log_info("Looking through directory entries for inodes with duplicate blocks...\n"); >- for(i = 0; i < last_fs_block; i++) { >- if(gfs2_block_check(bl, i, &q)) { >- stack; >- return 0; >- } > if(q.block_type == gfs2_inode_dir) { > check_dir(sbp, i, &find_dirents); > } > } > >- > /* Fix dups here - it's going to slow things down a lot to fix > * it later */ > log_info("Handling duplicate blocks\n"); >- osi_list_foreach(tmp, &dup_list) { >+out: >+ while (!osi_list_empty(&dup_list)) { > b = osi_list_entry(tmp, struct blocks, list); >+ if (!skip_this_pass && !rc) /* no error & not asked to skip the rest */ > handle_dup_blk(sbp, b); >+ osi_list_del(&b->list); >+ free(b); > } >- return 0; >+ return rc; > } >Index: fsck/pass1c.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/fsck/pass1c.c,v >retrieving revision 1.4 >diff -w -u -p -p -u -r1.4 pass1c.c >--- fsck/pass1c.c 20 Jun 2006 18:30:55 -0000 1.4 >+++ fsck/pass1c.c 22 Jan 2007 19:45:13 -0000 >@@ -235,6 +235,8 @@ int pass1c(struct gfs2_sbd *sbp) > log_info("Looking for inodes containing ea blocks...\n"); > while (!gfs2_find_next_block_type(bl, gfs2_eattr_block, &block_no)) { > >+ if (skip_this_pass || fsck_abort) /* if asked to skip the rest */ >+ return 0; > log_info("EA in inode %"PRIu64" (0x%" PRIx64 ")\n", block_no, > block_no); > bh = bread(sbp, block_no); >Index: fsck/pass2.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/fsck/pass2.c,v >retrieving revision 1.4 >diff -w -u -p -p -u -r1.4 pass2.c >--- fsck/pass2.c 15 Jun 2006 18:48:45 -0000 1.4 >+++ fsck/pass2.c 22 Jan 2007 19:45:13 -0000 >@@ -757,8 +757,13 @@ int pass2(struct gfs2_sbd *sbp) > stack; > return -1; > } >+ log_info("Checking directory inodes.\n"); > /* Grab each directory inode, and run checks on it */ > for(i = 0; i < last_fs_block; i++) { >+ warm_fuzzy_stuff(i); >+ if (skip_this_pass || fsck_abort) /* if asked to skip the rest */ >+ return 0; >+ > /* Skip the root inode - it's checked above */ > if(i == sbp->md.rooti->i_di.di_num.no_addr) > continue; >Index: fsck/pass3.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/fsck/pass3.c,v >retrieving revision 1.4 >diff -w -u -p -p -u -r1.4 pass3.c >--- fsck/pass3.c 15 Jun 2006 18:48:45 -0000 1.4 >+++ fsck/pass3.c 22 Jan 2007 19:45:13 -0000 >@@ -214,6 +214,8 @@ int pass3(struct gfs2_sbd *sbp) > /* FIXME: Change this so it returns success or > * failure and put the parent inode in a > * param */ >+ if (skip_this_pass || fsck_abort) /* if asked to skip the rest */ >+ return 0; > tdi = mark_and_return_parent(sbp, di); > > /* FIXME: Factor this ? */ >Index: fsck/pass4.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/fsck/pass4.c,v >retrieving revision 1.4 >diff -w -u -p -p -u -r1.4 pass4.c >--- fsck/pass4.c 15 Jun 2006 18:48:45 -0000 1.4 >+++ fsck/pass4.c 22 Jan 2007 19:45:13 -0000 >@@ -48,6 +48,8 @@ int scan_inode_list(struct gfs2_sbd *sbp > /* FIXME: should probably factor this out into a generic > * scanning fxn */ > osi_list_foreach(tmp, list) { >+ if (skip_this_pass || fsck_abort) /* if asked to skip the rest */ >+ return 0; > f = not_updated; > if(!(ii = osi_list_entry(tmp, struct inode_info, list))) { > log_crit("osi_list_foreach broken in scan_info_list!!\n"); >@@ -165,6 +167,8 @@ int pass4(struct gfs2_sbd *sbp) > lf_dip->i_di.di_entries); > log_info("Checking inode reference counts.\n"); > for (i = 0; i < FSCK_HASH_SIZE; i++) { >+ if (skip_this_pass || fsck_abort) /* if asked to skip the rest */ >+ return 0; > list = &inode_hash[i]; > if(scan_inode_list(sbp, list)) { > stack; >Index: fsck/pass5.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/fsck/pass5.c,v >retrieving revision 1.3 >diff -w -u -p -p -u -r1.3 pass5.c >--- fsck/pass5.c 12 Jun 2006 20:41:43 -0000 1.3 >+++ fsck/pass5.c 22 Jan 2007 19:45:13 -0000 >@@ -77,7 +77,10 @@ int check_block_status(struct gfs2_sbd * > while(byte < end) { > rg_status = ((*byte >> bit) & GFS2_BIT_MASK); > block = rg_data + *rg_block; >+ log_debug("Checking block %" PRIu64 "\n", block); > warm_fuzzy_stuff(block); >+ if (skip_this_pass || fsck_abort) /* if asked to skip the rest */ >+ return 0; > gfs2_block_check(bl, block, &q); > > block_status = convert_mark(q.block_type, count); >@@ -128,6 +131,8 @@ enum update_flags update_rgrp(struct gfs > /* update the bitmaps */ > check_block_status(sbp, rgp->bh[i]->b_data + bits->bi_offset, > bits->bi_len, &rg_block, rgp->ri.ri_data0, count); >+ if (skip_this_pass || fsck_abort) /* if asked to skip the rest */ >+ return 0; > } > > /* actually adjust counters and write out to disk */ >@@ -180,6 +185,8 @@ int pass5(struct gfs2_sbd *sbp) > for(tmp = sbp->rglist.next; tmp != &sbp->rglist; tmp = tmp->next){ > enum update_flags f; > >+ if (skip_this_pass || fsck_abort) /* if asked to skip the rest */ >+ return 0; > log_info("Verifying Resource Group #%" PRIu64 "\n", rg_count); > memset(count, 0, sizeof(count)); > rgp = osi_list_entry(tmp, struct rgrp_list, list); >Index: fsck/util.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/fsck/util.c,v >retrieving revision 1.4 >diff -w -u -p -p -u -r1.4 util.c >--- fsck/util.c 15 Jun 2006 18:48:45 -0000 1.4 >+++ fsck/util.c 22 Jan 2007 19:45:13 -0000 >@@ -61,6 +61,7 @@ void warm_fuzzy_stuff(uint64_t block) > static struct timeval tv; > static uint32_t seconds = 0; > >+ last_reported_block = block; > gettimeofday(&tv, NULL); > if (!seconds) > seconds = tv.tv_sec; >@@ -68,10 +69,12 @@ void warm_fuzzy_stuff(uint64_t block) > uint64_t percent; > > seconds = tv.tv_sec; >+ if (last_fs_block) { > percent = (block * 100) / last_fs_block; > log_notice("\r%" PRIu64 " percent complete.\r", percent); > } > } >+} > > const char *block_type_string(struct gfs2_block_query *q) > { >Index: libgfs2/gfs2_log.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/libgfs2/gfs2_log.c,v >retrieving revision 1.2 >diff -w -u -p -p -u -r1.2 gfs2_log.c >--- libgfs2/gfs2_log.c 15 Jun 2006 18:45:22 -0000 1.2 >+++ libgfs2/gfs2_log.c 22 Jan 2007 19:45:13 -0000 >@@ -103,6 +103,7 @@ int query(struct gfs2_options *opts, con > if(opts->no) > return 0; > >+ opts->query = TRUE; > /* Watch stdin (fd 0) to see when it has input. */ > FD_ZERO(&rfds); > FD_SET(STDIN_FILENO, &rfds); >@@ -150,5 +151,6 @@ int query(struct gfs2_options *opts, con > read(STDIN_FILENO, &response, sizeof(char)); > } > >+ opts->query = FALSE; > return ret; > } >Index: libgfs2/libgfs2.h >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/libgfs2/libgfs2.h,v >retrieving revision 1.8 >diff -w -u -p -p -u -r1.8 libgfs2.h >--- libgfs2/libgfs2.h 30 Nov 2006 15:25:49 -0000 1.8 >+++ libgfs2/libgfs2.h 22 Jan 2007 19:45:13 -0000 >@@ -437,6 +437,7 @@ struct gfs2_options { > char *device; > int yes:1; > int no:1; >+ int query:1; > }; > > #define MSG_DEBUG 7 >Index: mount/util.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/mount/util.c,v >retrieving revision 1.21 >diff -w -u -p -p -u -r1.21 util.c
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 223506
: 146215