cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] cluster/gfs2/fsck metawalk.c pass1.c pass1b.c  ...
@ 2007-09-18 18:14 rpeterso
  0 siblings, 0 replies; 3+ messages in thread
From: rpeterso @ 2007-09-18 18:14 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rpeterso at sourceware.org	2007-09-18 18:14:06

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

Log message:
	Resolves: bz 291451: gfs2_fsck -n, Bad file descriptor on line 63 of
	file buf.c (addendum)

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

--- cluster/gfs2/fsck/metawalk.c	2007/09/17 17:08:20	1.12
+++ cluster/gfs2/fsck/metawalk.c	2007/09/18 18:14:04	1.13
@@ -140,7 +140,8 @@
 				de.de_inum.no_addr = de.de_inum.no_formal_ino;
 				de.de_inum.no_formal_ino = 0;
 				gfs2_dirent_out(&de, (char *)dent);
-				*update = 1; /* Mark dirent buffer as modified */
+				*update = (opts.no ? not_updated : updated);
+				/* Mark dirent buffer as modified */
 				first = 0;
 			}
 			else {
@@ -282,7 +283,7 @@
 					       old_leaf, index,
 					       "that is not really a leaf");
 				memcpy(&leaf, &oldleaf, sizeof(oldleaf));
-				brelse(lbh, updated);
+				brelse(lbh, (opts.no ? not_updated : updated));
 				break;
 			}
 			gfs2_leaf_in(&leaf, lbh->b_data);
@@ -303,7 +304,7 @@
 				leaf.lf_dirent_format = GFS2_FORMAT_DE;
 				gfs2_leaf_out(&leaf, lbh->b_data);
 				log_debug("Fixing lf_dirent_format.\n");
-				*update = updated;
+				*update = (opts.no ? not_updated : updated);
 			}
 
 			/* Make sure it's really a leaf. */
@@ -768,15 +769,12 @@
 	memset(&dentry, 0, sizeof(struct gfs2_dirent));
 	gfs2_dirent_in(&dentry, (char *)dent);
 	de = &dentry;
+	*update = (opts.no ? not_updated : updated);
 
-	if(de->de_inum.no_addr == *dentryblock) {
-		*update = 1;
+	if(de->de_inum.no_addr == *dentryblock)
 		dirent2_del(ip, bh, prev_de, dent);
-	}
-	else {
+	else
 		(*count)++;
-		*update = 1;
-	}
 
 	return 0;
 
--- cluster/gfs2/fsck/pass1.c	2007/08/15 22:28:18	1.10
+++ cluster/gfs2/fsck/pass1.c	2007/09/18 18:14:04	1.11
@@ -253,7 +253,7 @@
 			    void *private)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_buffer_head *leaf_bh;
+	struct gfs2_buffer_head *leaf_bh = NULL;
 	int ret = 0;
 	struct gfs2_block_query q = {0};
 	struct block_count *bc = (struct block_count *) private;
--- cluster/gfs2/fsck/pass1b.c	2007/06/28 23:41:37	1.5
+++ cluster/gfs2/fsck/pass1b.c	2007/09/18 18:14:04	1.6
@@ -367,7 +367,7 @@
 		id->ea_only = myfi.ea_only;
 		osi_list_add_prev(&id->list, &b->ref_inode_list);
 	}
-	inode_put(ip, updated); /* out, brelse, free */
+	inode_put(ip, (opts.no ? not_updated : updated)); /* out, brelse, free */
 	return 0;
 }
 
@@ -464,7 +464,7 @@
 	struct blocks *b;
 	uint64_t i;
 	struct gfs2_block_query q;
-	osi_list_t *tmp;
+	osi_list_t *tmp = NULL;
 	struct metawalk_fxns find_dirents = {0};
 	find_dirents.check_dentry = &find_dentry;
 	int rc = 0;
