2009-01-18 02:09:17

by Jörg Sommer

[permalink] [raw]
Subject: ext4 fails on ext2 filesystems

Hi,

I've an ext2 filesystem as root filesystem, because it's mounted readonly
for the most part. I've built in the support for ext[234] in the kernel.
Ext4 takes precedence over ext2 and it mounts the root filesystem:

[ 6.184751] EXT4-fs: delayed allocation enabled
[ 6.191487] EXT4-fs: mballoc enabled
[ 6.197710] EXT4-fs: mounted filesystem hda3 without journal
[ 6.203948] VFS: Mounted root (ext4 filesystem) readonly on device 3:3.

% mount | grep root
rootfs on / type rootfs (rw)
/dev/root on / type ext4 (ro,noatime,errors=remount-ro,barrier=1,data=writeback)

But when remounting the filesystem read/write and changing a file, the
changes are written to the filesystem, but it's remounted readonly
immediatly. I've set the mount option remount-ro.

[ 203.082300] EXT4 FS on hda3, no journal
[ 205.746713] EXT4-fs error (device hda3): ext4_free_data: circular indirect block detected, inode=165056, block=184476

% cat /proc/cpuinfo
processor : 0
cpu : 7455, altivec supported
clock : 606.000000MHz
revision : 3.3 (pvr 8001 0303)
bogomips : 36.73
timebase : 18432000
platform : PowerMac
model : PowerBook6,3
machine : PowerBook6,3
motherboard : PowerBook6,3 MacRISC3 Power Macintosh
detected as : 287 (iBook G4)
pmac flags : 0000001b
L2 cache : 256K unified
pmac-generation : NewWorld
Memory : 640 MB

% uname -a
Linux ibook 2.6.29-rc2 #1 Sat Jan 17 18:04:20 CET 2009 ppc GNU/Linux

% tune2fs -l /dev/root
tune2fs 1.41.3 (12-Oct-2008)
Filesystem volume name: Linux Root
Last mounted on: <not available>
Filesystem UUID: 2a16f78b-dde3-4224-bb23-6303c0d69c92
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: ext_attr resize_inode dir_index filetype sparse_super large_file
Filesystem flags: unsigned_directory_hash
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 327680
Block count: 1310520
Reserved block count: 65526
Free blocks: 294862
Free inodes: 152729
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 319
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
Filesystem created: Tue Aug 12 19:22:53 2008
Last mount time: Sun Jan 18 01:59:11 2009
Last write time: Sun Jan 18 01:59:27 2009
Mount count: 2
Maximum mount count: 32
Last checked: Sat Jan 17 19:33:26 2009
Check interval: 15552000 (6 months)
Next check after: Thu Jul 16 20:33:26 2009
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Required extra isize: 28
Desired extra isize: 28
Default directory hash: tea
Directory Hash Seed: ba7cdd48-9bce-4d4c-afdc-cff8b4008f11

Bye, Jörg.
--
Objektivität ist die Wahnvorstellung, Beobachtungen könnten ohne
Beobachter gemacht werden – Heinz v. Foerster


Attachments:
(No filename) (3.07 kB)
signature.asc (197.00 B)
Digital signature http://en.wikipedia.org/wiki/OpenPGP
Download all attachments

2009-01-18 02:38:48

by Theodore Ts'o

[permalink] [raw]
Subject: Re: ext4 fails on ext2 filesystems

On Sun, Jan 18, 2009 at 02:35:16AM +0100, J?rg Sommer wrote:
>
> But when remounting the filesystem read/write and changing a file, the
> changes are written to the filesystem, but it's remounted readonly
> immediatly. I've set the mount option remount-ro.
>
> [ 203.082300] EXT4 FS on hda3, no journal
> [ 205.746713] EXT4-fs error (device hda3): ext4_free_data: circular indirect block detected, inode=165056, block=184476
>

Can you do me a favor? Can you run debugfs /dev/hda3, and then run
the debugfs command: "stat <165056>"?

Any thanks!!

- Ted

2009-01-18 10:10:37

by Jörg Sommer

[permalink] [raw]
Subject: Re: ext4 fails on ext2 filesystems

Hi Theodore,

