public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* gfs2-utils: master - GFS2: gfs2_edit savemeta not saving per_node quota files
@ 2009-03-31 15:41 Bob Peterson
0 siblings, 0 replies; only message in thread
From: Bob Peterson @ 2009-03-31 15:41 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=375aa548258aae352c07d03cc715cdb2d74e1bfa
Commit: 375aa548258aae352c07d03cc715cdb2d74e1bfa
Parent: ffea6443e07a15fd85cbf1e19794caf30737cbf1
Author: Bob Peterson <rpeterso@redhat.com>
AuthorDate: Tue Mar 31 10:36:50 2009 -0500
Committer: Bob Peterson <rpeterso@redhat.com>
CommitterDate: Tue Mar 31 10:36:50 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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-03-31 15:41 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:41 gfs2-utils: master - 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).