Function resolve_dup_references starts out with a loop that traverses
the references for a given duplicate block. If it finds an acceptable
reference, it is supposed to preserve the first reference and resolve
the others. However, the logic allowed for multiple inodes to be
preserved, which can lead to fsck errors that need resolving with yet
another run of fsck.gfs2. This patch adds a check to see if we've
already preserved one, and if so, to not preserve others that might
happen to be acceptable.

rhbz#1257625
---
 gfs2/fsck/pass1b.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index 845227e..83a506c 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -114,8 +114,7 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, 
struct duptree *dt,
                if (acceptable_ref != ref_types && /* If we're nuking all but
                                                      an acceptable reference
                                                      type and */
-                   this_ref == acceptable_ref && /* this ref is acceptable */
-                   !found_good_ref) { /* We haven't found a good reference */
+                   this_ref == acceptable_ref) { /* this ref is acceptable */
                        /* If this is an invalid inode, but not on the invalid
                           list, it's better to delete it. */
                        if (q == GFS2_BLKST_DINODE) {
-- 
2.4.3

Reply via email to