2008-03-19 19:38:10

by Aneesh Kumar K.V

[permalink] [raw]
Subject: powerpc e2fsprogs and fast symlink

Hi Ted,

While testing on powerpc i found that e2fsck is getting confused about
fast symlink on powerpc. On x86_64 it works fine.

lrwxrwxrwx 1 root root 60 Mar 19 15:18 d -> /usr/share/icons/hicolor/48x48/apps/gnome-netstatus-txrx.png
[[email protected] ~]# /usr/local/e2fsprogs/sbin/debugfs /dev/sda7
debugfs 1.40.8 (13-Mar-2008)
debugfs: stat d
Inode: 24483 Type: symlink Mode: 0777 Flags: 0x80000
Generation: 2913520215
User: 0 Group: 0 Size: 60
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 8
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x47e166f9 -- Wed Mar 19 15:18:17 2008
atime: 0x47e166fb -- Wed Mar 19 15:18:19 2008
mtime: 0x47e166f9 -- Wed Mar 19 15:18:17 2008
Size of extra inode fields: 28
BLOCKS:

debugfs:

[email protected] ~]# /usr/local/e2fsprogs/sbin/e2fsck -f /dev/sda7
e2fsck 1.40.8 (13-Mar-2008)
Pass 1: Checking inodes, blocks, and sizes
Error while reading over extent tree in inode 24483: Corrupt extent
header
Clear inode<y>? yes

Inode 24483, i_blocks is 8, should be 0. Fix<y>? yes

Fast symlink 100055 has EXTENT_FL set. Clear<y>?

-aneesh


2008-03-20 07:47:50

by Aneesh Kumar K.V

[permalink] [raw]
Subject: Re: powerpc e2fsprogs and fast symlink

On Thu, Mar 20, 2008 at 01:08:01AM +0530, Aneesh Kumar K.V wrote:
> Hi Ted,
>
> While testing on powerpc i found that e2fsck is getting confused about
> fast symlink on powerpc. On x86_64 it works fine.
>
> lrwxrwxrwx 1 root root 60 Mar 19 15:18 d -> /usr/share/icons/hicolor/48x48/apps/gnome-netstatus-txrx.png
> [[email protected] ~]# /usr/local/e2fsprogs/sbin/debugfs /dev/sda7
> debugfs 1.40.8 (13-Mar-2008)
> debugfs: stat d
> Inode: 24483 Type: symlink Mode: 0777 Flags: 0x80000
> Generation: 2913520215
> User: 0 Group: 0 Size: 60
> File ACL: 0 Directory ACL: 0
> Links: 1 Blockcount: 8
> Fragment: Address: 0 Number: 0 Size: 0
> ctime: 0x47e166f9 -- Wed Mar 19 15:18:17 2008
> atime: 0x47e166fb -- Wed Mar 19 15:18:19 2008
> mtime: 0x47e166f9 -- Wed Mar 19 15:18:17 2008
> Size of extra inode fields: 28
> BLOCKS:
>
> debugfs:
>
> [email protected] ~]# /usr/local/e2fsprogs/sbin/e2fsck -f /dev/sda7
> e2fsck 1.40.8 (13-Mar-2008)
> Pass 1: Checking inodes, blocks, and sizes
> Error while reading over extent tree in inode 24483: Corrupt extent
> header
> Clear inode<y>? yes
>
> Inode 24483, i_blocks is 8, should be 0. Fix<y>? yes
>
> Fast symlink 100055 has EXTENT_FL set. Clear<y>?
>

The extent support on powerpc doesn't seems to work with e2fsprogs.
make check on e2fsprogs on powerpc gives

f_extents: basic extents support: failed

2008-03-20 12:51:25

by Theodore Ts'o

[permalink] [raw]
Subject: Re: powerpc e2fsprogs and fast symlink

On Thu, Mar 20, 2008 at 01:08:01AM +0530, Aneesh Kumar K.V wrote:
> Hi Ted,
>
> While testing on powerpc i found that e2fsck is getting confused about
> fast symlink on powerpc. On x86_64 it works fine.

What version of e2fsprogs are you testing? Are you using 1.40.8, or
the git 'next' (or 'master') branch? I was missing a byte-swap patch
in 1.40.8; it is in the git tree at this point.

- Ted

2008-03-20 12:56:46

by Aneesh Kumar K.V

[permalink] [raw]
Subject: Re: powerpc e2fsprogs and fast symlink

