* [PATCH 0/2] Fix wrong name_len and file_type in intermediate htree nodes
@ 2009-08-30 14:56 Andreas Schlick
2009-08-30 14:57 ` [PATCH 1/2] ext4: Always set dx_node's fake_dirent explicitly Andreas Schlick
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schlick @ 2009-08-30 14:56 UTC (permalink / raw)
To: Ext4 Developers List
Hello,
while testing the dirshrink patch, I found that sometimes intermediate htree
nodes end up with their fake_dirent's name_len and file_type not being zero.
e2fsck will then consider the htree to be corrupted as it doesn't recognise
that these blocks contain dx_nodes.
As far as I understand it, this happens sometimes when ext4_dx_add_entry() has
to create a new index node and calls ext4_append(). In the end ext4_getblk()
is called and it might get a buffer that has BH_Uptodate set, causing
ext4_getblk() to not zero it out and leave the old content intact.
I can reproduce this with plain linux-2.6.30.5. To produce this I use a nearly
full filesystem and continuously create new files in one directory while
removing other directories/files at the same time.
Do I understand it correctly, that it happens when the newly allocated block
(for the new index node) was very recently used by another file/directory, so
that it is still in the buffer cache? But it surprises me that it doesn't
happen more often.
Andreas Schlick
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] ext4: Always set dx_node's fake_dirent explicitly.
2009-08-30 14:56 [PATCH 0/2] Fix wrong name_len and file_type in intermediate htree nodes Andreas Schlick
@ 2009-08-30 14:57 ` Andreas Schlick
2009-08-30 14:58 ` [PATCH 2/2] ext3: " Andreas Schlick
2009-09-11 3:19 ` [PATCH 1/2] ext4: " Theodore Tso
0 siblings, 2 replies; 4+ messages in thread
From: Andreas Schlick @ 2009-08-30 14:57 UTC (permalink / raw)
To: Ext4 Developers List
When ext4_dx_add_entry() has to split an index node, it has to ensure that
name_len of dx_node's fake_dirent is also zero, because otherwise e2fsck
won't recognise it as an intermediate htree node and consider the htree to
be corrupted.
Signed-off-by: Andreas Schlick <schlick@lavabit.com>
---
fs/ext4/namei.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 22098e1..682a488 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1590,9 +1590,9 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
goto cleanup;
node2 = (struct dx_node *)(bh2->b_data);
entries2 = node2->entries;
+ memset(&node2->fake, 0, sizeof(struct fake_dirent));
node2->fake.rec_len = ext4_rec_len_to_disk(sb->s_blocksize,
sb->s_blocksize);
- node2->fake.inode = 0;
BUFFER_TRACE(frame->bh, "get_write_access");
err = ext4_journal_get_write_access(handle, frame->bh);
if (err)
--
1.6.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ext3: Always set dx_node's fake_dirent explicitly.
2009-08-30 14:57 ` [PATCH 1/2] ext4: Always set dx_node's fake_dirent explicitly Andreas Schlick
@ 2009-08-30 14:58 ` Andreas Schlick
2009-09-11 3:19 ` [PATCH 1/2] ext4: " Theodore Tso
1 sibling, 0 replies; 4+ messages in thread
From: Andreas Schlick @ 2009-08-30 14:58 UTC (permalink / raw)
To: Ext4 Developers List
When ext3_dx_add_entry() has to split an index node, it has to ensure that
name_len of dx_node's fake_dirent is also zero, because otherwise e2fsck
won't recognise it as an intermediate htree node and consider the htree to
be corrupted.
Signed-off-by: Andreas Schlick <schlick@lavabit.com>
---
fs/ext3/namei.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 6ff7b97..877dd2b 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1550,8 +1550,8 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry,
goto cleanup;
node2 = (struct dx_node *)(bh2->b_data);
entries2 = node2->entries;
+ memset(&node2->fake, 0, sizeof(struct fake_dirent));
node2->fake.rec_len = ext3_rec_len_to_disk(sb->s_blocksize);
- node2->fake.inode = 0;
BUFFER_TRACE(frame->bh, "get_write_access");
err = ext3_journal_get_write_access(handle, frame->bh);
if (err)
--
1.6.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ext4: Always set dx_node's fake_dirent explicitly.
2009-08-30 14:57 ` [PATCH 1/2] ext4: Always set dx_node's fake_dirent explicitly Andreas Schlick
2009-08-30 14:58 ` [PATCH 2/2] ext3: " Andreas Schlick
@ 2009-09-11 3:19 ` Theodore Tso
1 sibling, 0 replies; 4+ messages in thread
From: Theodore Tso @ 2009-09-11 3:19 UTC (permalink / raw)
To: Andreas Schlick; +Cc: Ext4 Developers List
On Sun, Aug 30, 2009 at 04:57:50PM +0200, Andreas Schlick wrote:
> When ext4_dx_add_entry() has to split an index node, it has to ensure that
> name_len of dx_node's fake_dirent is also zero, because otherwise e2fsck
> won't recognise it as an intermediate htree node and consider the htree to
> be corrupted.
>
> Signed-off-by: Andreas Schlick <schlick@lavabit.com>
Added to the ext4 patch queue, thanks.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-09-11 3:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-30 14:56 [PATCH 0/2] Fix wrong name_len and file_type in intermediate htree nodes Andreas Schlick
2009-08-30 14:57 ` [PATCH 1/2] ext4: Always set dx_node's fake_dirent explicitly Andreas Schlick
2009-08-30 14:58 ` [PATCH 2/2] ext3: " Andreas Schlick
2009-09-11 3:19 ` [PATCH 1/2] ext4: " Theodore Tso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.