On Mon, Nov 05, 2012 at 10:20:19PM +0100, Lluís Batlle i Rossell wrote: > Hello, > > with the help of Lars on irc, we've tracked down the issue to a broken readdir() > in ext3 in n32, introduced in the kernel 3.5 by this commit: > d7dab39b6e16d5eea78ed3c705d2a2d0772b4f06 > > That renders ext3 quite useless in mips n32. > > In a kernel after that commit, the example program in the 'getdents' man page > returns this: > [root@fu2:~/readdir]# ./getdents > --------------- nread=116 --------------- > i-node# file type d_reclen d_off d_name > 3694 regular 20 1780583312 prova.c > 1037850 regular 24 -985956880 getdents.c > 1037848 directory 16 -1999547753 . > 1037849 regular 20 222381689 getdents > 778241 directory 16 -1849228342 .. > 3647 regular 20 -1 prova > > > I took Lars suggestion of applying the patch I attach (forcing ext3 to think it > is a 32-bit system), and then all works. init (upstart) doesn't deadlock anymore, readdir() works fine, and the getdents info looks right: > [root@fu2:~/readdir]# ./getdents > --------------- nread=116 --------------- > i-node# file type d_reclen d_off d_name > 3694 regular 20 334739480 prova.c > 1037850 regular 24 473707228 getdents.c > 1037848 directory 16 824759881 . > 1037849 regular 20 875064456 getdents > 778241 directory 16 1524836457 .. > 3647 regular 20 2147483647 prova > > How to solve this, I don't know. But it seems that ext3 thinks that mips-n32 > programs can eat some 64-bit words in d_off. Now I add the patch I mentioned. Regards, Lluís.
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index 92490e9..bf63d7b 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c @@ -228,6 +228,7 @@ out: static inline int is_32bit_api(void) { + return 1; #ifdef CONFIG_COMPAT return is_compat_task(); #else