Theodore Tso schrieb am Sat 17. Jan, 21:38 (-0500):
> On Sun, Jan 18, 2009 at 02:35:16AM +0100, Jörg Sommer wrote:
> >
> > But when remounting the filesystem read/write and changing a file, the
> > changes are written to the filesystem, but it's remounted readonly
> > immediatly. I've set the mount option remount-ro.
> >
> > [ 203.082300] EXT4 FS on hda3, no journal
> > [ 205.746713] EXT4-fs error (device hda3): ext4_free_data: circular indirect block detected, inode=165056, block=184476
> >
>
> Can you do me a favor? Can you run debugfs /dev/hda3, and then run
> the debugfs command: "stat <165056>"?

I've reproduced the error, because I've ran a fsck in the meantime:

% dmesg |tail G -F EXT
[24648.457402] EXT4 FS on hda3, no journal
[25253.227881] EXT4-fs error (device hda3): ext4_free_data: circular indirect block detected, inode=165056, block=184476

# debugfs /dev/hda3 <<<$'stat <165056>\ntestb 184476\nquit'
debugfs 1.41.3 (12-Oct-2008)
debugfs: stat <165056>
Inode: 165056 Type: regular Mode: 0644 Flags: 0x0
Generation: 2419652156 Version: 0x00000000:00000001
User: 0 Group: 0 Size: 0
File ACL: 0 Directory ACL: 0
Links: 0 Blockcount: 0
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x4972fd07:7463285e -- Sun Jan 18 10:57:27 2009
atime: 0x4972fd06:acc79ebb -- Sun Jan 18 10:57:26 2009
mtime: 0x4972fd07:7463285e -- Sun Jan 18 10:57:27 2009
crtime: 0x06fd7249:acc79ebb -- Wed Sep 19 08:52:41 1973
dtime: 0x4972fd07 -- Sun Jan 18 10:57:27 2009
Size of extra inode fields: 28
BLOCKS:

debugfs: testb 184476
Block 184476 not in use
debugfs: quit

Bye, Jörg.
--
Treffen sich zwei Funktionen.
Sagt die eine: „Verschwinde oder ich differenzier' dich!“
Erwidert die andere: „Ätsch, ich bin exponentiell!“


Attachments:
(No filename) (1.75 kB)
signature.asc (197.00 B)
Digital signature http://en.wikipedia.org/wiki/OpenPGP
Download all attachments

2009-01-19 23:31:08

by Andreas Dilger

[permalink] [raw]
Subject: Re: ext4 fails on ext2 filesystems

On Jan 18, 2009 02:35 +0100, J�rg Sommer wrote:
> I've an ext2 filesystem as root filesystem, because it's mounted readonly
> for the most part. I've built in the support for ext[234] in the kernel.
> Ext4 takes precedence over ext2 and it mounts the root filesystem:

Hmm, probably an unintended consequence of the newly-added patch to
allow ext4 to mount ext2 filesystems.

> But when remounting the filesystem read/write and changing a file, the
> changes are written to the filesystem, but it's remounted readonly
> immediatly. I've set the mount option remount-ro.
>
> [ 203.082300] EXT4 FS on hda3, no journal
> [ 205.746713] EXT4-fs error (device hda3): ext4_free_data: circular indirect block detected, inode=165056, block=184476

> motherboard : PowerBook6,3 MacRISC3 Power Macintosh

Hmm, looks like it might be a bug in the endian conversion?


Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

2009-01-20 14:19:10

by Jörg Sommer

[permalink] [raw]
Subject: Re: ext4 fails on ext2 filesystems

Hello Andreas,

Andreas Dilger schrieb am Tue 20. Jan, 07:30 (+0800):
> On Jan 18, 2009 02:35 +0100, J�rg Sommer wrote:
> > I've an ext2 filesystem as root filesystem, because it's mounted readonly
> > for the most part. I've built in the support for ext[234] in the kernel.
> > Ext4 takes precedence over ext2 and it mounts the root filesystem:
>
> Hmm, probably an unintended consequence of the newly-added patch to
> allow ext4 to mount ext2 filesystems.
>
> > But when remounting the filesystem read/write and changing a file, the
> > changes are written to the filesystem, but it's remounted readonly
> > immediatly. I've set the mount option remount-ro.
> >
> > [ 203.082300] EXT4 FS on hda3, no journal
> > [ 205.746713] EXT4-fs error (device hda3): ext4_free_data: circular indirect block detected, inode=165056, block=184476
>
> > motherboard : PowerBook6,3 MacRISC3 Power Macintosh
>
> Hmm, looks like it might be a bug in the endian conversion?

