Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdif…
Commit: d9cb12d1372ef5d62ad09509886ad8fcd29a0dd6
Parent: 178f6cabb4a425d456524df71d345302e88af18f
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Wed Aug 10 10:33:49 2011 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon Aug 29 12:54:42 2011 -0500
libgfs2: Use dinode buffer to map gfs1 dinode blocks
When function gfs1_block_map found a block for a stuffed file it
wasn't returning the dinode buffer, it was returning the block as a
new buffer. The problem is, if changes are made to the block, they
will be overwritten by the dinode buffer when that is released.
The result is a fixed block that doesn't get fixed. This patch
changes the code to return the block properly like gfs2_block_map.
rhbz#675723
---
gfs2/libgfs2/gfs1.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c
index d09a8ee..5304b56 100644
--- a/gfs2/libgfs2/gfs1.c
+++ b/gfs2/libgfs2/gfs1.c
@@ -120,7 +120,10 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
mh.mh_format = GFS2_FORMAT_IN;
gfs2_meta_header_out(&mh, bh);
} else {
- bh = bread(sdp, *dblock);
+ if (*dblock == ip->i_di.di_num.no_addr)
+ bh = ip->i_bh;
+ else
+ bh = bread(sdp, *dblock);
}
}
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdif…
Commit: 4d75aa8523397f57bd3e8c1c9ef1c5b92e287caf
Parent: e3bb6a63751dbe1f816030351f94b6d3de057514
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Tue Aug 9 15:51:34 2011 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon Aug 29 12:54:42 2011 -0500
fsck.gfs2: don't free prev rgrp list repairing 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 c91e4be..864b880 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) {