cluster: RHEL56 - libgfs2: Set block range based on rgrps, not device size

Bob Peterson rpeterso at fedoraproject.org
Sat Apr 10 04:53:04 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=5a2b3a48aea599e441cfb893884c14e41336ae8e
Commit:        5a2b3a48aea599e441cfb893884c14e41336ae8e
Parent:        c952ad46246b8619b723852ab967a69f2bb80290
Author:        Bob Peterson <bob at ganesha.peterson>
AuthorDate:    Thu Jan 21 17:35:33 2010 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Fri Apr 9 23:35:18 2010 -0500

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
---
 gfs2/libgfs2/gfs1.c  |    1 +
 gfs2/libgfs2/super.c |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

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;


More information about the cluster-commits mailing list