]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ext2: clear ext3 htree flag on directories
authorAndrew Morton <akpm@digeo.com>
Sun, 2 Mar 2003 12:37:19 +0000 (04:37 -0800)
committerDavid S. Miller <davem@nuts.ninka.net>
Sun, 2 Mar 2003 12:37:19 +0000 (04:37 -0800)
Forward port of a change which Ted made to 2.4's ext2.

HTREE backwards compatibility patch.

"I thought (and assumed) this patch had been applied to both the ext2 and
 ext3 filesystems in the 2.4 kernel.  It turns out it had only made it into
 the ext3 filesystem code.  This means that if an HTREE-enabled filesystem is
 mounted using ext2, it will corrupt the filesystem as far as e2fsck and an
 ext3 htree-enabled kernel is concerned.  (The corruption won't cause any
 data loss, but it will cause e2fsck and an ext3-htree kernel to omit a lot
 of warning messages.)"

fs/ext2/dir.c
fs/ext2/ialloc.c

index e9c4751e08a690fdee1dce7e6ed9e795a027ca10..18eaaed6c0fd51355a1d99758daf0e82f9d5d96f 100644 (file)
@@ -420,6 +420,7 @@ void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
        err = ext2_commit_chunk(page, from, to);
        ext2_put_page(page);
        dir->i_mtime = dir->i_ctime = CURRENT_TIME;
+       EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
        mark_inode_dirty(dir);
 }
 
@@ -509,6 +510,7 @@ got_it:
        ext2_set_de_type (de, inode);
        err = ext2_commit_chunk(page, from, to);
        dir->i_mtime = dir->i_ctime = CURRENT_TIME;
+       EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
        mark_inode_dirty(dir);
        /* OFFSET_CACHE */
 out_put:
@@ -556,6 +558,7 @@ int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
        dir->inode = 0;
        err = ext2_commit_chunk(page, from, to);
        inode->i_ctime = inode->i_mtime = CURRENT_TIME;
+       EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL;
        mark_inode_dirty(inode);
 out:
        ext2_put_page(page);
index aaa58ce59962e646c833cbf8823025b7da084422..345e7495176d8ca5323ecaf226e55828bba688e5 100644 (file)
@@ -526,7 +526,7 @@ repeat:
        inode->i_blocks = 0;
        inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
        memset(ei->i_data, 0, sizeof(ei->i_data));
-       ei->i_flags = EXT2_I(dir)->i_flags;
+       ei->i_flags = EXT2_I(dir)->i_flags & ~EXT2_BTREE_FL;
        if (S_ISLNK(mode))
                ei->i_flags &= ~(EXT2_IMMUTABLE_FL|EXT2_APPEND_FL);
        /* dirsync is only applied to directories */