From mboxrd@z Thu Jan 1 00:00:00 1970 From: rpeterso@sourceware.org Date: 17 Sep 2007 17:25:23 -0000 Subject: [Cluster-devel] cluster/gfs2 fsck/main.c fsck/metawalk.c fsck/ ... Message-ID: <20070917172523.24063.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Branch: RHEL51 Changes by: rpeterso at sourceware.org 2007-09-17 17:25:23 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=RHEL51&r1=1.4.2.3&r2=1.4.2.3.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/metawalk.c.diff?cvsroot=cluster&only_with_tag=RHEL51&r1=1.3.2.7.2.1&r2=1.3.2.7.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass2.c.diff?cvsroot=cluster&only_with_tag=RHEL51&r1=1.4.2.3&r2=1.4.2.3.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/libgfs2/fs_ops.c.diff?cvsroot=cluster&only_with_tag=RHEL51&r1=1.4.2.6&r2=1.4.2.6.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/libgfs2/libgfs2.h.diff?cvsroot=cluster&only_with_tag=RHEL51&r1=1.7.2.9.2.1&r2=1.7.2.9.2.2 --- cluster/gfs2/fsck/main.c 2007/05/01 18:20:49 1.4.2.3 +++ cluster/gfs2/fsck/main.c 2007/09/17 17:25:22 1.4.2.3.2.1 @@ -313,6 +313,7 @@ struct gfs2_sbd sb; struct gfs2_sbd *sbp = &sb; int j; + enum update_flags update_sys_files; memset(sbp, 0, sizeof(*sbp)); @@ -417,22 +418,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"); --- cluster/gfs2/fsck/metawalk.c 2007/09/16 17:19:03 1.3.2.7.2.1 +++ cluster/gfs2/fsck/metawalk.c 2007/09/17 17:25:22 1.3.2.7.2.2 @@ -750,7 +750,7 @@ } } - inode_put(ip, update); /* does a brelse */ + inode_put(ip, opts.no ? not_updated : update); /* does a brelse */ return error; } --- cluster/gfs2/fsck/pass2.c 2007/05/15 18:21:08 1.4.2.3 +++ cluster/gfs2/fsck/pass2.c 2007/09/17 17:25:22 1.4.2.3.2.1 @@ -608,7 +608,7 @@ } } - brelse(bh, update); + brelse(bh, opts.no ? not_updated : update); return 0; } --- cluster/gfs2/libgfs2/fs_ops.c 2007/06/26 01:51:44 1.4.2.6 +++ cluster/gfs2/libgfs2/fs_ops.c 2007/09/17 17:25:22 1.4.2.6.2.1 @@ -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, ¬_new, &dblock, &extlen, FALSE); + block_map(ip, lblock, ¬_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"); --- cluster/gfs2/libgfs2/libgfs2.h 2007/09/16 17:19:03 1.7.2.9.2.1 +++ cluster/gfs2/libgfs2/libgfs2.h 2007/09/17 17:25:22 1.7.2.9.2.2 @@ -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);