cluster: RHEL6 - rgmanager: Turn down log level on debug message
by Ryan McCabe
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=c9c15879a91...
Commit: c9c15879a9154620430ce36830086f14f5ca4462
Parent: 9b412e7e1c6bdbc6d3f98efc13c634b6831c7e05
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Thu Mar 3 11:21:28 2016 -0500
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Thu Mar 3 11:21:28 2016 -0500
rgmanager: Turn down log level on debug message
Only show the no resources found message when log level is set to debug.
Resolves: rhbz#1128877
Signed-off-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/daemons/restree.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/rgmanager/src/daemons/restree.c b/rgmanager/src/daemons/restree.c
index 0dc9ced..cc75719 100644
--- a/rgmanager/src/daemons/restree.c
+++ b/rgmanager/src/daemons/restree.c
@@ -587,7 +587,7 @@ do_load_resource(int ccsfd, char *base,
if (!curres) {
/* No ref and no new one inline ==
no more of the selected type */
- logt_print(LOG_WARNING, "No resources found for %s\n", base);
+ logt_print(LOG_DEBUG, "No resources found for %s\n", base);
return 1;
}
8 years
gfs2-utils: master - fsck.gfs2: Fix rgrp accounting in
check_n_fix_bitmap
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=6dcd8a74...
Commit: 6dcd8a742df38f4ec4dd288e83c9d917fc7a2255
Parent: 78fd0f24aae8d08c0aedad44ff83d0012d67d10b
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Thu May 5 11:13:29 2016 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon May 9 13:21:17 2016 -0500
fsck.gfs2: Fix rgrp accounting in check_n_fix_bitmap
This patch fixes function check_n_fix_bitmap for proper accounting,
especially for GFS1 file systems. It did proper accounting for
normal transitions from dinode-to-free and free-to-dinode, but it
stumbled when it did transitions from data-to-metadata and back.
This patch has the philosophy of "decrement dinode count and/or
metadata count" whenever a bit is transitioned from dinode to
something else. Likewise, it increments when a bit is transitioned
from anything else to dinode.
Signed-off-by: Bob Peterson <rpeterso(a)redhat.com>
---
gfs2/fsck/metawalk.c | 119 +++++++++++++++++++++++++-------------------------
1 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 668690f..253ebcb 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -35,6 +35,7 @@ int check_n_fix_bitmap(struct gfs2_sbd *sdp, uint64_t blk, int error_on_dinode,
int old_bitmap_state;
struct rgrp_tree *rgd;
int treat_as_inode = 0;
+ int rewrite_rgrp = 0;
struct gfs_rgrp *gfs1rg;
const char *allocdesc[2][5] = { /* gfs2 descriptions */
{"free", "data", "unlinked", "inode", "reserved"},
@@ -80,75 +81,73 @@ int check_n_fix_bitmap(struct gfs2_sbd *sdp, uint64_t blk, int error_on_dinode,
data or data to dinode, no change in free space. */
gfs2_set_bitmap(rgd, blk, new_blockmap_state);
if (new_blockmap_state == GFS2_BLKST_FREE) {
- /* If we're freeing a dinode, get rid of the hash table
- entries for it. */
- if (old_bitmap_state == GFS2_BLKST_DINODE ||
- old_bitmap_state == GFS2_BLKST_UNLINKED) {
- struct dir_info *dt;
- struct inode_info *ii;
-
- dt = dirtree_find(blk);
- if (dt) {
- dirtree_delete(dt);
- treat_as_inode = 1;
- }
- ii = inodetree_find(blk);
- if (ii) {
- inodetree_delete(ii);
- treat_as_inode = 1;
- } else if (!sdp->gfs1) {
- treat_as_inode = 1;
- } else {
- /* This is a GFS1 fs (so all metadata is marked
- inode). We need to verify it is an inode
- before we can decr the rgrp inode count. */
- if (link1_type(&nlink1map, blk) == 1)
- treat_as_inode = 1;
- }
- if (old_bitmap_state == GFS2_BLKST_DINODE) {
- if (treat_as_inode && rgd->rg.rg_dinodes > 0)
- rgd->rg.rg_dinodes--;
- if (sdp->gfs1 && gfs1rg->rg_usedmeta > 0)
- gfs1rg->rg_usedmeta--;
- }
- link1_set(&nlink1map, blk, 0);
- }
rgd->rg.rg_free++;
- if (sdp->gfs1)
- gfs_rgrp_out((struct gfs_rgrp *)&rgd->rg,
- rgd->bits[0].bi_bh);
- else
- gfs2_rgrp_out_bh(&rgd->rg, rgd->bits[0].bi_bh);
+ rewrite_rgrp = 1;
} else if (old_bitmap_state == GFS2_BLKST_FREE) {
- if (new_blockmap_state == GFS2_BLKST_DINODE) {
- if (!sdp->gfs1) {
+ rgd->rg.rg_free--;
+ rewrite_rgrp = 1;
+ }
+ /* If we're freeing a dinode, get rid of the data structs for it. */
+ if (old_bitmap_state == GFS2_BLKST_DINODE ||
+ old_bitmap_state == GFS2_BLKST_UNLINKED) {
+ struct dir_info *dt;
+ struct inode_info *ii;
+
+ dt = dirtree_find(blk);
+ if (dt) {
+ dirtree_delete(dt);
+ treat_as_inode = 1;
+ }
+ ii = inodetree_find(blk);
+ if (ii) {
+ inodetree_delete(ii);
+ treat_as_inode = 1;
+ } else if (!sdp->gfs1) {
+ treat_as_inode = 1;
+ } else if (link1_type(&nlink1map, blk) == 1) {
+ /* This is a GFS1 fs (so all metadata is marked inode).
+ We need to verify it is an inode before we can decr
+ the rgrp inode count. */
+ treat_as_inode = 1;
+ }
+ if (old_bitmap_state == GFS2_BLKST_DINODE) {
+ if (treat_as_inode && rgd->rg.rg_dinodes > 0)
+ rgd->rg.rg_dinodes--;
+ else if (sdp->gfs1 && gfs1rg->rg_usedmeta > 0)
+ gfs1rg->rg_usedmeta--;
+ rewrite_rgrp = 1;
+ }
+ link1_set(&nlink1map, blk, 0);
+ } else if (new_blockmap_state == GFS2_BLKST_DINODE) {
+ if (!sdp->gfs1) {
+ treat_as_inode = 1;
+ } else {
+ /* This is GFS1 (so all metadata is marked inode). We
+ need to verify it is an inode before we can decr
+ the rgrp inode count. */
+ if (link1_type(&nlink1map, blk) == 1)
treat_as_inode = 1;
- } else {
- /* This is GFS1 (so all metadata is marked
- inode). We need to verify it is an inode
- before we can decr the rgrp inode count. */
- if (link1_type(&nlink1map, blk) == 1)
+ else {
+ struct dir_info *dt;
+ struct inode_info *ii;
+
+ dt = dirtree_find(blk);
+ if (dt)
treat_as_inode = 1;
else {
- struct dir_info *dt;
- struct inode_info *ii;
-
- dt = dirtree_find(blk);
- if (dt)
+ ii = inodetree_find(blk);
+ if (ii)
treat_as_inode = 1;
- else {
- ii = inodetree_find(blk);
- if (ii)
- treat_as_inode = 1;
- }
}
}
- if (treat_as_inode)
- rgd->rg.rg_dinodes++;
- if (sdp->gfs1)
- gfs1rg->rg_usedmeta++;
}
- rgd->rg.rg_free--;
+ if (treat_as_inode)
+ rgd->rg.rg_dinodes++;
+ else if (sdp->gfs1)
+ gfs1rg->rg_usedmeta++;
+ rewrite_rgrp = 1;
+ }
+ if (rewrite_rgrp) {
if (sdp->gfs1)
gfs_rgrp_out((struct gfs_rgrp *)&rgd->rg, rgd->bits[0].bi_bh);
else
8 years
gfs2-utils: master - fsck.gfs2: Fix rgrp dinode accounting bug
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=78fd0f24...
Commit: 78fd0f24aae8d08c0aedad44ff83d0012d67d10b
Parent: 54ff2a9b67782f94e882bea708eb4c61ede1ef8d
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Wed May 4 12:38:09 2016 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon May 9 13:21:17 2016 -0500
fsck.gfs2: Fix rgrp dinode accounting bug
This patch fixes a bug whereby the count of dinodes in an rgrp can
get off because it's not adjusted properly when the bit is changed
from dinode to free. It's not adjusted because it's not found in
the inode tree or dirtree. The patch changes it so that the bitmap
is changed before deleting those things.
Signed-off-by: Bob Peterson <rpeterso(a)redhat.com>
---
gfs2/fsck/pass1b.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index 9d5fc04..6dec193 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -347,6 +347,13 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt,
if ((this_ref != ref_as_ea) &&
(inval || id->reftypecount[ref_as_data] ||
id->reftypecount[ref_as_meta])) {
+ /* Fix the bitmap first, while the inodetree
+ and dirtree entries exist. That way, the
+ bitmap_set will do proper accounting for
+ the rgrp dinode count. */
+ fsck_bitmap_set(ip, ip->i_di.di_num.no_addr,
+ _("duplicate referencing bad"),
+ GFS2_BLKST_FREE);
/* Remove the inode from the inode tree */
ii = inodetree_find(ip->i_di.di_num.no_addr);
if (ii)
@@ -356,9 +363,6 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt,
dirtree_delete(di);
link1_set(&nlink1map, ip->i_di.di_num.no_addr,
0);
- fsck_bitmap_set(ip, ip->i_di.di_num.no_addr,
- _("duplicate referencing bad"),
- GFS2_BLKST_FREE);
/* We delete the dup_handler inode count and
duplicate id BEFORE clearing the metadata,
because if this is the last reference to
8 years
gfs2-utils: master - fsck.gfs2: pass1b is too noisy wrt gfs1
non-dinode metadata
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=54ff2a9b...
Commit: 54ff2a9b67782f94e882bea708eb4c61ede1ef8d
Parent: caaaeb85d04fb5f72288b7b568596ce3e9ca5e8e
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Tue May 3 12:16:05 2016 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon May 9 13:21:17 2016 -0500
fsck.gfs2: pass1b is too noisy wrt gfs1 non-dinode metadata
For GFS1 file systems, a block marked as metadata may either be a
dinode or any other kind of metadata. For GFS2 file systems, it makes
sense to complain when we find something that we think is a dinode,
but isn't. For GFS1 file systems, non-dinode metadata is a common
thing, so it makes sense to keep quiet about it.
Signed-off-by: Bob Peterson <rpeterso(a)redhat.com>
---
gfs2/fsck/pass1b.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index f5f286a..9d5fc04 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -877,9 +877,10 @@ static int find_block_ref(struct gfs2_sbd *sdp, uint64_t inode)
/* double-check the meta header just to be sure it's metadata */
if (ip->i_di.di_header.mh_magic != GFS2_MAGIC ||
ip->i_di.di_header.mh_type != GFS2_METATYPE_DI) {
- log_debug( _("Block %lld (0x%llx) is not gfs2 metadata.\n"),
- (unsigned long long)inode,
- (unsigned long long)inode);
+ if (!sdp->gfs1)
+ log_debug( _("Block %lld (0x%llx) is not a dinode.\n"),
+ (unsigned long long)inode,
+ (unsigned long long)inode);
error = 1;
goto out;
}
8 years
gfs2-utils: master - fsck.gfs2: Fix GFS1 "used meta" accounting bug
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=caaaeb85...
Commit: caaaeb85d04fb5f72288b7b568596ce3e9ca5e8e
Parent: cdf903a9c79a2a33102fdf05712e5cd298fe8ae4
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Tue May 3 08:57:54 2016 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon May 9 13:21:17 2016 -0500
fsck.gfs2: Fix GFS1 "used meta" accounting bug
Before this patch, fsck.gfs2 was grouping all data blocks and
non-inode metadata blocks in the same category. That's wrong
because the GFS1 "used meta" block count counts data blocks as
metadata blocks. This patch fixes it so that GFS1 "used metadata"
has its own count and the accounting is done properly.
Signed-off-by: Bob Peterson <rpeterso(a)redhat.com>
---
gfs2/fsck/pass5.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
index bab06be..554f39f 100644
--- a/gfs2/fsck/pass5.c
+++ b/gfs2/fsck/pass5.c
@@ -12,6 +12,8 @@
#include "fsck.h"
#include "util.h"
+#define GFS1_BLKST_USEDMETA 4
+
static int check_block_status(struct gfs2_sbd *sdp, struct gfs2_bmap *bl,
char *buffer, unsigned int buflen,
uint64_t *rg_block, uint64_t rg_data,
@@ -50,7 +52,7 @@ static int check_block_status(struct gfs2_sbd *sdp, struct gfs2_bmap *bl,
if (gfs2_check_meta(bh, GFS2_METATYPE_DI) == 0)
count[GFS2_BLKST_DINODE]++;
else
- count[GFS2_BLKST_USED]++;
+ count[GFS1_BLKST_USEDMETA]++;
brelse(bh);
} else {
count[q]++;
@@ -163,13 +165,13 @@ static void update_rgrp(struct gfs2_sbd *sdp, struct rgrp_tree *rgp,
rgp->rg.rg_dinodes = count[GFS2_BLKST_DINODE];
update = 1;
}
- if (sdp->gfs1 && gfs1rg->rg_usedmeta != count[GFS2_BLKST_USED]) {
+ if (sdp->gfs1 && gfs1rg->rg_usedmeta != count[GFS1_BLKST_USEDMETA]) {
log_err( _("RG #%llu (0x%llx) Used metadata count "
"inconsistent: is %u should be %u\n"),
(unsigned long long)rgp->ri.ri_addr,
(unsigned long long)rgp->ri.ri_addr,
- gfs1rg->rg_usedmeta, count[GFS2_BLKST_USED]);
- gfs1rg->rg_usedmeta = count[GFS2_BLKST_USED];
+ gfs1rg->rg_usedmeta, count[GFS1_BLKST_USEDMETA]);
+ gfs1rg->rg_usedmeta = count[GFS1_BLKST_USEDMETA];
update = 1;
}
if (sdp->gfs1 && gfs1rg->rg_freemeta != count[GFS2_BLKST_UNLINKED]) {
@@ -217,7 +219,7 @@ int pass5(struct gfs2_sbd *sdp, struct gfs2_bmap *bl)
{
struct osi_node *n, *next = NULL;
struct rgrp_tree *rgp = NULL;
- uint32_t count[5];
+ uint32_t count[5]; /* we need 5 because of GFS1 usedmeta */
uint64_t rg_count = 0;
/* Reconcile RG bitmaps with fsck bitmap */
8 years
gfs2-utils: master - fsck.gfs2: Use BLKST constants to make pass5
more clear
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=cdf903a9...
Commit: cdf903a9c79a2a33102fdf05712e5cd298fe8ae4
Parent: 90ba53e9311c7250a286964718cb22dde386850d
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Tue May 3 08:38:31 2016 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon May 9 13:21:17 2016 -0500
fsck.gfs2: Use BLKST constants to make pass5 more clear
This patch makes no functional changes. It just changes the array
references for "count" use the equivalent BLKST_* constants. This
makes the code more intuitive to understand and read.
Signed-off-by: Bob Peterson <rpeterso(a)redhat.com>
---
gfs2/fsck/pass5.c | 35 +++++++++++++++++++----------------
1 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
index 7d81bfa..bab06be 100644
--- a/gfs2/fsck/pass5.c
+++ b/gfs2/fsck/pass5.c
@@ -145,50 +145,53 @@ static void update_rgrp(struct gfs2_sbd *sdp, struct rgrp_tree *rgp,
}
/* actually adjust counters and write out to disk */
- if (rgp->rg.rg_free != count[0]) {
+ if (rgp->rg.rg_free != count[GFS2_BLKST_FREE]) {
log_err( _("RG #%llu (0x%llx) free count inconsistent: "
"is %u should be %u\n"),
(unsigned long long)rgp->ri.ri_addr,
(unsigned long long)rgp->ri.ri_addr,
- rgp->rg.rg_free, count[0]);
- rgp->rg.rg_free = count[0];
+ rgp->rg.rg_free, count[GFS2_BLKST_FREE]);
+ rgp->rg.rg_free = count[GFS2_BLKST_FREE];
update = 1;
}
- if (rgp->rg.rg_dinodes != count[3]) {
+ if (rgp->rg.rg_dinodes != count[GFS2_BLKST_DINODE]) {
log_err( _("RG #%llu (0x%llx) Inode count inconsistent: is "
"%u should be %u\n"),
(unsigned long long)rgp->ri.ri_addr,
(unsigned long long)rgp->ri.ri_addr,
- rgp->rg.rg_dinodes, count[3]);
- rgp->rg.rg_dinodes = count[3];
+ rgp->rg.rg_dinodes, count[GFS2_BLKST_DINODE]);
+ rgp->rg.rg_dinodes = count[GFS2_BLKST_DINODE];
update = 1;
}
- if (sdp->gfs1 && gfs1rg->rg_usedmeta != count[1]) {
+ if (sdp->gfs1 && gfs1rg->rg_usedmeta != count[GFS2_BLKST_USED]) {
log_err( _("RG #%llu (0x%llx) Used metadata count "
"inconsistent: is %u should be %u\n"),
(unsigned long long)rgp->ri.ri_addr,
(unsigned long long)rgp->ri.ri_addr,
- gfs1rg->rg_usedmeta, count[1]);
- gfs1rg->rg_usedmeta = count[1];
+ gfs1rg->rg_usedmeta, count[GFS2_BLKST_USED]);
+ gfs1rg->rg_usedmeta = count[GFS2_BLKST_USED];
update = 1;
}
- if (sdp->gfs1 && gfs1rg->rg_freemeta != count[2]) {
+ if (sdp->gfs1 && gfs1rg->rg_freemeta != count[GFS2_BLKST_UNLINKED]) {
log_err( _("RG #%llu (0x%llx) Free metadata count "
"inconsistent: is %u should be %u\n"),
(unsigned long long)rgp->ri.ri_addr,
(unsigned long long)rgp->ri.ri_addr,
- gfs1rg->rg_freemeta, count[2]);
- gfs1rg->rg_freemeta = count[2];
+ gfs1rg->rg_freemeta, count[GFS2_BLKST_UNLINKED]);
+ gfs1rg->rg_freemeta = count[GFS2_BLKST_UNLINKED];
update = 1;
}
- if (!sdp->gfs1 && (rgp->ri.ri_data != count[0] + count[1] +
- count[2] + count[3])) {
+ if (!sdp->gfs1 && (rgp->ri.ri_data != count[GFS2_BLKST_FREE] +
+ count[GFS2_BLKST_USED] +
+ count[GFS2_BLKST_UNLINKED] +
+ count[GFS2_BLKST_DINODE])) {
/* FIXME not sure how to handle this case ATM - it
* means that the total number of blocks we've counted
* exceeds the blocks in the rg */
log_err( _("Internal fsck error: %u != %u + %u + %u + %u\n"),
- rgp->ri.ri_data, count[0], count[1], count[2],
- count[3]);
+ rgp->ri.ri_data, count[GFS2_BLKST_FREE],
+ count[GFS2_BLKST_USED], count[GFS2_BLKST_UNLINKED],
+ count[GFS2_BLKST_DINODE]);
exit(FSCK_ERROR);
}
if (update) {
8 years
gfs2-utils: master - fsck.gfs2: Add initialization checks for GFS1
used metadata
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=90ba53e9...
Commit: 90ba53e9311c7250a286964718cb22dde386850d
Parent: ef8592b611c776b75d037a4c5bb3cf0779f2b55b
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Tue May 3 08:31:51 2016 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon May 9 13:21:17 2016 -0500
fsck.gfs2: Add initialization checks for GFS1 used metadata
Before this patch, fsck.gfs2's initialization code that verified
rgrp counts was not counting the "used metadata" count used in
GFS1 file systems. This patch adds those checks.
Signed-off-by: Bob Peterson <rpeterso(a)redhat.com>
---
gfs2/fsck/initialize.c | 52 +++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index d54ab0d..652eec3 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -198,14 +198,14 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
int *fixit, int *this_rg_fixed,
int *this_rg_bad, int *this_rg_cleaned)
{
- uint32_t rg_free, rg_reclaimed, rg_unlinked;
+ uint32_t rg_free, rg_reclaimed, rg_unlinked, rg_usedmeta, rg_useddi;
int rgb, x, y, off, bytes_to_check, total_bytes_to_check, asked = 0;
unsigned int state;
struct gfs_rgrp *gfs1rg = (struct gfs_rgrp *)&rgd->rg;
uint64_t diblock;
struct gfs2_buffer_head *bh;
- rg_free = rg_reclaimed = rg_unlinked = 0;
+ rg_free = rg_reclaimed = rg_unlinked = rg_usedmeta = rg_useddi = 0;
total_bytes_to_check = rgd->ri.ri_bitbytes;
*this_rg_fixed = *this_rg_bad = *this_rg_cleaned = 0;
@@ -241,6 +241,15 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
continue;
}
if (state == GFS2_BLKST_DINODE) {
+ if (sdp->gfs1) {
+ bh = bread(sdp, diblock);
+ if (!gfs2_check_meta(bh,
+ GFS2_METATYPE_DI))
+ rg_useddi++;
+ else
+ rg_usedmeta++;
+ brelse(bh);
+ }
diblock++;
continue;
}
@@ -344,7 +353,10 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
} else
log_err( _("The rgrp was not fixed.\n"));
}
- if (sdp->gfs1 && gfs1rg->rg_freemeta != rg_unlinked) {
+ if (!sdp->gfs1)
+ return;
+
+ if (gfs1rg->rg_freemeta != rg_unlinked) {
*this_rg_bad = 1;
*this_rg_cleaned = 0;
log_err( _("Error: resource group %lld (0x%llx): "
@@ -360,6 +372,40 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
} else
log_err( _("The rgrp was not fixed.\n"));
}
+ if (gfs1rg->rg_useddi != rg_useddi) {
+ *this_rg_bad = 1;
+ *this_rg_cleaned = 0;
+ log_err( _("Error: resource group %lld (0x%llx): used dinode "
+ "count (%d) does not match bitmap (%d)\n"),
+ (unsigned long long)rgd->ri.ri_addr,
+ (unsigned long long)rgd->ri.ri_addr,
+ gfs1rg->rg_useddi, rg_useddi);
+ if (query( _("Fix the rgrp used dinode block count? (y/n)"))) {
+ gfs1rg->rg_useddi = rg_useddi;
+ gfs_rgrp_out((struct gfs_rgrp *)&rgd->rg,
+ rgd->bits[0].bi_bh);
+ *this_rg_fixed = 1;
+ log_err( _("The rgrp was fixed.\n"));
+ } else
+ log_err( _("The rgrp was not fixed.\n"));
+ }
+ if (gfs1rg->rg_usedmeta != rg_usedmeta) {
+ *this_rg_bad = 1;
+ *this_rg_cleaned = 0;
+ log_err( _("Error: resource group %lld (0x%llx): used "
+ "metadata (%d) does not match bitmap (%d)\n"),
+ (unsigned long long)rgd->ri.ri_addr,
+ (unsigned long long)rgd->ri.ri_addr,
+ gfs1rg->rg_usedmeta, rg_usedmeta);
+ if (query( _("Fix the rgrp used meta blocks count? (y/n)"))) {
+ gfs1rg->rg_usedmeta = rg_usedmeta;
+ gfs_rgrp_out((struct gfs_rgrp *)&rgd->rg,
+ rgd->bits[0].bi_bh);
+ *this_rg_fixed = 1;
+ log_err( _("The rgrp was fixed.\n"));
+ } else
+ log_err( _("The rgrp was not fixed.\n"));
+ }
/*
else {
log_debug( _("Resource group %lld (0x%llx) free space "
8 years
gfs2-utils: master - fsck.gfs2: Adjust bitmap for lost+found after
adding to dirtree
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=ef8592b6...
Commit: ef8592b611c776b75d037a4c5bb3cf0779f2b55b
Parent: 120b0bfdca68602205623dd85516b87bd98a692d
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon May 2 13:44:42 2016 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon May 9 13:21:17 2016 -0500
fsck.gfs2: Adjust bitmap for lost+found after adding to dirtree
This patch changes the order in which things are done in function
make_sure_lf_exists. Before, it was setting the bitmap and then
adding lost+found to the directory tree. Now the order is reversed:
lost+found is added to the directory tree, then the bitmap is
twiddled. Doing it in this order ensures that the block is treated
as an inode block for the purposes of adjusting the rgrp counts.
This is only a problem for GFS1 file systems where a bitmap
designation might mean either dinode or other metadata.
Signed-off-by: Bob Peterson <rpeterso(a)redhat.com>
---
gfs2/fsck/lost_n_found.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
index 197ae7d..bd05223 100644
--- a/gfs2/fsck/lost_n_found.c
+++ b/gfs2/fsck/lost_n_found.c
@@ -139,9 +139,12 @@ void make_sure_lf_exists(struct gfs2_inode *ip)
/* FIXME: i'd feel better about this if fs_mkdir returned
whether it created a new directory or just found an old one,
and we used that instead of the bitmap_type to run this */
+ dirtree_insert(lf_dip->i_di.di_num);
+ /* Set the bitmap AFTER the dirtree insert so that function
+ check_n_fix_bitmap will realize it's a dinode and adjust
+ the rgrp counts properly. */
fsck_bitmap_set(ip, lf_dip->i_di.di_num.no_addr,
_("lost+found dinode"), GFS2_BLKST_DINODE);
- dirtree_insert(lf_dip->i_di.di_num);
/* root inode links to lost+found */
incr_link_count(sdp->md.rooti->i_di.di_num, lf_dip, _("root"));
/* lost+found link for '.' from itself */
8 years
gfs2-utils: master - fsck.gfs2: Fix inode counting bug
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=120b0bfd...
Commit: 120b0bfdca68602205623dd85516b87bd98a692d
Parent: 25c6fe9a206d1670ac30018a145c26dda603771b
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon Apr 25 17:19:36 2016 -0400
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon May 9 13:20:35 2016 -0500
fsck.gfs2: Fix inode counting bug
This patch fixes a previous patch that caused the inode count to
get off when repairing GFS1 file systems with corrupt system dinodes.
Signed-off-by: Bob Peterson <rpeterso(a)redhat.com>
---
gfs2/fsck/metawalk.c | 46 +++++++++++++++++++++++++++-------------------
1 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 0df54df..668690f 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -35,12 +35,14 @@ int check_n_fix_bitmap(struct gfs2_sbd *sdp, uint64_t blk, int error_on_dinode,
int old_bitmap_state;
struct rgrp_tree *rgd;
int treat_as_inode = 0;
+ struct gfs_rgrp *gfs1rg;
const char *allocdesc[2][5] = { /* gfs2 descriptions */
{"free", "data", "unlinked", "inode", "reserved"},
/* gfs1 descriptions: */
{"free", "data", "free meta", "metadata", "reserved"}};
rgd = gfs2_blk2rgrpd(sdp, blk);
+ gfs1rg = (struct gfs_rgrp *)&rgd->rg;
old_bitmap_state = lgfs2_get_bitmap(sdp, blk, rgd);
if (old_bitmap_state < 0) {
@@ -106,12 +108,8 @@ int check_n_fix_bitmap(struct gfs2_sbd *sdp, uint64_t blk, int error_on_dinode,
if (old_bitmap_state == GFS2_BLKST_DINODE) {
if (treat_as_inode && rgd->rg.rg_dinodes > 0)
rgd->rg.rg_dinodes--;
- else if (sdp->gfs1) {
- struct gfs_rgrp *gfs1rg =
- (struct gfs_rgrp *)&rgd->rg;
- if (gfs1rg->rg_usedmeta > 0)
- gfs1rg->rg_usedmeta--;
- }
+ if (sdp->gfs1 && gfs1rg->rg_usedmeta > 0)
+ gfs1rg->rg_usedmeta--;
}
link1_set(&nlink1map, blk, 0);
}
@@ -122,23 +120,33 @@ int check_n_fix_bitmap(struct gfs2_sbd *sdp, uint64_t blk, int error_on_dinode,
else
gfs2_rgrp_out_bh(&rgd->rg, rgd->bits[0].bi_bh);
} else if (old_bitmap_state == GFS2_BLKST_FREE) {
- if (!sdp->gfs1) {
- treat_as_inode = 1;
- } else {
- /* This is a GFS1 fs (so all metadata is marked inode).
- We need to verify it is an inode before we can decr
- the rgrp inode count. */
- if (link1_type(&nlink1map, blk) == 1)
- treat_as_inode = 1;
- }
if (new_blockmap_state == GFS2_BLKST_DINODE) {
+ if (!sdp->gfs1) {
+ treat_as_inode = 1;
+ } else {
+ /* This is GFS1 (so all metadata is marked
+ inode). We need to verify it is an inode
+ before we can decr the rgrp inode count. */
+ if (link1_type(&nlink1map, blk) == 1)
+ treat_as_inode = 1;
+ else {
+ struct dir_info *dt;
+ struct inode_info *ii;
+
+ dt = dirtree_find(blk);
+ if (dt)
+ treat_as_inode = 1;
+ else {
+ ii = inodetree_find(blk);
+ if (ii)
+ treat_as_inode = 1;
+ }
+ }
+ }
if (treat_as_inode)
rgd->rg.rg_dinodes++;
- else if (sdp->gfs1) {
- struct gfs_rgrp *gfs1rg =
- (struct gfs_rgrp *)&rgd->rg;
+ if (sdp->gfs1)
gfs1rg->rg_usedmeta++;
- }
}
rgd->rg.rg_free--;
if (sdp->gfs1)
8 years
gfs2-utils: master - fsck.gfs2: Eliminate redundant code in
_fsck_bitmap_set
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=25c6fe9a...
Commit: 25c6fe9a206d1670ac30018a145c26dda603771b
Parent: 67db866e25747e9a0a9ecf99968591eeacec071a
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon Apr 25 14:11:47 2016 -0400
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon May 9 13:19:49 2016 -0500
fsck.gfs2: Eliminate redundant code in _fsck_bitmap_set
Function _fsck_bitmap_set was checking if the block is unlinked,
and printing out messages identical to the alternative code path.
Therefore, the redundant code was eliminated.
Signed-off-by: Bob Peterson <rpeterso(a)redhat.com>
---
gfs2/fsck/metawalk.c | 11 -----------
1 files changed, 0 insertions(+), 11 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 8a1748b..0df54df 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -185,17 +185,6 @@ int _fsck_bitmap_set(struct gfs2_inode *ip, uint64_t bblock,
(unsigned long long)ip->i_di.di_num.no_addr,
block_type_string(mark));
- } else if (mark == GFS2_BLKST_UNLINKED) {
- if (prevcount) {
- log_info("\n");
- prevcount = 0;
- }
- printf( _("(%s:%d) inode (0x%llx) references %s block"
- " (0x%llx): marking as '%s'\n"),
- caller, fline,
- (unsigned long long)ip->i_di.di_num.no_addr,
- btype, (unsigned long long)bblock,
- block_type_string(mark));
} else {
if (prevcount) {
log_info("\n");
8 years