public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: RHEL5 - GFS2: gfs2_edit savemeta not saving per_node quota files
@ 2009-03-31 15:52 Bob Peterson
0 siblings, 0 replies; only message in thread
From: Bob Peterson @ 2009-03-31 15:52 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=2d527d053217b12ac23f4369510e055174e9bdb5
Commit: 2d527d053217b12ac23f4369510e055174e9bdb5
Parent: 321445dff2be4d808eaf6dbc4c2fef70a6b0f53d
Author: Bob Peterson <rpeterso@redhat.com>
AuthorDate: Tue Mar 31 09:53:56 2009 -0500
Committer: Bob Peterson <rpeterso@redhat.com>
CommitterDate: Tue Mar 31 09:53:56 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 | 24 ++++++++++++------------
3 files changed, 52 insertions(+), 13 deletions(-)
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index df965ae..66086c7 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -1603,6 +1603,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)
@@ -2673,6 +2708,7 @@ void interactive_mode(void)
/* arrow up */
/* --------------------------------------------------------- */
case KEY_UP:
+ case '-':
if (dmode == EXTENDED_MODE) {
if (edit_row[dmode] > 0)
edit_row[dmode]--;
@@ -2688,6 +2724,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])
@@ -2824,7 +2861,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 a3f2b5d..e645807 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -176,6 +176,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 c71f04a..de99cb7 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -180,12 +180,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)
@@ -654,9 +652,10 @@ 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)) {
- do_read(in_fd, savedata->buf, savedata->siglen);
+ if (savedata->siglen <= sizeof(savedata->buf)) {
+ if (savedata->siglen)
+ do_read(in_fd, savedata->buf,
+ savedata->siglen);
if (first) {
gfs2_sb_in(&sbd.sd_sb, savedata->buf);
sbd1 = (struct gfs_sb *)&sbd.sd_sb;
@@ -692,7 +691,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;
}
@@ -702,8 +701,9 @@ int restore_data(int fd, int in_fd, int printblocksonly)
}
blks_saved++;
} else {
- fprintf(stderr, "Bad record length: %d for block #%"
- PRIu64".\n", savedata->siglen, savedata->blk);
+ fprintf(stderr, "\nBad record length: %d for block #%"
+ PRIu64 " (0x%" PRIx64").\n", savedata->siglen,
+ savedata->blk, savedata->blk);
return -1;
}
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-03-31 15:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-31 15:52 cluster: RHEL5 - GFS2: gfs2_edit savemeta not saving per_node quota files Bob Peterson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).