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

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



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rpeterso 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 */


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