commit 5a2b3a48aea599e441cfb893884c14e41336ae8e Author: Bob Peterson <bob@ganesha.peterson> Date: Thu Jan 21 17:35:33 2010 -0600 libgfs2: Set block range based on rgrps, not device size The functions that read in the rindex need to set the block range properly, rather than basing it on the device size. If not, bad block pointers might reference blocks beyond the end of the file system (as can happen if a device is extended before gfs2_grow is run), or if a different metadata set is restored with gfs2_edit restoremeta. rhbz#455300 diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c index 5cced66..5018334 100644 --- a/gfs2/libgfs2/gfs1.c +++ b/gfs2/libgfs2/gfs1.c @@ -315,6 +315,7 @@ int gfs1_ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount, int quiet) rmax = ri->ri_data0 + ri->ri_data - 1; } + sdp->fssize = rmax; *rgcount = count1; if (count1 != count2) goto fail; diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c index f48bad5..072f681 100644 --- a/gfs2/libgfs2/super.c +++ b/gfs2/libgfs2/super.c @@ -242,6 +242,7 @@ int ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount) osi_list_t *tmp; int count1 = 0, count2 = 0; uint64_t errblock = 0; + uint64_t rmax = 0; if (rindex_read(sdp, fd, &count1)) goto fail; @@ -251,9 +252,12 @@ int ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount) if (errblock) return errblock; ri = &rgd->ri; + if (ri->ri_data0 + ri->ri_data - 1 > rmax) + rmax = ri->ri_data0 + ri->ri_data - 1; count2++; } + sdp->fssize = rmax; *rgcount = count1; if (count1 != count2) goto fail;