[Cluster-devel] [fsck.gfs2 v2 PATCH 39/40] fsck.gfs2: Fix rgrp dinode accounting bug

Bob Peterson rpeterso at redhat.com
Fri May 6 17:39:32 UTC 2016


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 at redhat.com>
---
 gfs2/fsck/pass1b.c | 10 +++++++---
 1 file 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
-- 
2.5.5




More information about the Cluster-devel mailing list