From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29258 invoked by alias); 31 Mar 2009 15:47:32 -0000 Received: (qmail 29207 invoked by alias); 31 Mar 2009 15:47:31 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion.fedora.phx.redhat.com Subject: cluster: STABLE3 - GFS2: gfs2_edit savemeta not saving per_node quota files To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE3 X-Git-Reftype: branch X-Git-Oldrev: 5b4a380d9b65d51688f84bad147023fe5c648385 X-Git-Newrev: 7378622847b57be25e19eb06f55a567e6be7a00b From: Bob Peterson Message-Id: <20090331154702.AA3E5120197@lists.fedorahosted.org> Date: Tue, 31 Mar 2009 15:47:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 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: 2009-q1/txt/msg00997.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=7378622847b57be25e19eb06f55a567e6be7a00b Commit: 7378622847b57be25e19eb06f55a567e6be7a00b Parent: 5b4a380d9b65d51688f84bad147023fe5c648385 Author: Bob Peterson AuthorDate: Tue Mar 31 10:19:30 2009 -0500 Committer: Bob Peterson CommitterDate: Tue Mar 31 10:46:33 2009 -0500 GFS2: gfs2_edit savemeta not saving per_node quota files bz 483799 The per-node quota files were not being saved by gfs2_edit savemeta. If you restore the file system with restoremeta, using a different device (as we do here to analyze file system corruption) the resulting file system is not mountable. It will often cause a kernel panic due to left-over trash in those files. --- gfs2/edit/hexedit.c | 39 ++++++++++++++++++++++++++++++++++++++- gfs2/edit/hexedit.h | 2 ++ gfs2/edit/savemeta.c | 20 +++++++++----------- 3 files changed, 49 insertions(+), 12 deletions(-) diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c index 41173e6..8c57bee 100644 --- a/gfs2/edit/hexedit.c +++ b/gfs2/edit/hexedit.c @@ -1591,6 +1591,41 @@ int block_is_quota_file(void) } /* ------------------------------------------------------------------------ */ +/* block_is_per_node */ +/* ------------------------------------------------------------------------ */ +int block_is_per_node(void) +{ + if (!gfs1 && block == masterblock("per_node")) + return TRUE; + return FALSE; +} + +/* ------------------------------------------------------------------------ */ +/* block_is_in_per_node */ +/* ------------------------------------------------------------------------ */ +int block_is_in_per_node(void) +{ + int d; + struct gfs2_dinode per_node_di; + struct gfs2_buffer_head *per_node_bh; + + if (gfs1) + return FALSE; + + per_node_bh = bread(&sbd.buf_list, masterblock("per_node")); + gfs2_dinode_in(&per_node_di, per_node_bh->b_data); + + do_dinode_extended(&per_node_di, per_node_bh->b_data); + brelse(per_node_bh, not_updated); + + for (d = 0; d < indirect->ii[0].dirents; d++) { + if (block == indirect->ii[0].dirent[d].block) + return TRUE; + } + return FALSE; +} + +/* ------------------------------------------------------------------------ */ /* block_has_extended_info */ /* ------------------------------------------------------------------------ */ int block_has_extended_info(void) @@ -2661,6 +2696,7 @@ void interactive_mode(void) /* arrow up */ /* --------------------------------------------------------- */ case KEY_UP: + case '-': if (dmode == EXTENDED_MODE) { if (edit_row[dmode] > 0) edit_row[dmode]--; @@ -2676,6 +2712,7 @@ void interactive_mode(void) /* arrow down */ /* --------------------------------------------------------- */ case KEY_DOWN: + case '+': if (dmode == EXTENDED_MODE) { if (edit_row[dmode] + 1 < end_row[dmode]) { if (edit_row[dmode] >= last_entry_onscreen[dmode]) @@ -2812,7 +2849,7 @@ void interactive_mode(void) move(termlines - 1, 0); printw("Keystroke not understood: 0x%03X",ch); refresh(); - sleep(1); + usleep(50000); break; } /* switch */ } /* while !Quit */ diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h index 58c6ba0..96b36c0 100644 --- a/gfs2/edit/hexedit.h +++ b/gfs2/edit/hexedit.h @@ -152,6 +152,8 @@ extern int block_is_rindex(void); extern int block_is_inum_file(void); extern int block_is_statfs_file(void); extern int block_is_quota_file(void); +extern int block_is_per_node(void); +extern int block_is_in_per_node(void); extern int display_block_type(const char *lpBuffer, int from_restore); extern void gfs_jindex_in(struct gfs_jindex *jindex, char *buf); extern void gfs_log_header_in(struct gfs_log_header *head, char *buf); diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c index 2e4eda8..096e3fc 100644 --- a/gfs2/edit/savemeta.c +++ b/gfs2/edit/savemeta.c @@ -167,12 +167,10 @@ int block_is_a_journal(void) int block_is_systemfile(void) { - return block_is_jindex() || - block_is_inum_file() || - block_is_statfs_file() || - block_is_quota_file() || - block_is_rindex() || - block_is_a_journal(); + return block_is_jindex() || block_is_inum_file() || + block_is_statfs_file() || block_is_quota_file() || + block_is_rindex() || block_is_a_journal() || + block_is_per_node() || block_is_in_per_node(); } int save_block(int fd, int out_fd, uint64_t blk) @@ -690,9 +688,9 @@ int restore_data(int fd, int in_fd, int printblocksonly) } rs = read(in_fd, &buf16, sizeof(uint16_t)); savedata->siglen = be16_to_cpu(buf16); - if (savedata->siglen > 0 && - savedata->siglen <= sizeof(savedata->buf)) { - if (read(in_fd, savedata->buf, savedata->siglen) != + if (savedata->siglen <= sizeof(savedata->buf)) { + if (savedata->siglen && + read(in_fd, savedata->buf, savedata->siglen) != savedata->siglen) { fprintf(stderr, "read error: %s from %s:%d: " "block %lld (0x%llx)\n", @@ -737,7 +735,7 @@ int restore_data(int fd, int in_fd, int printblocksonly) } else { warm_fuzzy_stuff(savedata->blk, FALSE, FALSE); if (savedata->blk >= last_fs_block) { - printf("Out of space on the destination " + printf("\nOut of space on the destination " "device; quitting.\n"); break; } @@ -767,7 +765,7 @@ int restore_data(int fd, int in_fd, int printblocksonly) } blks_saved++; } else { - fprintf(stderr, "Bad record length: %d for block #%" + fprintf(stderr, "\nBad record length: %d for block #%" PRIu64".\n", savedata->siglen, savedata->blk); return -1; }