Skip to contentSkip to conversation

fsck.gfs2: allow rindex recovery when too many segments

PATCH New Bob Peterson 1 participant 1 message Jan 13, 2017 1 message not in the archive

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 fsck.gfs2: allow rindex recovery when too many segments

In reply to a message not in the archive

Hi,

Patch 0103dc0 (fsck.gfs2: Detect multiple rgrp grow segments) added an array of rgrp segments. If it found too many segments, it threw up its hands and gave up and refused to try to fix it. But in most cases, proceeding to fix the rgrps won't cause any harm, since the rgrps are checked for integrity anyway. This patch allows fsck to try to fix the rgrp corruption, even after the maximum number of rgrp segments has been reached.

---

gfs2/fsck/rgrepair.c +2 -4
index 7479458..49bbad6 100644
@@ -230,9 +230,8 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
 	}
 	if (gsegment >= MAX_RGSEGMENTS) {
 		log_err(_("Maximum number of rgrp grow segments reached.\n"));
-		log_err(_("This file system cannot be repaired with fsck.\n"));
-		gsegment = 0;
-		goto out;
+		log_err(_("This file system has more than %d resource "
+			  "group segments.\n"), MAX_RGSEGMENTS);
 	}
 	/* -------------------------------------------------------------- */
 	/* Sanity-check our first_rg_dist. If RG #2 got nuked, the        */
@@ -260,7 +259,6 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
 			   (unsigned long long)*dist_array);
 	} /* if first RG distance is within tolerance */
 
-out:
 	gfs2_special_free(&false_rgrps);
 	return gsegment;
 }