CVSROOT:        /cvs/cluster
Module name:    cluster
Changes by:     [EMAIL PROTECTED]       2007-09-17 17:08:21

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&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/metawalk.c.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass2.c.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/libgfs2/fs_ops.c.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/libgfs2/libgfs2.h.diff?cvsroot=cluster&r1=1.18&r2=1.19

--- cluster/gfs2/fsck/main.c    2007/08/22 08:58:46     1.9
+++ cluster/gfs2/fsck/main.c    2007/09/17 17:08:20     1.10
@@ -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");
--- cluster/gfs2/fsck/metawalk.c        2007/09/16 17:14:45     1.11
+++ cluster/gfs2/fsck/metawalk.c        2007/09/17 17:08:20     1.12
@@ -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:11:10     1.7
+++ cluster/gfs2/fsck/pass2.c   2007/09/17 17:08:20     1.8
@@ -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:43:17     1.10
+++ cluster/gfs2/libgfs2/fs_ops.c       2007/09/17 17:08:20     1.11
@@ -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");
 
--- cluster/gfs2/libgfs2/libgfs2.h      2007/09/16 17:14:45     1.18
+++ cluster/gfs2/libgfs2/libgfs2.h      2007/09/17 17:08:20     1.19
@@ -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);

Reply via email to