[Cluster-devel] cluster/gfs2/fsck metawalk.c pass1.c pass1b.c ...

rpeterso at sourceware.org rpeterso at sourceware.org
Thu Jun 28 23:41:38 UTC 2007


CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rpeterso at sourceware.org	2007-06-28 23:41:37

Modified files:
	gfs2/fsck      : metawalk.c pass1.c pass1b.c pass1c.c pass5.c 

Log message:
	Revolves: bz 245803: GFS2: buffer count underflow for block
	29581 (0x738d)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/metawalk.c.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass1.c.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass1b.c.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass1c.c.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass5.c.diff?cvsroot=cluster&r1=1.4&r2=1.5

--- cluster/gfs2/fsck/metawalk.c	2007/05/15 18:11:10	1.9
+++ cluster/gfs2/fsck/metawalk.c	2007/06/28 23:41:37	1.10
@@ -501,9 +501,9 @@
 			error = check_leaf_eattr(ip, block, indirect, pass);
 			ea_leaf_ptr++;
 		}
+		brelse(indirect_buf, not_updated);
 	}
 
-	brelse(indirect_buf, not_updated);
 	return error;
 }
 
--- cluster/gfs2/fsck/pass1.c	2007/05/15 18:11:10	1.8
+++ cluster/gfs2/fsck/pass1.c	2007/06/28 23:41:37	1.9
@@ -147,10 +147,6 @@
 
 	/* This inode contains an eattr - it may be invalid, but the
 	 * eattr attributes points to a non-zero block */
-	log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to eattr block\n",
-			  indirect, indirect);
-	gfs2_block_set(bl, indirect, gfs2_eattr_block);
-
 	if(gfs2_check_range(sdp, indirect)) {
 		/*log_warn("EA indirect block #%"PRIu64" is out of range.\n",
 			indirect);
@@ -171,6 +167,10 @@
 		ret = 1;
 	}
 	else {
+		log_debug("Setting %" PRIu64 " (0x%"
+			  PRIx64 ") to eattr block\n", indirect, indirect);
+		gfs2_block_set(bl, indirect, gfs2_eattr_block);
+
 		*bh = bread(sdp, indirect);
 		block = be64_to_cpu(*(*bh)->b_data);
 		if(gfs2_check_meta(*bh, GFS2_METATYPE_IN)) {
@@ -186,7 +186,6 @@
 			gfs2_block_set(bl, block, gfs2_indir_blk);
 			bc->ea_count++;
 		}
-		brelse(*bh, not_updated);
 	}
 	return ret;
 }
--- cluster/gfs2/fsck/pass1b.c	2007/01/23 19:23:07	1.4
+++ cluster/gfs2/fsck/pass1b.c	2007/06/28 23:41:37	1.5
@@ -214,6 +214,7 @@
 	struct dup_handler *dh = (struct dup_handler *) private;
 	/* Can't use fxns from eattr.c since we need to check the ref
 	 * count */
+	*bh = NULL;
 	if(dh->ref_count == 1)
 		return 1;
 	if(block == dh->b->block_no) {
--- cluster/gfs2/fsck/pass1c.c	2007/01/23 19:23:07	1.5
+++ cluster/gfs2/fsck/pass1c.c	2007/06/28 23:41:37	1.6
@@ -47,7 +47,7 @@
 	int *update = (int *) private;
 	struct gfs2_sbd *sbp = ip->i_sbd;
 	struct gfs2_block_query q;
-	struct gfs2_buffer_head *indir_bh;
+	struct gfs2_buffer_head *indir_bh = NULL;
 
 	if(gfs2_check_range(sbp, block)) {
 		log_err("Extended attributes indirect block out of range...removing\n");
--- cluster/gfs2/fsck/pass5.c	2007/01/23 19:23:07	1.4
+++ cluster/gfs2/fsck/pass5.c	2007/06/28 23:41:37	1.5
@@ -21,9 +21,13 @@
 #include "fs_bits.h"
 #include "util.h"
 
-int convert_mark(enum gfs2_mark_block mark, uint32_t *count)
+int convert_mark(struct gfs2_block_query *q, uint32_t *count)
 {
-	switch(mark) {
+	if (q->eattr_block) {
+		count[2]++;
+		return GFS2_BLKST_USED;
+	}
+	switch(q->block_type) {
 
 	case gfs2_meta_inval:
 		/* Convert invalid metadata to free blocks */
@@ -54,7 +58,7 @@
 		return GFS2_BLKST_USED;
 
 	default:
-		log_err("Invalid state %d found\n", mark);
+		log_err("Invalid state %d found\n", q->block_type);
 		return -1;
 	}
 	return -1;
@@ -83,7 +87,7 @@
 			return 0;
 		gfs2_block_check(bl, block, &q);
 
-		block_status = convert_mark(q.block_type, count);
+		block_status = convert_mark(&q, count);
 
 		if (rg_status != block_status) {
 			const char *blockstatus[] = {"Free", "Data", "Invalid", "inode"};




More information about the Cluster-devel mailing list