cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [Patch 31/44] fsck.gfs2: don't free previous rgrp list when trying to repair rgrps
Date: Thu, 11 Aug 2011 17:12:41 -0400 (EDT)	[thread overview]
Message-ID: <1670510376.544919.1313097161514.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> (raw)

From 34c9992770cb54114e8806663526cb1baa235ecb Mon Sep 17 00:00:00 2001
From: Bob Peterson <rpeterso@redhat.com>
Date: Tue, 9 Aug 2011 15:51:34 -0500
Subject: [PATCH 31/44] fsck.gfs2: don't free previous rgrp list when trying
 to repair rgrps

In cases where fsck.gfs2 is trying to repair damaged resource groups or
rindex, it tries several levels of repair.  Some of those levels build a
list of expected resource groups and check them against the actual ones,
and the previous list is freed before the next level is attempted.
However, in the case of minor damage, such as one bitmap block that was
overwritten, we can often repair the damage by reading in the resource
groups at the first level, then at the second level of repair (called
"ye_of_little_faith") use those values to compare against.  This patch
allows the second level of repair to use the first level's list.

rhbz#675723
---
 gfs2/fsck/rgrepair.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index 24badef..911aad3 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -784,12 +784,12 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count, int *sane)
 	osi_list_t *exp, *act; /* expected, actual */
 	struct gfs2_rindex buf;
 
-	/* Free previous incarnations in memory, if any. */
-	gfs2_rgrp_free(&sdp->rglist);
-
 	if (trust_lvl == blind_faith)
 		return 0;
-	else if (trust_lvl == ye_of_little_faith) { /* if rindex seems sane */
+	if (trust_lvl == ye_of_little_faith) { /* if rindex seems sane */
+		/* Don't free previous incarnations in memory, if any.
+		 * We need them to copy in the next function:
+		 * gfs2_rgrp_free(&sdp->rglist); */
 		if (!(*sane)) {
 			log_err(_("The rindex file does not meet our "
 				  "expectations.\n"));
@@ -802,6 +802,9 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count, int *sane)
 			return error;
 		}
 	} else if (trust_lvl == open_minded) { /* If we can't trust RG index */
+		/* Free previous incarnations in memory, if any. */
+		gfs2_rgrp_free(&sdp->rglist);
+
 		/* Calculate our own RG index for comparison */
 		error = gfs2_rindex_calculate(sdp, &expected_rglist,
 					      &calc_rg_count);
@@ -811,6 +814,9 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count, int *sane)
 		}
 	}
 	else if (trust_lvl == distrust) { /* If we can't trust RG index */
+		/* Free previous incarnations in memory, if any. */
+		gfs2_rgrp_free(&sdp->rglist);
+
 		error = gfs2_rindex_rebuild(sdp, &expected_rglist,
 					    &calc_rg_count, 0);
 		if (error) {
@@ -821,6 +827,9 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count, int *sane)
 		sdp->rgrps = calc_rg_count;
 	}
 	else if (trust_lvl == indignation) { /* If we can't trust anything */
+		/* Free previous incarnations in memory, if any. */
+		gfs2_rgrp_free(&sdp->rglist);
+
 		error = gfs2_rindex_rebuild(sdp, &expected_rglist,
 					    &calc_rg_count, 1);
 		if (error) {
-- 
1.7.4.4



                 reply	other threads:[~2011-08-11 21:12 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=1670510376.544919.1313097161514.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com \
    --to=rpeterso@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 NNTP newsgroup(s).