--- cluster/gfs2/fsck/pass1c.c	2007/06/28 23:41:37	1.6
+++ cluster/gfs2/fsck/pass1c.c	2007/09/18 18:14:04	1.7
@@ -52,7 +52,7 @@
 	if(gfs2_check_range(sbp, block)) {
 		log_err("Extended attributes indirect block out of range...removing\n");
 		ip->i_di.di_eattr = 0;
-		*update = 1;
+		*update = (opts.no ? not_updated : updated);
 		return 1;
 	}
 	else if (gfs2_block_check(bl, block, &q)) {
@@ -62,7 +62,7 @@
 	else if(q.block_type != gfs2_indir_blk) {
 		log_err("Extended attributes indirect block invalid...removing\n");
 		ip->i_di.di_eattr = 0;
-		*update = 1;
+		*update = (opts.no ? not_updated : updated);
 		return 1;
 	}
 	else
@@ -82,7 +82,7 @@
 	if(gfs2_check_range(sbp, block)) {
 		log_err("Extended attributes block out of range...removing\n");
 		ip->i_di.di_eattr = 0;
-		*update = 1;
+		*update = (opts.no ? not_updated : updated);
 		return 1;
 	}
 	else if (gfs2_block_check(bl, block, &q)) {
@@ -92,7 +92,7 @@
 	else if(q.block_type != gfs2_meta_eattr) {
 		log_err("Extended attributes block invalid...removing\n");
 		ip->i_di.di_eattr = 0;
-		*update = 1;
+		*update = (opts.no ? not_updated : updated);
 		return 1;
 	}
 	else 
--- cluster/gfs2/fsck/pass2.c	2007/09/17 17:08:20	1.8
+++ cluster/gfs2/fsck/pass2.c	2007/09/18 18:14:04	1.9
@@ -157,9 +157,9 @@
 /* FIXME: should maybe refactor this a bit - but need to deal with
  * FIXMEs internally first */
 int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
-				 struct gfs2_dirent *prev_de,
-				 struct gfs2_buffer_head *bh, char *filename, int *update,
-				 uint16_t *count, void *priv)
+		 struct gfs2_dirent *prev_de,
+		 struct gfs2_buffer_head *bh, char *filename,
+		 int *update, uint16_t *count, void *priv)
 {
 	struct gfs2_sbd *sbp = ip->i_sbd;
 	struct gfs2_block_query q = {0};
@@ -231,10 +231,10 @@
 				 "Clear directory entry tp out of range block? (y/n) ")) {
 			log_err("Clearing %s\n", tmp_name);
 			dirent2_del(ip, bh, prev_de, dent);
+			*update = 1;
 			return 1;
 		} else {
 			log_err("Directory entry to out of range block remains\n");
-			*update = 1;
 			(*count)++;
 			ds->entry_count++;
 			return 0;
@@ -265,10 +265,10 @@
 			dirent2_del(ip, bh, prev_de, dent);
 
 			gfs2_block_set(bl, de->de_inum.no_addr, gfs2_meta_inval);
+			*update = 1;
 			return 1;
 		} else {
 			log_warn("Entry to inode containing bad blocks remains\n");
-			*update = 1;
 			(*count)++;
 			ds->entry_count++;
 			return 0;
@@ -291,11 +291,11 @@
 			 * this inode are cleared in the bitmap */
 
 			dirent2_del(ip, bh, prev_de, dent);
+			*update = 1;
 			log_warn("Directory entry '%s' cleared\n", tmp_name);
 			return 1;
 		} else {
 			log_err("Directory entry to non-inode block remains\n");
-			*update = 1;
 			(*count)++;
 			ds->entry_count++;
 			return 0;
@@ -319,10 +319,10 @@
 			inode_put(entry_ip, not_updated);
 
 			dirent2_del(ip, bh, prev_de, dent);
+			*update  = 1;
 			return 1;
 		} else {
 			log_err("Stale directory entry remains\n");
-			*update  = 1;
 			(*count)++;
 			ds->entry_count++;
 			return 0;
@@ -343,6 +343,7 @@
 				inode_put(entry_ip, not_updated);
 
 				dirent2_del(ip, bh, prev_de, dent);
+				*update  = 1;
 				return 1;
 			} else {
 				log_err("Duplicate '.' entry remains\n");
@@ -350,7 +351,6 @@
 				 * and check the rest of the '.'
 				 * entry? */
 				increment_link(sbp, de->de_inum.no_addr);
-				*update  = 1;
 				(*count)++;
 				ds->entry_count++;
 				return 0;
@@ -374,6 +374,7 @@
 				inode_put(entry_ip, not_updated);
 
 				dirent2_del(ip, bh, prev_de, dent);
+				*update = 1;
 				return 1;
 
 			} else {
@@ -381,7 +382,6 @@
 				/* Not setting ds->dotdir here since
 				 * this '.' entry is invalid */
 				increment_link(sbp, de->de_inum.no_addr);
-				*update = 1;
 				(*count)++;
 				ds->entry_count++;
 				return 0;
@@ -390,7 +390,7 @@
 
 		ds->dotdir = 1;
 		increment_link(sbp, de->de_inum.no_addr);
-		*update = 1;
+		*update = (opts.no ? not_updated : updated);
 		(*count)++;
 		ds->entry_count++;
 
@@ -417,7 +417,6 @@
 				 * and check the rest of the '..'
 				 * entry? */
 				increment_link(sbp, de->de_inum.no_addr);
-				*update  = 1;
 				(*count)++;
 				ds->entry_count++;
 				return 0;
@@ -440,7 +439,6 @@
 			} else {
 				log_err("Bad '..' directory entry remains\n");
 				increment_link(sbp, de->de_inum.no_addr);
-				*update  = 1;
 				(*count)++;
 				ds->entry_count++;
 				return 0;
@@ -459,7 +457,7 @@
 
 		ds->dotdotdir = 1;
 		increment_link(sbp, de->de_inum.no_addr);
-		*update = 1;
+		*update = (opts.no ? not_updated : updated);
 		(*count)++;
 		ds->entry_count++;
 		return 0;
@@ -470,7 +468,7 @@
 	if(q.block_type != gfs2_inode_dir) {
 		log_debug("Found non-dir inode dentry\n");
 		increment_link(sbp, de->de_inum.no_addr);
-		*update = 1;
+		*update = (opts.no ? not_updated : updated);
 		(*count)++;
 		ds->entry_count++;
 		return 0;
@@ -491,7 +489,6 @@
 			return 1;
 		} else {
 			log_err("Hard link to directory remains\n");
-			*update = 1;
 			(*count)++;
 			ds->entry_count++;
 			return 0;
@@ -502,7 +499,7 @@
 		return -1;
 	}
 	increment_link(sbp, de->de_inum.no_addr);
-	*update = 1;
+	*update = (opts.no ? not_updated : updated);
 	(*count)++;
 	ds->entry_count++;
 	/* End of checks */



^ permalink raw reply	[flat|nested] 3+ messages in thread
* [Cluster-devel] cluster/gfs2/fsck metawalk.c pass1.c pass1b.c  ...
@ 2007-06-28 23:42 rpeterso
  0 siblings, 0 replies; 3+ messages in thread
From: rpeterso @ 2007-06-28 23:42 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	rpeterso at sourceware.org	2007-06-28 23:42:45

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&only_with_tag=RHEL5&r1=1.3.2.6&r2=1.3.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass1.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.4&r2=1.4.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass1b.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.1&r2=1.3.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass1c.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.1&r2=1.4.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass5.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.1&r2=1.3.2.2

--- cluster/gfs2/fsck/metawalk.c	2007/05/15 18:21:08	1.3.2.6
+++ cluster/gfs2/fsck/metawalk.c	2007/06/28 23:42:45	1.3.2.7
@@ -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:21:08	1.4.2.4
+++ cluster/gfs2/fsck/pass1.c	2007/06/28 23:42:45	1.4.2.5
@@ -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:30:19	1.3.2.1
+++ cluster/gfs2/fsck/pass1b.c	2007/06/28 23:42:45	1.3.2.2
@@ -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:30:19	1.4.2.1
+++ cluster/gfs2/fsck/pass1c.c	2007/06/28 23:42:45	1.4.2.2
@@ -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:30:19	1.3.2.1
+++ cluster/gfs2/fsck/pass5.c	2007/06/28 23:42:45	1.3.2.2
@@ -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"};



^ permalink raw reply	[flat|nested] 3+ messages in thread
* [Cluster-devel] cluster/gfs2/fsck metawalk.c pass1.c pass1b.c  ...
@ 2007-06-28 23:41 rpeterso
  0 siblings, 0 replies; 3+ messages in thread
From: rpeterso @ 2007-06-28 23:41 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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"};



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-09-18 18:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-18 18:14 [Cluster-devel] cluster/gfs2/fsck metawalk.c pass1.c pass1b.c rpeterso
  -- strict thread matches above, loose matches on Subject: below --
2007-06-28 23:42 rpeterso
2007-06-28 23:41 rpeterso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).