[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-ext4
Subject: Re: [Ext2-devel] Problem freeing illegal preallocated block when
From: Andrew Morton <akpm () digeo ! com>
Date: 2003-05-18 19:53:13
[Download RAW message or body]
Stuart Menefy <stuart.menefy@st.com> wrote:
>
> This problem was seen in a 2.5.66 system, but appears to still be present
> in the current sources.
>
> When trying to create a file on a newly mounted ext2 file system, which
> has no space remaining:
>
> # touch wibble
> EXT2-fs error (device ramdisk(1,0)): ext2_free_blocks: Freeing blocks not in \
> datazone - block = 2147483648, count = 16
> touch: wibble: No space left on device
>
> The problem is that ext2_discard_prealloc() is being called for a partly
> initialised inode, so picking up uninitialised values for i_prealloc_count:
Well found, and thanks for working through this. But I believe it was
fixed in later kernels, by a different means:
From: "J. Bruce Fields" <bfields@fieldses.org>
If the NFS daemon is presented with a filehandle for a file that has
been deleted, it does an iget() in fs/exportfs/expfs.c:export_iget() and
gets a bad inode back. When it subsequently iput()s the inode, the
result is:
Mar 27 12:53:40 snoopy kernel: EXT2-fs error (device ide0(3,3)): ext2_free_blocks: \
Freeing blocks not in datazone - block = 1802201963, count = 27499
Mar 27 12:53:40 snoopy kernel: Remounting filesystem read-only
The same can happen if ext2_get_inode() returns an error - ext2_read_inode()
will return an uninitialised inode and ext2_put_inode() is not allowed to go
looking inside the bad inode.
fs/ext2/inode.c | 11 ++++++++---
fs/ext3/inode.c | 9 +++++++--
2 files changed, 15 insertions(+), 5 deletions(-)
diff -puN fs/ext2/inode.c~stale-inode-fix fs/ext2/inode.c
--- 25/fs/ext2/inode.c~stale-inode-fix 2003-04-02 22:50:46.000000000 -0800
+++ 25-akpm/fs/ext2/inode.c 2003-04-02 22:50:46.000000000 -0800
@@ -52,11 +52,16 @@ static inline int ext2_inode_is_fast_sym
}
/*
- * Called at each iput()
+ * Called at each iput().
+ *
+ * The inode may be "bad" if ext2_read_inode() saw an error from
+ * ext2_get_inode(), so we need to check that to avoid freeing random disk
+ * blocks.
*/
-void ext2_put_inode (struct inode * inode)
+void ext2_put_inode(struct inode *inode)
{
- ext2_discard_prealloc (inode);
+ if (!is_bad_inode(inode))
+ ext2_discard_prealloc(inode);
}
/*
diff -puN fs/ext3/inode.c~stale-inode-fix fs/ext3/inode.c
--- 25/fs/ext3/inode.c~stale-inode-fix 2003-04-02 22:50:46.000000000 -0800
+++ 25-akpm/fs/ext3/inode.c 2003-04-02 22:50:46.000000000 -0800
@@ -178,10 +178,15 @@ static int ext3_journal_test_restart(han
/*
* Called at each iput()
+ *
+ * The inode may be "bad" if ext3_read_inode() saw an error from
+ * ext3_get_inode(), so we need to check that to avoid freeing random disk
+ * blocks.
*/
-void ext3_put_inode (struct inode * inode)
+void ext3_put_inode(struct inode *inode)
{
- ext3_discard_prealloc (inode);
+ if (!is_bad_inode(inode))
+ ext3_discard_prealloc(inode);
}
/*
_
-------------------------------------------------------
This SF.net email is sponsored by: If flattening out C++ or Java
code to make your application fit in a relational database is painful,
don't do it! Check out ObjectStore. Now part of Progress Software.
http://www.objectstore.net/sourceforge
_______________________________________________
Ext2-devel mailing list
Ext2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ext2-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic