lkml.org 
[lkml]   [2000]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subjectext2fs bug : files are disapeared, unable to delete, two files' contents are switched etc.
Date

With small free memory and frequent file create/delete operations,
ext2 shows many problems.
Sometimes files are disapeared, unable to delete, two files' contents are
switched
fsck finds inconsitencies in the properly unmounted filesystem etc.
I'm not sure if this patch fixes all the problems but I cannot see the
problems any more.

tested platform is UP2000, 1 CPU(EV67 750MHz), 256M, 2.2.14
While one process is creating a file, it can be switched to do disk I/O like
following
stack trace.

schedule+0x1b0 (AR:0xfffffc0005d0bd48)
sleep_on+0x5c (AR:0xfffffc0005d0bd68)
wakeup_bdflush+0x50 (AR:0xfffffc0005d0bd98)
refile_buffer+0x10c (AR:0xfffffc0005d0bda8) -> mark_buffer_dirty()
ext2_add_entry+0x3ac (AR:0xfffffc0005d0bdc8)
ext2_create+0xe4 (AR:0xfffffc0005d0be28)
open_namei+0x1c4 (AR:0xfffffc0005d0be78)
filp_open+0x80 (AR:0xfffffc0005d0beb8)
sys_open+0x6c (AR:0xfffffc0005d0bee8)
Exception frame:
entSys+0xa8 (AR:0xfffffc0005d0bf18)

At that time ext2_add_entry() found a empty directory entry and It's going
to
be used for the new file being created. but it's not locked or marked.
While it's sleeping, another process can steal the directory entry, because
there's no sign that it's being used.
After return from sleep, first process continues the file creation
procedure.
But the directory entry is already being used for another file and
first process(in ext2_add_entry()) doesn't check it.
And all the problems starts here.
Mixed efforts with dcache, It makes many symptoms.

Supposing that ext2 is MP safe, my fix for this problem is removing
mark_buffer_dirty() in ext2_add_entry(), simple.
Every caller of ext2_add_entry() calls mark_buffer_dirty(), So it's
superflous.
Then the first process would not sleep until the directory entry is marked
with
allocated inode.

--- fs/ext2/namei.c.org Tue Mar 21 17:44:52 2000
+++ fs/ext2/namei.c Tue Mar 21 15:32:13 2000
@@ -302,7 +302,7 @@
dir->u.ext2_i.i_flags &= ~EXT2_BTREE_FL;
mark_inode_dirty(dir);
dir->i_version = ++global_event;
- mark_buffer_dirty(bh, 1);
+// mark_buffer_dirty(bh, 1);
*res_dir = de;
*err = 0;
return bh;
Soohoon.



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.079 / U:0.748 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site