[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	rpeterso sourceware org	2007-11-16 23:22:23

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

Log message:
	Resolves: bz 382581: GFS2: gfs2_fsck: buffer still held for block

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/metawalk.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.10&r2=1.3.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass1.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.7&r2=1.4.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass1c.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.3&r2=1.4.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass2.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.5&r2=1.4.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass5.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.2&r2=1.3.2.3

--- cluster/gfs2/fsck/metawalk.c	2007/09/18 18:14:27	1.3.2.10
+++ cluster/gfs2/fsck/metawalk.c	2007/11/16 23:22:23	1.3.2.11
@@ -463,9 +463,11 @@
 		if(error > 0) {
 			return 1;
 		}
+		check_eattr_entries(ip, bh, pass);
+		if (bh)
+			brelse(bh, not_updated);
 	}
 
-	check_eattr_entries(ip, bh, pass);
 	return 0;
 }
 
@@ -487,9 +489,9 @@
 	log_debug("Checking EA indirect block #%"PRIu64" (0x%" PRIx64 ").\n",
 			  indirect, indirect);
 
-	if (!pass->check_eattr_indir ||
+	if (pass->check_eattr_indir &&
 	    !pass->check_eattr_indir(ip, indirect, ip->i_di.di_num.no_addr,
-								 &indirect_buf, pass->private)) {
+				     &indirect_buf, pass->private)) {
 		ea_leaf_ptr = (uint64_t *)(indirect_buf->b_data
 								   + sizeof(struct gfs2_meta_header));
 		end = ea_leaf_ptr + ((sdp->sd_sb.sb_bsize
--- cluster/gfs2/fsck/pass1.c	2007/10/11 20:32:36	1.4.2.7
+++ cluster/gfs2/fsck/pass1.c	2007/11/16 23:22:23	1.4.2.8
@@ -143,7 +143,6 @@
 	int ret = 0;
 	struct gfs2_block_query q = {0};
 	struct block_count *bc = (struct block_count *) private;
-	uint64_t block;
 
 	/* This inode contains an eattr - it may be invalid, but the
 	 * eattr attributes points to a non-zero block */
@@ -167,23 +166,27 @@
 		ret = 1;
 	}
 	else {
-		log_debug("Setting %" PRIu64 " (0x%"
-			  PRIx64 ") to eattr block\n", indirect, indirect);
-		gfs2_block_set(bl, indirect, gfs2_eattr_block);
+		log_debug("Marking inode %" PRIu64 " (0x%"
+			  PRIx64 ") with eattr block\n",
+			  ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
+		/* Mark the inode as having an eattr in the block map
+		   so pass1c can check it. */
+		gfs2_block_mark(bl, ip->i_di.di_num.no_addr, gfs2_eattr_block);
 
 		*bh = bread(sdp, indirect);
-		block = be64_to_cpu(*(*bh)->b_data);
 		if(gfs2_check_meta(*bh, GFS2_METATYPE_IN)) {
 			log_warn("EA indirect block %" PRIu64 " (0x%" PRIx64
-					 ") has incorrect type.\n", block, block);
-			gfs2_block_set(bl, block, gfs2_meta_inval);
+				 ") has incorrect type.\n",
+				 indirect, indirect);
+			gfs2_block_set(bl, indirect, gfs2_meta_inval);
 			ret = 1;
+			brelse(*bh, not_updated);
 		}
 		else {
 			/* FIXME: do i need to differentiate this as an ea_indir? */
 			log_debug("Setting %" PRIu64 " (0x%" PRIx64
-					  ") to indirect block\n", block, block);
-			gfs2_block_set(bl, block, gfs2_indir_blk);
+				  ") to indirect block\n", indirect, indirect);
+			gfs2_block_set(bl, indirect, gfs2_indir_blk);
 			bc->ea_count++;
 		}
 	}
@@ -293,6 +296,7 @@
 				 ip->i_di.di_num.no_addr);
 			gfs2_block_set(bl, block, gfs2_meta_inval);
 			ret = -1;
