Per,
I feel like an idiot.  (Not the first time either.)  I had fixed this
bug back in March, and then forgot about it.  The fix made it into
SuSE's bugzilla, and I believe it's fixed in the latest kernel update.
I missed the cutoff for 9.3 though.  Also fixed in 2.6.12-rc2 in the
mainline.

The problem is triggered by the /etc/init.d/earlykdm script.  It runs
the preload command against a list of files that includes directories,
and the directories caused jfs to get confused, and think there was file
corruption.

Workaround is to disable the earlykdm script, or at least the lines that
run preload.

(mail to [EMAIL PROTECTED] got screwed up this weekend, so I may
have lost some mail.  Please use [EMAIL PROTECTED] for the time
being.)

Here's the patch.

jfs no longer uses a directory inode's address space.  Clean up the
code by removing aops for directories altogether

Signed-off-by: Dave Kleikamp <[EMAIL PROTECTED]>

diff -urp linux-2.6.11/fs/jfs/inode.c linux/fs/jfs/inode.c
--- linux-2.6.11/fs/jfs/inode.c 2005-03-24 08:14:27.000000000 -0600
+++ linux/fs/jfs/inode.c        2005-03-24 08:16:14.000000000 -0600
@@ -52,8 +52,6 @@ void jfs_read_inode(struct inode *inode)
        } else if (S_ISDIR(inode->i_mode)) {
                inode->i_op = &jfs_dir_inode_operations;
                inode->i_fop = &jfs_dir_operations;
-               inode->i_mapping->a_ops = &jfs_aops;
-               mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
        } else if (S_ISLNK(inode->i_mode)) {
                if (inode->i_size >= IDATASIZE) {
                        inode->i_op = &page_symlink_inode_operations;
@@ -176,7 +174,6 @@ jfs_get_blocks(struct inode *ip, sector_
                        struct buffer_head *bh_result, int create)
 {
        s64 lblock64 = lblock;
-       int no_size_check = 0;
        int rc = 0;
        int take_locks;
        xad_t xad;
@@ -188,8 +185,8 @@ jfs_get_blocks(struct inode *ip, sector_
         * If this is a special inode (imap, dmap) or directory,
         * the lock should already be taken
         */
-       take_locks = ((JFS_IP(ip)->fileset != AGGREGATE_I) &&
-                     !S_ISDIR(ip->i_mode));
+       take_locks = (JFS_IP(ip)->fileset != AGGREGATE_I);
+
        /*
         * Take appropriate lock on inode
         */
@@ -200,16 +197,8 @@ jfs_get_blocks(struct inode *ip, sector_
                        IREAD_LOCK(ip);
        }
 
-       /*
-        * A directory's "data" is the inode index table, but i_size is the
-        * size of the d-tree, so don't check the offset against i_size
-        */
-       if (S_ISDIR(ip->i_mode))
-               no_size_check = 1;
-
-       if ((no_size_check ||
-            ((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size)) &&
-           (xtLookup(ip, lblock64, max_blocks, &xflag, &xaddr, &xlen, 
no_size_check)
+       if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) &&
+           (xtLookup(ip, lblock64, max_blocks, &xflag, &xaddr, &xlen, 0)
             == 0) && xlen) {
                if (xflag & XAD_NOTRECORDED) {
                        if (!create)
diff -urp linux-2.6.11/fs/jfs/namei.c linux/fs/jfs/namei.c
--- linux-2.6.11/fs/jfs/namei.c 2005-03-24 08:14:27.000000000 -0600
+++ linux/fs/jfs/namei.c        2005-03-24 08:16:23.000000000 -0600
@@ -262,8 +262,6 @@ static int jfs_mkdir(struct inode *dip, 
        ip->i_nlink = 2;        /* for '.' */
        ip->i_op = &jfs_dir_inode_operations;
        ip->i_fop = &jfs_dir_operations;
-       ip->i_mapping->a_ops = &jfs_aops;
-       mapping_set_gfp_mask(ip->i_mapping, GFP_NOFS);
 
        insert_inode_hash(ip);
        mark_inode_dirty(ip);

-- 
David Kleikamp
IBM Linux Technology Center



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jfs-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jfs-discussion

Reply via email to