Or an unsigned vs. signed char bug? Can I somehow help you hunting the
bug? How can I mount my rootfs with ext4 on 2.6.28. Maybe this bug isn't
in this version.

Bye, Jörg.
--
$ cat /dev/random
#!/usr/bin/perl -WT
print "hello world\n";


Attachments:
(No filename) (1.18 kB)
signature.asc (197.00 B)
Digital signature http://en.wikipedia.org/wiki/OpenPGP
Download all attachments

2009-01-20 14:51:03

by Theodore Ts'o

[permalink] [raw]
Subject: Re: ext4 fails on ext2 filesystems

On Sun, Jan 18, 2009 at 11:04:59AM +0100, J?rg Sommer wrote:
> > > [ 203.082300] EXT4 FS on hda3, no journal
> > > [ 205.746713] EXT4-fs error (device hda3): ext4_free_data: circular indirect block detected, inode=165056, block=184476
> > >

Hi, this patch should fix your problem.

- Ted

commit bf3baec2b4529dcf47ee422a48b8c0e83df7f0a0
Author: Theodore Ts'o <[email protected]>
Date: Tue Jan 20 09:50:19 2009 -0500

ext4: Fix ext4_free_blocks() w/o a journal when files have indirect blocks

When trying to unlink a file with indirect blocks on a filesystem
without a journal, the "circular indirect block" sanity test was
getting falsely triggered.

Signed-off-by: "Theodore Ts'o" <[email protected]>

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 49484ba..b4386da 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3622,7 +3622,7 @@ static void ext4_free_data(handle_t *handle, struct inode *inode,
* block pointed to itself, it would have been detached when
* the block was cleared. Check for this instead of OOPSing.
*/
- if (bh2jh(this_bh))
+ if ((EXT4_JOURNAL(inode) == NULL) || bh2jh(this_bh))
ext4_handle_dirty_metadata(handle, inode, this_bh);
else
ext4_error(inode->i_sb, __func__,

2009-01-21 18:46:31

by Jörg Sommer

[permalink] [raw]
Subject: Re: ext4 fails on ext2 filesystems

Hi Theodore,

Theodore Tso schrieb am Tue 20. Jan, 09:51 (-0500):
> On Sun, Jan 18, 2009 at 11:04:59AM +0100, J?rg Sommer wrote:
> > > > [ 203.082300] EXT4 FS on hda3, no journal
> > > > [ 205.746713] EXT4-fs error (device hda3): ext4_free_data: circular indirect block detected, inode=165056, block=184476
> > > >
>
> Hi, this patch should fix your problem.

Yes, this patch fixes the problem. Thanks.

> commit bf3baec2b4529dcf47ee422a48b8c0e83df7f0a0
> Author: Theodore Ts'o <[email protected]>
> Date: Tue Jan 20 09:50:19 2009 -0500
>
> ext4: Fix ext4_free_blocks() w/o a journal when files have indirect blocks
>
> When trying to unlink a file with indirect blocks on a filesystem
> without a journal, the "circular indirect block" sanity test was
> getting falsely triggered.
>
> Signed-off-by: "Theodore Ts'o" <[email protected]>

Tested-by: J?rg Sommer <[email protected]>

> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 49484ba..b4386da 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3622,7 +3622,7 @@ static void ext4_free_data(handle_t *handle, struct inode *inode,
> * block pointed to itself, it would have been detached when
> * the block was cleared. Check for this instead of OOPSing.
> */
> - if (bh2jh(this_bh))
> + if ((EXT4_JOURNAL(inode) == NULL) || bh2jh(this_bh))
> ext4_handle_dirty_metadata(handle, inode, this_bh);
> else
> ext4_error(inode->i_sb, __func__,
>

Bye, J?rg.
--
Freiheit hei?t, die Wahl zu haben, wessen Sklave man ist.


Attachments:
(No filename) (1.50 kB)
signature.asc (197.00 B)
Digital signature http://en.wikipedia.org/wiki/OpenPGP
Download all attachments

2009-01-21 22:07:20

by Theodore Ts'o

[permalink] [raw]
Subject: Re: ext4 fails on ext2 filesystems

On Wed, Jan 21, 2009 at 07:45:17PM +0100, J?rg Sommer wrote:
>
> Yes, this patch fixes the problem. Thanks.

Great, thanks for the confirmation.

- Ted