public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: cluster: STABLE3 - GFS2: gfs2_edit savemeta not saving per_node quota files
Date: Tue, 31 Mar 2009 15:47:00 -0000	[thread overview]
Message-ID: <20090331154702.AA3E5120197@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=7378622847b57be25e19eb06f55a567e6be7a00b
Commit:        7378622847b57be25e19eb06f55a567e6be7a00b
Parent:        5b4a380d9b65d51688f84bad147023fe5c648385
Author:        Bob Peterson <rpeterso@redhat.com>
AuthorDate:    Tue Mar 31 10:19:30 2009 -0500
Committer:     Bob Peterson <rpeterso@redhat.com>
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;
 		}


                 reply	other threads:[~2009-03-31 15:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090331154702.AA3E5120197@lists.fedorahosted.org \
    --to=rpeterso@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).