On Thu, Mar 20, 2008 at 08:50:28AM -0400, Theodore Tso wrote:
> On Thu, Mar 20, 2008 at 01:08:01AM +0530, Aneesh Kumar K.V wrote:
> > Hi Ted,
> >
> > While testing on powerpc i found that e2fsck is getting confused about
> > fast symlink on powerpc. On x86_64 it works fine.
>
> What version of e2fsprogs are you testing? Are you using 1.40.8, or
> the git 'next' (or 'master') branch? I was missing a byte-swap patch
> in 1.40.8; it is in the git tree at this point.
>

It is next a7c9cb7d0dc464eda26958595b728a6c3a4cacbc


-aneesh


2008-03-20 19:58:26

by Eric Sandeen

[permalink] [raw]
Subject: Re: powerpc e2fsprogs and fast symlink

Aneesh Kumar K.V wrote:
> Hi Ted,
>
> While testing on powerpc i found that e2fsck is getting confused about
> fast symlink on powerpc. On x86_64 it works fine.

Just as a sanity check I made an ext4 image on ppc with fast/long
symlinks, dirs, files of various sizes etc; e2fsck from next fails on ppc:

e2fsck 1.40.8 (13-Mar-2008)
Pass 1: Checking inodes, blocks, and sizes
Error while reading over extent tree in inode 12: Corrupt extent header
Clear inode? no

Segmentation fault

but transporting the image to x86_64, e2fsck is fine. So at least it
doesn't look like an on-disk problem. :)

-Eric

2008-03-21 05:19:10

by Eric Sandeen

[permalink] [raw]
Subject: Re: powerpc e2fsprogs and fast symlink

Aneesh Kumar K.V wrote:

> The extent support on powerpc doesn't seems to work with e2fsprogs.
> make check on e2fsprogs on powerpc gives
>
> f_extents: basic extents support: failed
>
I see a few things wrong:

Looks like swap_inode_full was incorrectly swapping the i_block
data for extents, as well as incorrectly checking for the
EXTENTS flag on big-endian boxes. Hmm maybe I need to think
a little more about symlinks with the extent flag set...

Also, pass1.c was having trouble when the extent flag was improperly
set or unset, because then the extent header was improperly unswapped
or swapped, so verify_header gave the wrong answer. Temporarily
re-swapping the header before checking fixes...

I'm working on a patch for these problems, trying to make it
not too ugly. :)

-Eric




2008-03-21 05:40:57

by Eric Sandeen

[permalink] [raw]
Subject: Re: powerpc e2fsprogs and fast symlink

Eric Sandeen wrote:

> Aneesh Kumar K.V wrote:
>
>
>> The extent support on powerpc doesn't seems to work with e2fsprogs.
>> make check on e2fsprogs on powerpc gives
>>
>> f_extents: basic extents support: failed
>>
>>
> I see a few things wrong:
>
> Looks like swap_inode_full was incorrectly swapping the i_block
> data for extents, as well as incorrectly checking for the
> EXTENTS flag on big-endian boxes. Hmm maybe I need to think
> a little more about symlinks with the extent flag set...
>
FWIW, here's a patch for these problems. Still working on a clean
solution for the last one.

-Eric

Index: e2fsprogs/lib/ext2fs/swapfs.c
===================================================================
--- e2fsprogs.orig/lib/ext2fs/swapfs.c
+++ e2fsprogs/lib/ext2fs/swapfs.c
@@ -147,6 +147,7 @@ void ext2fs_swap_inode_full(ext2_filsys
int bufsize)
{
unsigned i, has_data_blocks, extra_isize, attr_magic;
+ int has_extents = 0;
int islnk = 0;
__u32 *eaf, *eat;

@@ -172,12 +173,13 @@ void ext2fs_swap_inode_full(ext2_filsys
has_data_blocks = ext2fs_inode_data_blocks(fs,
(struct ext2_inode *) t);
if (hostorder && (f->i_flags & EXT4_EXTENTS_FL))
- has_data_blocks = 0;
+ has_extents = 1;
t->i_flags = ext2fs_swab32(f->i_flags);
- if (hostorder && (t->i_flags & EXT4_EXTENTS_FL))
- has_data_blocks = 0;
+ if (!hostorder && (t->i_flags & EXT4_EXTENTS_FL))
+ has_extents = 1;
t->i_dir_acl = ext2fs_swab32(f->i_dir_acl);
- if (!islnk || has_data_blocks ) {
+ /* extent data are swapped on access, not here */
+ if (!has_extents && (!islnk || has_data_blocks)) {
for (i = 0; i < EXT2_N_BLOCKS; i++)
t->i_block[i] = ext2fs_swab32(f->i_block[i]);