Skip to contentSkip to conversation

cluster/gfs2 fsck/main.c fsck/metawalk.c fsck/ ...

Cluster-devel [email protected] 1 participant 1 message Sep 17, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: rpeterso at sourceware.org 2007-09-17 17:23:40

Modified files:
gfs2/fsck : main.c metawalk.c pass2.c
gfs2/libgfs2 : fs_ops.c libgfs2.h

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

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/main.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/metawalk.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.8&r2=1.3.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass2.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/libgfs2/fs_ops.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.6&r2=1.4.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/libgfs2/libgfs2.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.7.2.11&r2=1.7.2.12

gfs2/fsck/main.c +14 -11
@@ -283,6 +283,7 @@
 	struct gfs2_sbd sb;
 	struct gfs2_sbd *sbp = &sb;
 	int j;
+	enum update_flags update_sys_files;
 
 	memset(sbp, 0, sizeof(*sbp));
 
@@ -387,22 +388,24 @@
 		else
 			log_notice("Pass5 complete      \n");
 	}
+	update_sys_files = (opts.no ? not_updated : updated);
 	/* Free up our system inodes */
-	inode_put(sbp->md.inum, updated);
-	inode_put(sbp->md.statfs, updated);
+	inode_put(sbp->md.inum, update_sys_files);
+	inode_put(sbp->md.statfs, update_sys_files);
 	for (j = 0; j < sbp->md.journals; j++)
-		inode_put(sbp->md.journal[j], updated);
-	inode_put(sbp->md.jiinode, updated);
-	inode_put(sbp->md.riinode, updated);
-	inode_put(sbp->md.qinode, updated);
-	inode_put(sbp->md.pinode, updated);
-	inode_put(sbp->md.rooti, updated);
-	inode_put(sbp->master_dir, updated);
+		inode_put(sbp->md.journal[j], update_sys_files);
+	inode_put(sbp->md.jiinode, update_sys_files);
+	inode_put(sbp->md.riinode, update_sys_files);
+	inode_put(sbp->md.qinode, update_sys_files);
+	inode_put(sbp->md.pinode, update_sys_files);
+	inode_put(sbp->md.rooti, update_sys_files);
+	inode_put(sbp->master_dir, update_sys_files);
 	if (lf_dip)
-		inode_put(lf_dip, updated);
+		inode_put(lf_dip, update_sys_files);
 /*	print_map(sbp->bl, sbp->last_fs_block); */
 
-	log_notice("Writing changes to disk\n");
+	if (!opts.no)
+		log_notice("Writing changes to disk\n");
 	bsync(sbp);
 	destroy(sbp);
 	log_notice("gfs2_fsck complete    \n");
gfs2/fsck/metawalk.c +1 -1
@@ -750,7 +750,7 @@
 		}
 	}
 
-	inode_put(ip, update); /* does a brelse */
+	inode_put(ip, opts.no ? not_updated : update); /* does a brelse */
 	return error;
 }
 
gfs2/fsck/pass2.c +1 -1
@@ -608,7 +608,7 @@
 		}
 	}
 
-	brelse(bh, update);
+	brelse(bh, opts.no ? not_updated : update);
 	return 0;
 }
 
gfs2/libgfs2/fs_ops.c +9 -6
@@ -335,7 +335,8 @@
 }
 
 void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
-			   uint64_t *dblock, uint32_t *extlen, int prealloc)
+	       uint64_t *dblock, uint32_t *extlen, int prealloc,
+	       enum update_flags if_changed)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
 	struct gfs2_buffer_head *bh;
@@ -377,7 +378,7 @@
 
 	for (x = 0; x < end_of_metadata; x++) {
 		lookup_block(ip, bh, x, mp, create, new, dblock);
-		brelse(bh, updated);
+		brelse(bh, if_changed);
 		if (!*dblock)
 			goto out;
 
@@ -417,7 +418,7 @@
 		}
 	}
 
-	brelse(bh, updated);
+	brelse(bh, if_changed);
 
  out:
 	free(mp);
@@ -478,7 +479,8 @@
 			amount = sdp->bsize - o;
 
 		if (!extlen)
-			block_map(ip, lblock, &not_new, &dblock, &extlen, FALSE);
+			block_map(ip, lblock, &not_new, &dblock, &extlen,
+				  FALSE, not_updated);
 
 		if (dblock) {
 			bh = bread(sdp, dblock);
@@ -550,7 +552,8 @@
 
 		if (!extlen) {
 			new = TRUE;
-			block_map(ip, lblock, &new, &dblock, &extlen, FALSE);
+			block_map(ip, lblock, &new, &dblock, &extlen, FALSE,
+				  updated);
 		}
 
 		if (new) {
@@ -591,7 +594,7 @@
 	if (inode_is_stuffed(ip))
 		unstuff_dinode(ip);
 
-	block_map(ip, lbn, &new, &dbn, NULL, prealloc);
+	block_map(ip, lbn, &new, &dbn, NULL, prealloc, not_updated);
 	if (!dbn)
 		die("get_file_buf\n");
 
gfs2/libgfs2/libgfs2.h +2 -1
@@ -406,7 +406,8 @@
 int gfs2_dirent_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
 		    const char *filename, int filename_len);
 void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
-			   uint64_t *dblock, uint32_t *extlen, int prealloc);
+	       uint64_t *dblock, uint32_t *extlen, int prealloc,
+	       enum update_flags if_changed);
 void gfs2_get_leaf_nr(struct gfs2_inode *dip, uint32_t index,
 					  uint64_t *leaf_out);
 void gfs2_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx, uint64_t leaf_out);