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

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



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL50
Changes by:	rpeterso sourceware org	2006-11-20 21:30:40

Modified files:
	gfs2/fsck      : metawalk.c 

Log message:
	Resolves: bz215809: fsck errors on gfs2 volume

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/metawalk.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.3&r2=1.3.4.1

--- cluster/gfs2/fsck/metawalk.c	2006/06/12 20:41:43	1.3
+++ cluster/gfs2/fsck/metawalk.c	2006/11/20 21:30:40	1.3.4.1
@@ -74,15 +74,26 @@
 				return 1;
 			}
 		} else {
-			error = pass->check_dentry(ip, dent, prev, bh, filename, update,
-									   count, pass->private);
-			if(error < 0) {
-				stack;
-				return -1;
+			if (!de.de_inum.no_addr && first) { /* reverse sentinel */
+				log_debug("First dirent is a Sentinel (place holder).\n");
+				/* Swap the two to silently make it a proper sentinel */
+				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 */
+				first = 0;
+			}
+			else {
+				error = pass->check_dentry(ip, dent, prev, bh, filename,
+							   update, count, pass->private);
+				if(error < 0) {
+					stack;
+					return -1;
+				}
+				/*if(error > 0) {
+				  return 1;
+				  }*/
 			}
-			/*if(error > 0) {
-			  return 1;
-			  }*/
 		}
 
 		if ((char *)dent + de.de_rec_len >= bh_end){
@@ -151,21 +162,25 @@
 				}
 			}
 
+			*update = not_updated;
 			lbh = bread(sbp, leaf_no);
 			gfs2_leaf_in(&leaf, lbh->b_data);
 
 			exp_count = (1 << (ip->i_di.di_depth - leaf.lf_depth));
 			log_debug("expected count %u - di_depth %u, leaf depth %u\n",
 					  exp_count, ip->i_di.di_depth, leaf.lf_depth);
+
 			if(pass->check_dentry &&
 			   S_ISDIR(ip->i_di.di_mode)) {
 				error = check_entries(ip, lbh, index, DIR_EXHASH, update,
 									  &count, pass);
 
 				/* Since the buffer possibly got
-				   updated directly, release it now,
-				   and grab it again later if we need it */
-				brelse(lbh, not_updated);
+				 * updated directly, release it now,
+				 * and grab it again later if we need it. */
+
+				brelse(lbh, *update);
+
 				if(error < 0) {
 					stack;
 					return -1;


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