Skip to contentSkip to conversation

powerpc e2fsprogs and fast symlink

DISCUSSION Aneesh Kumar K.V 3 participants 7 messages Mar 19, 2008 – Mar 21, 2008

lore
Share & tools
lore
#0 lore raw

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
[root@gekko-lp2 ~]# /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:

root@gekko-lp2 ~]# /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

#1 lore raw
Quoted 30 lines · Aneesh Kumar K.V

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
[root@gekko-lp2 ~]# /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:

root@gekko-lp2 ~]# /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

Quoted 4 lines

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

#2 lore raw
Quoted 5 lines · Aneesh Kumar K.V

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

#3 lore raw
Quoted 9 lines · Eric Sandeen
Quoted 6 lines · Aneesh Kumar K.V

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

Quoted 7 lines

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

lib/ext2fs/swapfs.c +6 -4
Index: 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]);
 
#4 lore raw
In reply to Aneesh Kumar K.V
Quoted 4 lines · Aneesh Kumar K.V

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

#5 lore raw
Quoted 10 lines · Theodore Tso
Quoted 4 lines · Aneesh Kumar K.V

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

#6 lore raw
In reply to Aneesh Kumar K.V
Quoted 4 lines · Aneesh Kumar K.V

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