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