+			brelse(leaf_bh, not_updated);
 		}
 		else {
 			log_debug("Setting block %" PRIu64 " (0x%" PRIx64
@@ -300,7 +304,6 @@
 			gfs2_block_set(bl, block, gfs2_meta_eattr);
 			bc->ea_count++;
 		}
-		brelse(leaf_bh, not_updated);
 	}
 	*bh = leaf_bh;
 
--- cluster/gfs2/fsck/pass1c.c	2007/09/18 18:14:27	1.4.2.3
+++ cluster/gfs2/fsck/pass1c.c	2007/11/16 23:22:23	1.4.2.4
@@ -77,7 +77,6 @@
 	int *update = (int *) private;
 	struct gfs2_sbd *sbp = ip->i_sbd;
 	struct gfs2_block_query q;
-	struct gfs2_buffer_head *leaf_bh;
 
 	if(gfs2_check_range(sbp, block)) {
 		log_err("Extended attributes block out of range...removing\n");
@@ -96,9 +95,8 @@
 		return 1;
 	}
 	else 
-		leaf_bh = bread(sbp, block);
+		*bh = bread(sbp, block);
 
-	*bh = leaf_bh;
 	return 0;
 }
 
@@ -237,24 +235,28 @@
 
 		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
 			return 0;
-		log_info("EA in inode %"PRIu64" (0x%" PRIx64 ")\n", block_no,
-				 block_no);
 		bh = bread(sbp, block_no);
-		ip = inode_get(sbp, bh);
+		if (gfs2_check_meta(bh, GFS2_METATYPE_IN)) { /* if a dinode */
+			log_info("EA in inode %"PRIu64" (0x%" PRIx64 ")\n",
+				 block_no, block_no);
+			gfs2_block_clear(bl, block_no, gfs2_eattr_block);
+			ip = inode_get(sbp, bh);
 
-		log_debug("Found eattr at %"PRIu64" (0x%" PRIx64 ")\n",
+			log_debug("Found eattr at %"PRIu64" (0x%" PRIx64 ")\n",
 				  ip->i_di.di_eattr, ip->i_di.di_eattr);
-		/* FIXME: Handle walking the eattr here */
-		error = check_inode_eattr(ip, &pass1c_fxns);
-		if(error < 0) {
-			stack;
-			return -1;
-		}
+			/* FIXME: Handle walking the eattr here */
+			error = check_inode_eattr(ip, &pass1c_fxns);
+			if(error < 0) {
+				stack;
+				brelse(bh, not_updated);
+				return -1;
+			}
 
-		if(update)
-			gfs2_dinode_out(&ip->i_di, bh->b_data);
+			if(update)
+				gfs2_dinode_out(&ip->i_di, bh->b_data);
 
-		free(ip);
+			free(ip);
+		}
 		brelse(bh, update);
 
 		block_no++;
--- cluster/gfs2/fsck/pass2.c	2007/09/18 18:14:27	1.4.2.5
+++ cluster/gfs2/fsck/pass2.c	2007/11/16 23:22:23	1.4.2.6
@@ -89,18 +89,13 @@
 static int check_eattr_indir(struct gfs2_inode *ip, uint64_t block,
 			    uint64_t parent, struct gfs2_buffer_head **bh, void *private)
 {
-
+	*bh = bread(ip->i_sbd, block);
 	return 0;
 }
 static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
 			    uint64_t parent, struct gfs2_buffer_head **bh, void *private)
 {
-#if 0
-	struct gfs2_buffer_head *leaf_bh;
-
-	leaf_bh = bread(ip->i_sbd, block);
-	brelse(leaf_bh);
-#endif
+	*bh = bread(ip->i_sbd, block);
 	return 0;
 }
 
--- cluster/gfs2/fsck/pass5.c	2007/06/28 23:42:45	1.3.2.2
+++ cluster/gfs2/fsck/pass5.c	2007/11/16 23:22:23	1.3.2.3
@@ -81,7 +81,6 @@
 	while(byte < end) {
 		rg_status = ((*byte >> bit) & GFS2_BIT_MASK);
 		block = rg_data + *rg_block;
-		log_debug("Checking block %" PRIu64 "\n", block);
 		warm_fuzzy_stuff(block);
 		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
 			return 0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]