public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tytso@mit.edu
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] [3/4]: Ext2/3 updates: HTREE backwards compatibility patch
Date: Tue, 12 Nov 2002 01:33:23 -0500	[thread overview]
Message-ID: <E18BUbz-0005j1-00@snap.thunk.org> (raw)

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.)

dir.c    |    3 +++
ialloc.c |    2 +-
2 files changed, 4 insertions(+), 1 deletion(-)

diff -Nru a/fs/ext2/dir.c b/fs/ext2/dir.c
--- a/fs/ext2/dir.c	Tue Nov 12 01:14:00 2002
+++ b/fs/ext2/dir.c	Tue Nov 12 01:14:00 2002
@@ -420,6 +420,7 @@
 	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 @@
 	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 @@
 	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);
diff -Nru a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
--- a/fs/ext2/ialloc.c	Tue Nov 12 01:14:00 2002
+++ b/fs/ext2/ialloc.c	Tue Nov 12 01:14:00 2002
@@ -514,7 +514,7 @@
 	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 */

                 reply	other threads:[~2002-11-12  6:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E18BUbz-0005j1-00@snap.thunk.org \
    --to=tytso@mit.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox