xfs-masters
[Top] [All Lists]

[Bug 808] For Linux-2.6.28 kernel and XFS filesystem, glibc readdir miss

To: xfs-masters@xxxxxxxxxxx
Subject: [Bug 808] For Linux-2.6.28 kernel and XFS filesystem, glibc readdir misses final file in directory listings
From: bugzilla-daemon@xxxxxxxxxxx
Date: Sun, 28 Dec 2008 03:51:12 -0600
http://oss.sgi.com/bugzilla/show_bug.cgi?id=808





------- Additional Comments From jpsinthemix@xxxxxxxxxxx  2008-12-28 03:51 CST 
-------
(In reply to comment #8)
> (In reply to comment #7)
> > Created an attachment (id=250)
 --> (http://oss.sgi.com/bugzilla/attachment.cgi?id=250&action=view) [edit] 
[edit]
> > Patch to change d_off generation
> > 
> > Can you give the patch a try which correct the offsets we put into the d_off
> > field of the dirent.
> 
> Ok, re-build the kernel with the patch. It now doesn't end with errno=75, but
> unfortunately till doesn't find file ttt/168. If I put 167 files in ttt, it
> finds them all, if I put N>=168, it finds N-1 files, but not the last one.
> 
> Below are two straces, the first w/0 -DFILE_OFFSET_BITS=64, the second with:
> 
> First strace:
> ---------------------------------------------------------------------------
> # cat test_readdir.new.strace
> execve("./test_readdir", ["./test_readdir", "ttt"], [/* 34 vars */]) = 0
> brk(0)                                  = 0x804a000
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xb7fcc000
> access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or 
> directory)
> open("/lib/tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
> directory)
> stat64("/lib/tls/i686/sse2", 0xbfee6e98) = -1 ENOENT (No such file or 
> directory)
> open("/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or 
> directory)
> stat64("/lib/tls/i686", 0xbfee6e98)     = -1 ENOENT (No such file or 
> directory)
> open("/lib/tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or 
> directory)
> stat64("/lib/tls/sse2", 0xbfee6e98)     = -1 ENOENT (No such file or 
> directory)
> open("/lib/tls/libc.so.6", O_RDONLY)    = -1 ENOENT (No such file or 
> directory)
> stat64("/lib/tls", 0xbfee6e98)          = -1 ENOENT (No such file or 
> directory)
> open("/lib/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or 
> directory)
> stat64("/lib/i686/sse2", 0xbfee6e98)    = -1 ENOENT (No such file or 
> directory)
> open("/lib/i686/libc.so.6", O_RDONLY)   = -1 ENOENT (No such file or 
> directory)
> stat64("/lib/i686", 0xbfee6e98)         = -1 ENOENT (No such file or 
> directory)
> open("/lib/sse2/libc.so.6", O_RDONLY)   = -1 ENOENT (No such file or 
> directory)
> stat64("/lib/sse2", 0xbfee6e98)         = -1 ENOENT (No such file or 
> directory)
> open("/lib/libc.so.6", O_RDONLY)        = 3
> read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 
> g\1\0004\0\0\0\264"...,
> 512) = 512
> fstat64(3, {st_mode=S_IFREG|0755, st_size=7545900, ...}) = 0
> mmap2(NULL, 1312336, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
> 0xb7e8b000
> mprotect(0xb7fc5000, 4096, PROT_NONE)   = 0
> mmap2(0xb7fc6000, 12288, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13a) = 0xb7fc6000
> mmap2(0xb7fc9000, 9808, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7fc9000
> close(3)                                = 0
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xb7e8a000
> set_thread_area({entry_number:-1 -> 6, base_addr:0xb7e8a6c0, limit:1048575,
> seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, 
> seg_not_present:0,
> useable:1}) = 0
> mprotect(0xb7fc6000, 8192, PROT_READ)   = 0
> mprotect(0xb7fe8000, 4096, PROT_READ)   = 0
> open("ttt", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
> fstat64(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
> fcntl64(3, F_GETFD)                     = 0x1 (flags FD_CLOEXEC)
> brk(0)                                  = 0x804a000
> brk(0x806c000)                          = 0x806c000
> fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xb7e89000
> write(1, "Files in ttt:\n"..., 14)      = 14
> getdents64(3, /* 170 entries */, 4096)  = 4080
> _llseek(3, 342, [342], SEEK_SET)        = 0
> write(1, "file: . rc: Success\n"..., 20) = 20
> write(1, "file: .. rc: Success\n"..., 21) = 21
> write(1, "file: 1 rc: Success\n"..., 20) = 20
> write(1, "file: 2 rc: Success\n"..., 20) = 20
> write(1, "file: 3 rc: Success\n"..., 20) = 20
> write(1, "file: 4 rc: Success\n"..., 20) = 20
> write(1, "file: 5 rc: Success\n"..., 20) = 20
> write(1, "file: 6 rc: Success\n"..., 20) = 20
> write(1, "file: 7 rc: Success\n"..., 20) = 20
> write(1, "file: 8 rc: Success\n"..., 20) = 20
> write(1, "file: 9 rc: Success\n"..., 20) = 20
> write(1, "file: 10 rc: Success\n"..., 21) = 21
> write(1, "file: 11 rc: Success\n"..., 21) = 21
> write(1, "file: 12 rc: Success\n"..., 21) = 21
> write(1, "file: 13 rc: Success\n"..., 21) = 21
> write(1, "file: 14 rc: Success\n"..., 21) = 21
> write(1, "file: 15 rc: Success\n"..., 21) = 21
> write(1, "file: 16 rc: Success\n"..., 21) = 21
> write(1, "file: 17 rc: Success\n"..., 21) = 21
> write(1, "file: 18 rc: Success\n"..., 21) = 21
> write(1, "file: 19 rc: Success\n"..., 21) = 21
> write(1, "file: 20 rc: Success\n"..., 21) = 21
> write(1, "file: 21 rc: Success\n"..., 21) = 21
> write(1, "file: 22 rc: Success\n"..., 21) = 21
> write(1, "file: 23 rc: Success\n"..., 21) = 21
> write(1, "file: 24 rc: Success\n"..., 21) = 21
> write(1, "file: 25 rc: Success\n"..., 21) = 21
> write(1, "file: 26 rc: Success\n"..., 21) = 21
> write(1, "file: 27 rc: Success\n"..., 21) = 21
> write(1, "file: 28 rc: Success\n"..., 21) = 21
> write(1, "file: 29 rc: Success\n"..., 21) = 21
> write(1, "file: 30 rc: Success\n"..., 21) = 21
> write(1, "file: 31 rc: Success\n"..., 21) = 21
> write(1, "file: 32 rc: Success\n"..., 21) = 21
> write(1, "file: 33 rc: Success\n"..., 21) = 21
> write(1, "file: 34 rc: Success\n"..., 21) = 21
> write(1, "file: 35 rc: Success\n"..., 21) = 21
> write(1, "file: 36 rc: Success\n"..., 21) = 21
> write(1, "file: 37 rc: Success\n"..., 21) = 21
> write(1, "file: 38 rc: Success\n"..., 21) = 21
> write(1, "file: 39 rc: Success\n"..., 21) = 21
> write(1, "file: 40 rc: Success\n"..., 21) = 21
> write(1, "file: 41 rc: Success\n"..., 21) = 21
> write(1, "file: 42 rc: Success\n"..., 21) = 21
> write(1, "file: 43 rc: Success\n"..., 21) = 21
> write(1, "file: 44 rc: Success\n"..., 21) = 21
> write(1, "file: 45 rc: Success\n"..., 21) = 21
> write(1, "file: 46 rc: Success\n"..., 21) = 21
> write(1, "file: 47 rc: Success\n"..., 21) = 21
> write(1, "file: 48 rc: Success\n"..., 21) = 21
> write(1, "file: 49 rc: Success\n"..., 21) = 21
> write(1, "file: 50 rc: Success\n"..., 21) = 21
> write(1, "file: 51 rc: Success\n"..., 21) = 21
> write(1, "file: 52 rc: Success\n"..., 21) = 21
> write(1, "file: 53 rc: Success\n"..., 21) = 21
> write(1, "file: 54 rc: Success\n"..., 21) = 21
> write(1, "file: 55 rc: Success\n"..., 21) = 21
> write(1, "file: 56 rc: Success\n"..., 21) = 21
> write(1, "file: 57 rc: Success\n"..., 21) = 21
> write(1, "file: 58 rc: Success\n"..., 21) = 21
> write(1, "file: 59 rc: Success\n"..., 21) = 21
> write(1, "file: 60 rc: Success\n"..., 21) = 21
> write(1, "file: 61 rc: Success\n"..., 21) = 21
> write(1, "file: 62 rc: Success\n"..., 21) = 21
> write(1, "file: 63 rc: Success\n"..., 21) = 21
> write(1, "file: 64 rc: Success\n"..., 21) = 21
> write(1, "file: 65 rc: Success\n"..., 21) = 21
> write(1, "file: 66 rc: Success\n"..., 21) = 21
> write(1, "file: 67 rc: Success\n"..., 21) = 21
> write(1, "file: 68 rc: Success\n"..., 21) = 21
> write(1, "file: 69 rc: Success\n"..., 21) = 21
> write(1, "file: 70 rc: Success\n"..., 21) = 21
> write(1, "file: 71 rc: Success\n"..., 21) = 21
> write(1, "file: 72 rc: Success\n"..., 21) = 21
> write(1, "file: 73 rc: Success\n"..., 21) = 21
> write(1, "file: 74 rc: Success\n"..., 21) = 21
> write(1, "file: 75 rc: Success\n"..., 21) = 21
> write(1, "file: 76 rc: Success\n"..., 21) = 21
> write(1, "file: 77 rc: Success\n"..., 21) = 21
> write(1, "file: 78 rc: Success\n"..., 21) = 21
> write(1, "file: 79 rc: Success\n"..., 21) = 21
> write(1, "file: 80 rc: Success\n"..., 21) = 21
> write(1, "file: 81 rc: Success\n"..., 21) = 21
> write(1, "file: 82 rc: Success\n"..., 21) = 21
> write(1, "file: 83 rc: Success\n"..., 21) = 21
> write(1, "file: 84 rc: Success\n"..., 21) = 21
> write(1, "file: 85 rc: Success\n"..., 21) = 21
> write(1, "file: 86 rc: Success\n"..., 21) = 21
> write(1, "file: 87 rc: Success\n"..., 21) = 21
> write(1, "file: 88 rc: Success\n"..., 21) = 21
> write(1, "file: 89 rc: Success\n"..., 21) = 21
> write(1, "file: 90 rc: Success\n"..., 21) = 21
> write(1, "file: 91 rc: Success\n"..., 21) = 21
> write(1, "file: 92 rc: Success\n"..., 21) = 21
> write(1, "file: 93 rc: Success\n"..., 21) = 21
> write(1, "file: 94 rc: Success\n"..., 21) = 21
> write(1, "file: 95 rc: Success\n"..., 21) = 21
> write(1, "file: 96 rc: Success\n"..., 21) = 21
> write(1, "file: 97 rc: Success\n"..., 21) = 21
> write(1, "file: 98 rc: Success\n"..., 21) = 21
> write(1, "file: 99 rc: Success\n"..., 21) = 21
> write(1, "file: 100 rc: Success\n"..., 22) = 22
> write(1, "file: 101 rc: Success\n"..., 22) = 22
> write(1, "file: 102 rc: Success\n"..., 22) = 22
> write(1, "file: 103 rc: Success\n"..., 22) = 22
> write(1, "file: 104 rc: Success\n"..., 22) = 22
> write(1, "file: 105 rc: Success\n"..., 22) = 22
> write(1, "file: 106 rc: Success\n"..., 22) = 22
> write(1, "file: 107 rc: Success\n"..., 22) = 22
> write(1, "file: 108 rc: Success\n"..., 22) = 22
> write(1, "file: 109 rc: Success\n"..., 22) = 22
> write(1, "file: 110 rc: Success\n"..., 22) = 22
> write(1, "file: 111 rc: Success\n"..., 22) = 22
> write(1, "file: 112 rc: Success\n"..., 22) = 22
> write(1, "file: 113 rc: Success\n"..., 22) = 22
> write(1, "file: 114 rc: Success\n"..., 22) = 22
> write(1, "file: 115 rc: Success\n"..., 22) = 22
> write(1, "file: 116 rc: Success\n"..., 22) = 22
> write(1, "file: 117 rc: Success\n"..., 22) = 22
> write(1, "file: 118 rc: Success\n"..., 22) = 22
> write(1, "file: 119 rc: Success\n"..., 22) = 22
> write(1, "file: 120 rc: Success\n"..., 22) = 22
> write(1, "file: 121 rc: Success\n"..., 22) = 22
> write(1, "file: 122 rc: Success\n"..., 22) = 22
> write(1, "file: 123 rc: Success\n"..., 22) = 22
> write(1, "file: 124 rc: Success\n"..., 22) = 22
> write(1, "file: 125 rc: Success\n"..., 22) = 22
> write(1, "file: 126 rc: Success\n"..., 22) = 22
> write(1, "file: 127 rc: Success\n"..., 22) = 22
> write(1, "file: 128 rc: Success\n"..., 22) = 22
> write(1, "file: 129 rc: Success\n"..., 22) = 22
> write(1, "file: 130 rc: Success\n"..., 22) = 22
> write(1, "file: 131 rc: Success\n"..., 22) = 22
> write(1, "file: 132 rc: Success\n"..., 22) = 22
> write(1, "file: 133 rc: Success\n"..., 22) = 22
> write(1, "file: 134 rc: Success\n"..., 22) = 22
> write(1, "file: 135 rc: Success\n"..., 22) = 22
> write(1, "file: 136 rc: Success\n"..., 22) = 22
> write(1, "file: 137 rc: Success\n"..., 22) = 22
> write(1, "file: 138 rc: Success\n"..., 22) = 22
> write(1, "file: 139 rc: Success\n"..., 22) = 22
> write(1, "file: 140 rc: Success\n"..., 22) = 22
> write(1, "file: 141 rc: Success\n"..., 22) = 22
> write(1, "file: 142 rc: Success\n"..., 22) = 22
> write(1, "file: 143 rc: Success\n"..., 22) = 22
> write(1, "file: 144 rc: Success\n"..., 22) = 22
> write(1, "file: 145 rc: Success\n"..., 22) = 22
> write(1, "file: 146 rc: Success\n"..., 22) = 22
> write(1, "file: 147 rc: Success\n"..., 22) = 22
> write(1, "file: 148 rc: Success\n"..., 22) = 22
> write(1, "file: 149 rc: Success\n"..., 22) = 22
> write(1, "file: 150 rc: Success\n"..., 22) = 22
> write(1, "file: 151 rc: Success\n"..., 22) = 22
> write(1, "file: 152 rc: Success\n"..., 22) = 22
> write(1, "file: 153 rc: Success\n"..., 22) = 22
> write(1, "file: 154 rc: Success\n"..., 22) = 22
> write(1, "file: 155 rc: Success\n"..., 22) = 22
> write(1, "file: 156 rc: Success\n"..., 22) = 22
> write(1, "file: 157 rc: Success\n"..., 22) = 22
> write(1, "file: 158 rc: Success\n"..., 22) = 22
> write(1, "file: 159 rc: Success\n"..., 22) = 22
> write(1, "file: 160 rc: Success\n"..., 22) = 22
> write(1, "file: 161 rc: Success\n"..., 22) = 22
> write(1, "file: 162 rc: Success\n"..., 22) = 22
> write(1, "file: 163 rc: Success\n"..., 22) = 22
> write(1, "file: 164 rc: Success\n"..., 22) = 22
> write(1, "file: 165 rc: Success\n"..., 22) = 22
> write(1, "file: 166 rc: Success\n"..., 22) = 22
> write(1, "file: 167 rc: Success\n"..., 22) = 22
> getdents64(3, /* 0 entries */, 4096)    = 0
> write(1, "Finished with rc: Success (0)\n"..., 30) = 30
> exit_group(0)                           = ?
> ---------------------------------------------------------------------------
> Second strace:
> ---------------------------------------------------------------------------
> # cat test_readdir64.new.strace
> execve("./test_readdir64", ["./test_readdir64", "ttt"], [/* 34 vars */]) = 0
> brk(0)                                  = 0x804a000
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xb8074000
> access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or 
> directory)
> open("/lib/tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
> directory)
> stat64("/lib/tls/i686/sse2", 0xbff8ef38) = -1 ENOENT (No such file or 
> directory)
> open("/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or 
> directory)
> stat64("/lib/tls/i686", 0xbff8ef38)     = -1 ENOENT (No such file or 
> directory)
> open("/lib/tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or 
> directory)
> stat64("/lib/tls/sse2", 0xbff8ef38)     = -1 ENOENT (No such file or 
> directory)
> open("/lib/tls/libc.so.6", O_RDONLY)    = -1 ENOENT (No such file or 
> directory)
> stat64("/lib/tls", 0xbff8ef38)          = -1 ENOENT (No such file or 
> directory)
> open("/lib/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or 
> directory)
> stat64("/lib/i686/sse2", 0xbff8ef38)    = -1 ENOENT (No such file or 
> directory)
> open("/lib/i686/libc.so.6", O_RDONLY)   = -1 ENOENT (No such file or 
> directory)
> stat64("/lib/i686", 0xbff8ef38)         = -1 ENOENT (No such file or 
> directory)
> open("/lib/sse2/libc.so.6", O_RDONLY)   = -1 ENOENT (No such file or 
> directory)
> stat64("/lib/sse2", 0xbff8ef38)         = -1 ENOENT (No such file or 
> directory)
> open("/lib/libc.so.6", O_RDONLY)        = 3
> read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 
> g\1\0004\0\0\0\264"...,
> 512) = 512
> fstat64(3, {st_mode=S_IFREG|0755, st_size=7545900, ...}) = 0
> mmap2(NULL, 1312336, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
> 0xb7f33000
> mprotect(0xb806d000, 4096, PROT_NONE)   = 0
> mmap2(0xb806e000, 12288, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13a) = 0xb806e000
> mmap2(0xb8071000, 9808, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb8071000
> close(3)                                = 0
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xb7f32000
> set_thread_area({entry_number:-1 -> 6, base_addr:0xb7f326c0, limit:1048575,
> seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, 
> seg_not_present:0,
> useable:1}) = 0
> mprotect(0xb806e000, 8192, PROT_READ)   = 0
> mprotect(0xb8090000, 4096, PROT_READ)   = 0
> open("ttt", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
> fstat64(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
> fcntl64(3, F_GETFD)                     = 0x1 (flags FD_CLOEXEC)
> brk(0)                                  = 0x804a000
> brk(0x806c000)                          = 0x806c000
> fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xb7f31000
> write(1, "Files in ttt:\n"..., 14)      = 14
> getdents64(3, /* 170 entries */, 4096)  = 4080
> _llseek(3, 342, [342], SEEK_SET)        = 0
> write(1, "file: . rc: Success\n"..., 20) = 20
> write(1, "file: .. rc: Success\n"..., 21) = 21
> write(1, "file: 1 rc: Success\n"..., 20) = 20
> write(1, "file: 2 rc: Success\n"..., 20) = 20
> write(1, "file: 3 rc: Success\n"..., 20) = 20
> write(1, "file: 4 rc: Success\n"..., 20) = 20
> write(1, "file: 5 rc: Success\n"..., 20) = 20
> write(1, "file: 6 rc: Success\n"..., 20) = 20
> write(1, "file: 7 rc: Success\n"..., 20) = 20
> write(1, "file: 8 rc: Success\n"..., 20) = 20
> write(1, "file: 9 rc: Success\n"..., 20) = 20
> write(1, "file: 10 rc: Success\n"..., 21) = 21
> write(1, "file: 11 rc: Success\n"..., 21) = 21
> write(1, "file: 12 rc: Success\n"..., 21) = 21
> write(1, "file: 13 rc: Success\n"..., 21) = 21
> write(1, "file: 14 rc: Success\n"..., 21) = 21
> write(1, "file: 15 rc: Success\n"..., 21) = 21
> write(1, "file: 16 rc: Success\n"..., 21) = 21
> write(1, "file: 17 rc: Success\n"..., 21) = 21
> write(1, "file: 18 rc: Success\n"..., 21) = 21
> write(1, "file: 19 rc: Success\n"..., 21) = 21
> write(1, "file: 20 rc: Success\n"..., 21) = 21
> write(1, "file: 21 rc: Success\n"..., 21) = 21
> write(1, "file: 22 rc: Success\n"..., 21) = 21
> write(1, "file: 23 rc: Success\n"..., 21) = 21
> write(1, "file: 24 rc: Success\n"..., 21) = 21
> write(1, "file: 25 rc: Success\n"..., 21) = 21
> write(1, "file: 26 rc: Success\n"..., 21) = 21
> write(1, "file: 27 rc: Success\n"..., 21) = 21
> write(1, "file: 28 rc: Success\n"..., 21) = 21
> write(1, "file: 29 rc: Success\n"..., 21) = 21
> write(1, "file: 30 rc: Success\n"..., 21) = 21
> write(1, "file: 31 rc: Success\n"..., 21) = 21
> write(1, "file: 32 rc: Success\n"..., 21) = 21
> write(1, "file: 33 rc: Success\n"..., 21) = 21
> write(1, "file: 34 rc: Success\n"..., 21) = 21
> write(1, "file: 35 rc: Success\n"..., 21) = 21
> write(1, "file: 36 rc: Success\n"..., 21) = 21
> write(1, "file: 37 rc: Success\n"..., 21) = 21
> write(1, "file: 38 rc: Success\n"..., 21) = 21
> write(1, "file: 39 rc: Success\n"..., 21) = 21
> write(1, "file: 40 rc: Success\n"..., 21) = 21
> write(1, "file: 41 rc: Success\n"..., 21) = 21
> write(1, "file: 42 rc: Success\n"..., 21) = 21
> write(1, "file: 43 rc: Success\n"..., 21) = 21
> write(1, "file: 44 rc: Success\n"..., 21) = 21
> write(1, "file: 45 rc: Success\n"..., 21) = 21
> write(1, "file: 46 rc: Success\n"..., 21) = 21
> write(1, "file: 47 rc: Success\n"..., 21) = 21
> write(1, "file: 48 rc: Success\n"..., 21) = 21
> write(1, "file: 49 rc: Success\n"..., 21) = 21
> write(1, "file: 50 rc: Success\n"..., 21) = 21
> write(1, "file: 51 rc: Success\n"..., 21) = 21
> write(1, "file: 52 rc: Success\n"..., 21) = 21
> write(1, "file: 53 rc: Success\n"..., 21) = 21
> write(1, "file: 54 rc: Success\n"..., 21) = 21
> write(1, "file: 55 rc: Success\n"..., 21) = 21
> write(1, "file: 56 rc: Success\n"..., 21) = 21
> write(1, "file: 57 rc: Success\n"..., 21) = 21
> write(1, "file: 58 rc: Success\n"..., 21) = 21
> write(1, "file: 59 rc: Success\n"..., 21) = 21
> write(1, "file: 60 rc: Success\n"..., 21) = 21
> write(1, "file: 61 rc: Success\n"..., 21) = 21
> write(1, "file: 62 rc: Success\n"..., 21) = 21
> write(1, "file: 63 rc: Success\n"..., 21) = 21
> write(1, "file: 64 rc: Success\n"..., 21) = 21
> write(1, "file: 65 rc: Success\n"..., 21) = 21
> write(1, "file: 66 rc: Success\n"..., 21) = 21
> write(1, "file: 67 rc: Success\n"..., 21) = 21
> write(1, "file: 68 rc: Success\n"..., 21) = 21
> write(1, "file: 69 rc: Success\n"..., 21) = 21
> write(1, "file: 70 rc: Success\n"..., 21) = 21
> write(1, "file: 71 rc: Success\n"..., 21) = 21
> write(1, "file: 72 rc: Success\n"..., 21) = 21
> write(1, "file: 73 rc: Success\n"..., 21) = 21
> write(1, "file: 74 rc: Success\n"..., 21) = 21
> write(1, "file: 75 rc: Success\n"..., 21) = 21
> write(1, "file: 76 rc: Success\n"..., 21) = 21
> write(1, "file: 77 rc: Success\n"..., 21) = 21
> write(1, "file: 78 rc: Success\n"..., 21) = 21
> write(1, "file: 79 rc: Success\n"..., 21) = 21
> write(1, "file: 80 rc: Success\n"..., 21) = 21
> write(1, "file: 81 rc: Success\n"..., 21) = 21
> write(1, "file: 82 rc: Success\n"..., 21) = 21
> write(1, "file: 83 rc: Success\n"..., 21) = 21
> write(1, "file: 84 rc: Success\n"..., 21) = 21
> write(1, "file: 85 rc: Success\n"..., 21) = 21
> write(1, "file: 86 rc: Success\n"..., 21) = 21
> write(1, "file: 87 rc: Success\n"..., 21) = 21
> write(1, "file: 88 rc: Success\n"..., 21) = 21
> write(1, "file: 89 rc: Success\n"..., 21) = 21
> write(1, "file: 90 rc: Success\n"..., 21) = 21
> write(1, "file: 91 rc: Success\n"..., 21) = 21
> write(1, "file: 92 rc: Success\n"..., 21) = 21
> write(1, "file: 93 rc: Success\n"..., 21) = 21
> write(1, "file: 94 rc: Success\n"..., 21) = 21
> write(1, "file: 95 rc: Success\n"..., 21) = 21
> write(1, "file: 96 rc: Success\n"..., 21) = 21
> write(1, "file: 97 rc: Success\n"..., 21) = 21
> write(1, "file: 98 rc: Success\n"..., 21) = 21
> write(1, "file: 99 rc: Success\n"..., 21) = 21
> write(1, "file: 100 rc: Success\n"..., 22) = 22
> write(1, "file: 101 rc: Success\n"..., 22) = 22
> write(1, "file: 102 rc: Success\n"..., 22) = 22
> write(1, "file: 103 rc: Success\n"..., 22) = 22
> write(1, "file: 104 rc: Success\n"..., 22) = 22
> write(1, "file: 105 rc: Success\n"..., 22) = 22
> write(1, "file: 106 rc: Success\n"..., 22) = 22
> write(1, "file: 107 rc: Success\n"..., 22) = 22
> write(1, "file: 108 rc: Success\n"..., 22) = 22
> write(1, "file: 109 rc: Success\n"..., 22) = 22
> write(1, "file: 110 rc: Success\n"..., 22) = 22
> write(1, "file: 111 rc: Success\n"..., 22) = 22
> write(1, "file: 112 rc: Success\n"..., 22) = 22
> write(1, "file: 113 rc: Success\n"..., 22) = 22
> write(1, "file: 114 rc: Success\n"..., 22) = 22
> write(1, "file: 115 rc: Success\n"..., 22) = 22
> write(1, "file: 116 rc: Success\n"..., 22) = 22
> write(1, "file: 117 rc: Success\n"..., 22) = 22
> write(1, "file: 118 rc: Success\n"..., 22) = 22
> write(1, "file: 119 rc: Success\n"..., 22) = 22
> write(1, "file: 120 rc: Success\n"..., 22) = 22
> write(1, "file: 121 rc: Success\n"..., 22) = 22
> write(1, "file: 122 rc: Success\n"..., 22) = 22
> write(1, "file: 123 rc: Success\n"..., 22) = 22
> write(1, "file: 124 rc: Success\n"..., 22) = 22
> write(1, "file: 125 rc: Success\n"..., 22) = 22
> write(1, "file: 126 rc: Success\n"..., 22) = 22
> write(1, "file: 127 rc: Success\n"..., 22) = 22
> write(1, "file: 128 rc: Success\n"..., 22) = 22
> write(1, "file: 129 rc: Success\n"..., 22) = 22
> write(1, "file: 130 rc: Success\n"..., 22) = 22
> write(1, "file: 131 rc: Success\n"..., 22) = 22
> write(1, "file: 132 rc: Success\n"..., 22) = 22
> write(1, "file: 133 rc: Success\n"..., 22) = 22
> write(1, "file: 134 rc: Success\n"..., 22) = 22
> write(1, "file: 135 rc: Success\n"..., 22) = 22
> write(1, "file: 136 rc: Success\n"..., 22) = 22
> write(1, "file: 137 rc: Success\n"..., 22) = 22
> write(1, "file: 138 rc: Success\n"..., 22) = 22
> write(1, "file: 139 rc: Success\n"..., 22) = 22
> write(1, "file: 140 rc: Success\n"..., 22) = 22
> write(1, "file: 141 rc: Success\n"..., 22) = 22
> write(1, "file: 142 rc: Success\n"..., 22) = 22
> write(1, "file: 143 rc: Success\n"..., 22) = 22
> write(1, "file: 144 rc: Success\n"..., 22) = 22
> write(1, "file: 145 rc: Success\n"..., 22) = 22
> write(1, "file: 146 rc: Success\n"..., 22) = 22
> write(1, "file: 147 rc: Success\n"..., 22) = 22
> write(1, "file: 148 rc: Success\n"..., 22) = 22
> write(1, "file: 149 rc: Success\n"..., 22) = 22
> write(1, "file: 150 rc: Success\n"..., 22) = 22
> write(1, "file: 151 rc: Success\n"..., 22) = 22
> write(1, "file: 152 rc: Success\n"..., 22) = 22
> write(1, "file: 153 rc: Success\n"..., 22) = 22
> write(1, "file: 154 rc: Success\n"..., 22) = 22
> write(1, "file: 155 rc: Success\n"..., 22) = 22
> write(1, "file: 156 rc: Success\n"..., 22) = 22
> write(1, "file: 157 rc: Success\n"..., 22) = 22
> write(1, "file: 158 rc: Success\n"..., 22) = 22
> write(1, "file: 159 rc: Success\n"..., 22) = 22
> write(1, "file: 160 rc: Success\n"..., 22) = 22
> write(1, "file: 161 rc: Success\n"..., 22) = 22
> write(1, "file: 162 rc: Success\n"..., 22) = 22
> write(1, "file: 163 rc: Success\n"..., 22) = 22
> write(1, "file: 164 rc: Success\n"..., 22) = 22
> write(1, "file: 165 rc: Success\n"..., 22) = 22
> write(1, "file: 166 rc: Success\n"..., 22) = 22
> write(1, "file: 167 rc: Success\n"..., 22) = 22
> getdents64(3, /* 0 entries */, 4096)    = 0
> write(1, "Finished with rc: Success (0)\n"..., 30) = 30
> exit_group(0)                           = ?
> ---------------------------------------------------------------------------

I have an update, and a "tentative" solution.
I've done a few comparisons and tests which may help isolating the problem. I
compared
files in linux-2.6.27.6/fs/xfs with those in linux-2.6.28/fs/xfs. First, note
that in
linux-2.6.28 there are no new files. I compared top-level (*.c/h) files in
linux-2.6.28/fs/xfs
with those in linux-2.6.27.6/fs/xfs, and put the cmp output in fs.xfs.cmp, and
compared
file in linux-2.6.28/fs/xfs/linux-2.6 with those in
linux-2.6.27.6/fs/xfs/linux-2.6 and
put the cmp output in fs.xfs.linux-2.6.cmp.

I then then did diffs (diff -c) for all files above which differed, and put the
diff files
in fs.xfs-2.6.27.6_to_2.6.28.diff and fs.xfs.linux-2.6-2.6.27.6_to_2.6.28.diff,
repectively.

Note that file in linux-2.x.x/fs/xfs/{support,quota} were all identical. Also,
all *.h
files were identical.

As an experiment, I reverted the 2.6.28 changes to
linux-2.6.28/fs/xfs/linux-2.6/xfs_file.c
by applying the following patch, xfs_file.c-2.6.28_to_2.6.27.6_reversion.diff,
which I
generated simply by diff -c on xfs_file.c in the two trees. I then re-built the
kernel
and the error appears to be gone. So, it looks like the removal of the code in
xfs_file.c
following this:

/*
 * Unfortunately we can't just use the clean and simple readdir implementation
 * below, because nfs might call back into ->lookup from the filldir callback
 * and that will deadlock the low-level btree code.
 *
 * Hopefully we'll find a better workaround that allows to use the optimal
 * version at least for local readdirs for 2.6.25.

is the culprit.


In the linux-2.6.28 Changelog, I thing this refers to this code removal:
-------------------------------------------------------------------------------------
[PATCH] Remove XFS buffered readdir hack
    
    Now that we've moved the readdir hack to the nfsd code, we can
    remove the local version from the XFS code.
    
    Signed-off-by: David Woodhouse <David.Woodhouse@xxxxxxxxx>
    Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

commit 14f7dd632011bb89c035722edd6ea0d90ca6b078
Author: David Woodhouse <David.Woodhouse@xxxxxxxxx>
Date:   Thu Jul 31 20:29:12 2008 +0100
--------------------------------------------------------------------------------------------

So, with the reversion patch to fs/xfs/linux-2.6/xfs_file.c, the problem appears
to be fixed,
but I'm a bit uneasy about this as other problems may surface as a result.

--------------------------------------------------------------------------------------------
fs.xfs.cmp:
--------------------------------------------------------------------------------------------

for f in `ls linux-2.6.27.6/fs/xfs/*.h`; do echo $f; cmp $f ${f/27.6/28}; done
(no differences)

for f in `ls linux-2.6.27.6/fs/xfs/*.c`; do echo $f; cmp $f ${f/27.6/28}; done

linux-2.6.27.6/fs/xfs/xfs_acl.c
linux-2.6.27.6/fs/xfs/xfs_alloc_btree.c
linux-2.6.27.6/fs/xfs/xfs_alloc.c
linux-2.6.27.6/fs/xfs/xfs_attr.c
linux-2.6.27.6/fs/xfs/xfs_attr_leaf.c
linux-2.6.27.6/fs/xfs/xfs_bit.c
linux-2.6.27.6/fs/xfs/xfs_bmap_btree.c
linux-2.6.27.6/fs/xfs/xfs_bmap.c
linux-2.6.27.6/fs/xfs/xfs_btree.c
linux-2.6.27.6/fs/xfs/xfs_buf_item.c
linux-2.6.27.6/fs/xfs/xfs_da_btree.c
linux-2.6.27.6/fs/xfs/xfs_da_btree.c linux-2.6.28/fs/xfs/xfs_da_btree.c differ:
byte 45921, line 1569
linux-2.6.27.6/fs/xfs/xfs_dfrag.c
linux-2.6.27.6/fs/xfs/xfs_dir2_block.c
linux-2.6.27.6/fs/xfs/xfs_dir2.c
linux-2.6.27.6/fs/xfs/xfs_dir2.c linux-2.6.28/fs/xfs/xfs_dir2.c differ: byte
13204, line 528
linux-2.6.27.6/fs/xfs/xfs_dir2_data.c
linux-2.6.27.6/fs/xfs/xfs_dir2_leaf.c
linux-2.6.27.6/fs/xfs/xfs_dir2_node.c
linux-2.6.27.6/fs/xfs/xfs_dir2_sf.c
linux-2.6.27.6/fs/xfs/xfs_dir2_trace.c
linux-2.6.27.6/fs/xfs/xfs_dmops.c
linux-2.6.27.6/fs/xfs/xfs_error.c
linux-2.6.27.6/fs/xfs/xfs_extfree_item.c
linux-2.6.27.6/fs/xfs/xfs_filestream.c
linux-2.6.27.6/fs/xfs/xfs_fsops.c
linux-2.6.27.6/fs/xfs/xfs_ialloc_btree.c
linux-2.6.27.6/fs/xfs/xfs_ialloc.c
linux-2.6.27.6/fs/xfs/xfs_iget.c
linux-2.6.27.6/fs/xfs/xfs_inode.c
linux-2.6.27.6/fs/xfs/xfs_inode.c linux-2.6.28/fs/xfs/xfs_inode.c differ: byte
41333, line 1417
linux-2.6.27.6/fs/xfs/xfs_inode_item.c
linux-2.6.27.6/fs/xfs/xfs_iomap.c
linux-2.6.27.6/fs/xfs/xfs_itable.c
linux-2.6.27.6/fs/xfs/xfs_log.c
linux-2.6.27.6/fs/xfs/xfs_log.c linux-2.6.28/fs/xfs/xfs_log.c differ: byte
16274, line 566
linux-2.6.27.6/fs/xfs/xfs_log_recover.c
linux-2.6.27.6/fs/xfs/xfs_log_recover.c linux-2.6.28/fs/xfs/xfs_log_recover.c
differ: byte 41076, line 1422
linux-2.6.27.6/fs/xfs/xfs_mount.c
linux-2.6.27.6/fs/xfs/xfs_mount.c linux-2.6.28/fs/xfs/xfs_mount.c differ: byte
35447, line 1248
linux-2.6.27.6/fs/xfs/xfs_mru_cache.c
linux-2.6.27.6/fs/xfs/xfs_qmops.c
linux-2.6.27.6/fs/xfs/xfs_rename.c
linux-2.6.27.6/fs/xfs/xfs_rename.c linux-2.6.28/fs/xfs/xfs_rename.c differ: byte
5763, line 215
linux-2.6.27.6/fs/xfs/xfs_rtalloc.c
linux-2.6.27.6/fs/xfs/xfs_rw.c
linux-2.6.27.6/fs/xfs/xfs_trans_ail.c
linux-2.6.27.6/fs/xfs/xfs_trans_buf.c
linux-2.6.27.6/fs/xfs/xfs_trans.c
linux-2.6.27.6/fs/xfs/xfs_trans_extfree.c
linux-2.6.27.6/fs/xfs/xfs_trans_inode.c
linux-2.6.27.6/fs/xfs/xfs_trans_item.c
linux-2.6.27.6/fs/xfs/xfs_utils.c
linux-2.6.27.6/fs/xfs/xfs_vfsops.c
linux-2.6.27.6/fs/xfs/xfs_vnodeops.c
--------------------------------------------------------------------------------------------
fs.xfs.linux-2.6.cmp:
--------------------------------------------------------------------------------------------

for f in `ls linux-2.6.27.6/fs/xfs/linux-2.6/*.h`; do echo $f; cmp $f
${f/27.6/28}; done (no differences)

for f in `ls linux-2.6.27.6/fs/xfs/linux-2.6/*.c`; do echo $f; cmp $f
${f/27.6/28}; done

linux-2.6.27.6/fs/xfs/linux-2.6/kmem.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_aops.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_buf.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_export.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_export.c
linux-2.6.28/fs/xfs/linux-2.6/xfs_export.c differ: byte 4108, line 151
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_file.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_file.c
linux-2.6.28/fs/xfs/linux-2.6/xfs_file.c differ: byte 4994, line 207
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_fs_subr.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_globals.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_ioctl32.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_ioctl.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_ioctl.c
linux-2.6.28/fs/xfs/linux-2.6/xfs_ioctl.c differ: byte 7512, line 314
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_iops.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_lrw.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_stats.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_super.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_super.c
linux-2.6.28/fs/xfs/linux-2.6/xfs_super.c differ: byte 6010, line 161
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_sysctl.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_vnode.c
linux-2.6.27.6/fs/xfs/linux-2.6/xfs_xattr.c
--------------------------------------------------------------------------------------------
fs.xfs-2.6.27.6_to_2.6.28.diff:
-------------------------------------------------------------------------------------------

*** linux-2.6.27.6/fs/xfs/xfs_da_btree.c        2008-10-09 18:13:53.000000000 
-0400
--- linux-2.6.28/fs/xfs/xfs_da_btree.c  2008-12-24 18:26:37.000000000 -0500
***************
*** 1566,1576 ****
--- 1566,1579 ----
        int nmap, error, w, count, c, got, i, mapi;
        xfs_trans_t *tp;
        xfs_mount_t *mp;
+       xfs_drfsbno_t   nblks;
  
        dp = args->dp;
        mp = dp->i_mount;
        w = args->whichfork;
        tp = args->trans;
+       nblks = dp->i_d.di_nblocks;
+ 
        /*
         * For new directories adjust the file offset and block count.
         */
***************
*** 1647,1652 ****
--- 1650,1657 ----
        }
        if (mapp != &map)
                kmem_free(mapp);
+       /* account for newly allocated blocks in reserved blocks total */
+       args->total -= dp->i_d.di_nblocks - nblks;
        *new_blkno = (xfs_dablk_t)bno;
        return 0;
  }
*** linux-2.6.27.6/fs/xfs/xfs_dir2.c    2008-10-09 18:13:53.000000000 -0400
--- linux-2.6.28/fs/xfs/xfs_dir2.c      2008-12-24 18:26:37.000000000 -0500
***************
*** 525,535 ****
--- 525,537 ----
        xfs_mount_t     *mp;
        int             nmap;           /* number of bmap entries */
        xfs_trans_t     *tp;
+       xfs_drfsbno_t   nblks;
  
        xfs_dir2_trace_args_s("grow_inode", args, space);
        dp = args->dp;
        tp = args->trans;
        mp = dp->i_mount;
+       nblks = dp->i_d.di_nblocks;
        /*
         * Set lowest possible block in the space requested.
         */
***************
*** 622,628 ****
--- 624,634 ----
         */
        if (mapp != &map)
                kmem_free(mapp);
+ 
+       /* account for newly allocated blocks in reserved blocks total */
+       args->total -= dp->i_d.di_nblocks - nblks;
        *dbp = xfs_dir2_da_to_db(mp, (xfs_dablk_t)bno);
+ 
        /*
         * Update file's size if this is the data space and it grew.
         */
*** linux-2.6.27.6/fs/xfs/xfs_inode.c   2008-10-09 18:13:53.000000000 -0400
--- linux-2.6.28/fs/xfs/xfs_inode.c     2008-12-24 18:26:37.000000000 -0500
***************
*** 1414,1420 ****
        mp = ip->i_mount;
  
        /* wait for the completion of any pending DIOs */
!       if (new_size < ip->i_size)
                vn_iowait(ip);
  
        /*
--- 1414,1420 ----
        mp = ip->i_mount;
  
        /* wait for the completion of any pending DIOs */
!       if (new_size == 0 || new_size < ip->i_size)
                vn_iowait(ip);
  
        /*
*** linux-2.6.27.6/fs/xfs/xfs_log.c     2008-11-13 16:31:42.000000000 -0500
--- linux-2.6.28/fs/xfs/xfs_log.c       2008-12-24 18:26:37.000000000 -0500
***************
*** 563,568 ****
--- 563,573 ----
        }
  
        mp->m_log = xlog_alloc_log(mp, log_target, blk_offset, num_bblks);
+       if (!mp->m_log) {
+               cmn_err(CE_WARN, "XFS: Log allocation failed: No memory!");
+               error = ENOMEM;
+               goto out;
+       }
  
        /*
         * Initialize the AIL now we have a log.
***************
*** 601,606 ****
--- 606,612 ----
        return 0;
  error:
        xfs_log_unmount_dealloc(mp);
+ out:
        return error;
  }     /* xfs_log_mount */
  
***************
*** 1217,1223 ****
        int                     i;
        int                     iclogsize;
  
!       log = (xlog_t *)kmem_zalloc(sizeof(xlog_t), KM_SLEEP);
  
        log->l_mp          = mp;
        log->l_targ        = log_target;
--- 1223,1231 ----
        int                     i;
        int                     iclogsize;
  
!       log = kmem_zalloc(sizeof(xlog_t), KM_MAYFAIL);
!       if (!log)
!               return NULL;
  
        log->l_mp          = mp;
        log->l_targ        = log_target;
***************
*** 1249,1254 ****
--- 1257,1264 ----
        xlog_get_iclog_buffer_size(mp, log);
  
        bp = xfs_buf_get_empty(log->l_iclog_size, mp->m_logdev_targp);
+       if (!bp)
+               goto out_free_log;
        XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone);
        XFS_BUF_SET_BDSTRAT_FUNC(bp, xlog_bdstrat_cb);
        XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1);
***************
*** 1275,1287 ****
        iclogsize = log->l_iclog_size;
        ASSERT(log->l_iclog_size >= 4096);
        for (i=0; i < log->l_iclog_bufs; i++) {
!               *iclogp = (xlog_in_core_t *)
!                         kmem_zalloc(sizeof(xlog_in_core_t), KM_SLEEP);
                iclog = *iclogp;
                iclog->ic_prev = prev_iclog;
                prev_iclog = iclog;
  
                bp = xfs_buf_get_noaddr(log->l_iclog_size, mp->m_logdev_targp);
                if (!XFS_BUF_CPSEMA(bp))
                        ASSERT(0);
                XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone);
--- 1285,1301 ----
        iclogsize = log->l_iclog_size;
        ASSERT(log->l_iclog_size >= 4096);
        for (i=0; i < log->l_iclog_bufs; i++) {
!               *iclogp = kmem_zalloc(sizeof(xlog_in_core_t), KM_MAYFAIL);
!               if (!*iclogp)
!                       goto out_free_iclog;
! 
                iclog = *iclogp;
                iclog->ic_prev = prev_iclog;
                prev_iclog = iclog;
  
                bp = xfs_buf_get_noaddr(log->l_iclog_size, mp->m_logdev_targp);
+               if (!bp)
+                       goto out_free_iclog;
                if (!XFS_BUF_CPSEMA(bp))
                        ASSERT(0);
                XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone);
***************
*** 1323,1328 ****
--- 1337,1361 ----
        log->l_iclog->ic_prev = prev_iclog;     /* re-write 1st prev ptr */
  
        return log;
+ 
+ out_free_iclog:
+       for (iclog = log->l_iclog; iclog; iclog = prev_iclog) {
+               prev_iclog = iclog->ic_next;
+               if (iclog->ic_bp) {
+                       sv_destroy(&iclog->ic_force_wait);
+                       sv_destroy(&iclog->ic_write_wait);
+                       xfs_buf_free(iclog->ic_bp);
+                       xlog_trace_iclog_dealloc(iclog);
+               }
+               kmem_free(iclog);
+       }
+       spinlock_destroy(&log->l_icloglock);
+       spinlock_destroy(&log->l_grant_lock);
+       xlog_trace_loggrant_dealloc(log);
+       xfs_buf_free(log->l_xbuf);
+ out_free_log:
+       kmem_free(log);
+       return NULL;
  }     /* xlog_alloc_log */
  
  
*** linux-2.6.27.6/fs/xfs/xfs_log_recover.c     2008-10-09 18:13:53.000000000 
-0400
--- linux-2.6.28/fs/xfs/xfs_log_recover.c       2008-12-24 18:26:37.000000000 
-0500
***************
*** 1419,1425 ****
                return 0;
        item = trans->r_itemq;
        if (item == NULL) {
!               ASSERT(*(uint *)dp == XFS_TRANS_HEADER_MAGIC);
                if (len == sizeof(xfs_trans_header_t))
                        xlog_recover_add_item(&trans->r_itemq);
                memcpy(&trans->r_theader, dp, len); /* d, s, l */
--- 1419,1431 ----
                return 0;
        item = trans->r_itemq;
        if (item == NULL) {
!               /* we need to catch log corruptions here */
!               if (*(uint *)dp != XFS_TRANS_HEADER_MAGIC) {
!                       xlog_warn("XFS: xlog_recover_add_to_trans: "
!                                 "bad header magic number");
!                       ASSERT(0);
!                       return XFS_ERROR(EIO);
!               }
                if (len == sizeof(xfs_trans_header_t))
                        xlog_recover_add_item(&trans->r_itemq);
                memcpy(&trans->r_theader, dp, len); /* d, s, l */
*** linux-2.6.27.6/fs/xfs/xfs_mount.c   2008-10-09 18:13:53.000000000 -0400
--- linux-2.6.28/fs/xfs/xfs_mount.c     2008-12-24 18:26:37.000000000 -0500
***************
*** 1245,1250 ****
--- 1245,1253 ----
  
        XFS_QM_DQPURGEALL(mp, XFS_QMOPT_QUOTALL | XFS_QMOPT_UMOUNTING);
  
+       if (mp->m_quotainfo)
+               XFS_QM_DONE(mp);
+ 
        /*
         * Flush out the log synchronously so that we know for sure
         * that nothing is pinned.  This is important because bflush()
***************
*** 1297,1304 ****
        xfs_errortag_clearall(mp, 0);
  #endif
        xfs_free_perag(mp);
-       if (mp->m_quotainfo)
-               XFS_QM_DONE(mp);
  }
  
  STATIC void
--- 1300,1305 ----
*** linux-2.6.27.6/fs/xfs/xfs_rename.c  2008-10-09 18:13:53.000000000 -0400
--- linux-2.6.28/fs/xfs/xfs_rename.c    2008-12-24 18:26:37.000000000 -0500
***************
*** 212,218 ****
        if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
                     (target_dp->i_d.di_projid != src_ip->i_d.di_projid))) {
                error = XFS_ERROR(EXDEV);
!               xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED);
                xfs_trans_cancel(tp, cancel_flags);
                goto std_return;
        }
--- 212,218 ----
        if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
                     (target_dp->i_d.di_projid != src_ip->i_d.di_projid))) {
                error = XFS_ERROR(EXDEV);
!               xfs_rename_unlock4(inodes, XFS_ILOCK_EXCL);
                xfs_trans_cancel(tp, cancel_flags);
                goto std_return;
        }
-------------------------------------------------------------------------------------------
fs.xfs.linux-2.6-2.6.27.6_to_2.6.28.diff:
-------------------------------------------------------------------------------------------

*** linux-2.6.28/fs/xfs/linux-2.6/xfs_export.c  2008-12-24 18:26:37.000000000 
-0500
--- linux-2.6.27.6/fs/xfs/linux-2.6/xfs_export.c        2008-10-09 
18:13:53.000000000 -0400
***************
*** 148,153 ****
--- 148,154 ----
  {
        struct xfs_fid64        *fid64 = (struct xfs_fid64 *)fid;
        struct inode            *inode = NULL;
+       struct dentry           *result;
  
        if (fh_len < xfs_fileid_length(fileid_type))
                return NULL;
***************
*** 163,169 ****
                break;
        }
  
!       return d_obtain_alias(inode);
  }
  
  STATIC struct dentry *
--- 164,179 ----
                break;
        }
  
!       if (!inode)
!               return NULL;
!       if (IS_ERR(inode))
!               return ERR_CAST(inode);
!       result = d_alloc_anon(inode);
!       if (!result) {
!               iput(inode);
!               return ERR_PTR(-ENOMEM);
!       }
!       return result;
  }
  
  STATIC struct dentry *
***************
*** 172,177 ****
--- 182,188 ----
  {
        struct xfs_fid64        *fid64 = (struct xfs_fid64 *)fid;
        struct inode            *inode = NULL;
+       struct dentry           *result;
  
        switch (fileid_type) {
        case FILEID_INO32_GEN_PARENT:
***************
*** 184,190 ****
                break;
        }
  
!       return d_obtain_alias(inode);
  }
  
  STATIC struct dentry *
--- 195,210 ----
                break;
        }
  
!       if (!inode)
!               return NULL;
!       if (IS_ERR(inode))
!               return ERR_CAST(inode);
!       result = d_alloc_anon(inode);
!       if (!result) {
!               iput(inode);
!               return ERR_PTR(-ENOMEM);
!       }
!       return result;
  }
  
  STATIC struct dentry *
***************
*** 193,204 ****
  {
        int                     error;
        struct xfs_inode        *cip;
  
        error = xfs_lookup(XFS_I(child->d_inode), &xfs_name_dotdot, &cip, NULL);
        if (unlikely(error))
                return ERR_PTR(-error);
  
!       return d_obtain_alias(VFS_I(cip));
  }
  
  const struct export_operations xfs_export_operations = {
--- 213,230 ----
  {
        int                     error;
        struct xfs_inode        *cip;
+       struct dentry           *parent;
  
        error = xfs_lookup(XFS_I(child->d_inode), &xfs_name_dotdot, &cip, NULL);
        if (unlikely(error))
                return ERR_PTR(-error);
  
!       parent = d_alloc_anon(VFS_I(cip));
!       if (unlikely(!parent)) {
!               iput(VFS_I(cip));
!               return ERR_PTR(-ENOMEM);
!       }
!       return parent;
  }
  
  const struct export_operations xfs_export_operations = {
*** linux-2.6.28/fs/xfs/linux-2.6/xfs_file.c    2008-12-24 18:26:37.000000000 
-0500
--- linux-2.6.27.6/fs/xfs/linux-2.6/xfs_file.c  2008-10-09 18:13:53.000000000 
-0400
***************
*** 204,209 ****
--- 204,218 ----
        return -xfs_fsync(XFS_I(dentry->d_inode));
  }
  
+ /*
+  * Unfortunately we can't just use the clean and simple readdir implementation
+  * below, because nfs might call back into ->lookup from the filldir callback
+  * and that will deadlock the low-level btree code.
+  *
+  * Hopefully we'll find a better workaround that allows to use the optimal
+  * version at least for local readdirs for 2.6.25.
+  */
+ #if 0
  STATIC int
  xfs_file_readdir(
        struct file     *filp,
***************
*** 235,240 ****
--- 244,368 ----
                return -error;
        return 0;
  }
+ #else
+ 
+ struct hack_dirent {
+       u64             ino;
+       loff_t          offset;
+       int             namlen;
+       unsigned int    d_type;
+       char            name[];
+ };
+ 
+ struct hack_callback {
+       char            *dirent;
+       size_t          len;
+       size_t          used;
+ };
+ 
+ STATIC int
+ xfs_hack_filldir(
+       void            *__buf,
+       const char      *name,
+       int             namlen,
+       loff_t          offset,
+       u64             ino,
+       unsigned int    d_type)
+ {
+       struct hack_callback *buf = __buf;
+       struct hack_dirent *de = (struct hack_dirent *)(buf->dirent + 
buf->used);
+       unsigned int reclen;
+ 
+       reclen = ALIGN(sizeof(struct hack_dirent) + namlen, sizeof(u64));
+       if (buf->used + reclen > buf->len)
+               return -EINVAL;
+ 
+       de->namlen = namlen;
+       de->offset = offset;
+       de->ino = ino;
+       de->d_type = d_type;
+       memcpy(de->name, name, namlen);
+       buf->used += reclen;
+       return 0;
+ }
+ 
+ STATIC int
+ xfs_file_readdir(
+       struct file     *filp,
+       void            *dirent,
+       filldir_t       filldir)
+ {
+       struct inode    *inode = filp->f_path.dentry->d_inode;
+       xfs_inode_t     *ip = XFS_I(inode);
+       struct hack_callback buf;
+       struct hack_dirent *de;
+       int             error;
+       loff_t          size;
+       int             eof = 0;
+       xfs_off_t       start_offset, curr_offset, offset;
+ 
+       /*
+        * Try fairly hard to get memory
+        */
+       buf.len = PAGE_CACHE_SIZE;
+       do {
+               buf.dirent = kmalloc(buf.len, GFP_KERNEL);
+               if (buf.dirent)
+                       break;
+               buf.len >>= 1;
+       } while (buf.len >= 1024);
+ 
+       if (!buf.dirent)
+               return -ENOMEM;
+ 
+       curr_offset = filp->f_pos;
+       if (curr_offset == 0x7fffffff)
+               offset = 0xffffffff;
+       else
+               offset = filp->f_pos;
+ 
+       while (!eof) {
+               unsigned int reclen;
+ 
+               start_offset = offset;
+ 
+               buf.used = 0;
+               error = -xfs_readdir(ip, &buf, buf.len, &offset,
+                                    xfs_hack_filldir);
+               if (error || offset == start_offset) {
+                       size = 0;
+                       break;
+               }
+ 
+               size = buf.used;
+               de = (struct hack_dirent *)buf.dirent;
+               while (size > 0) {
+                       curr_offset = de->offset /* & 0x7fffffff */;
+                       if (filldir(dirent, de->name, de->namlen,
+                                       curr_offset & 0x7fffffff,
+                                       de->ino, de->d_type)) {
+                               goto done;
+                       }
+ 
+                       reclen = ALIGN(sizeof(struct hack_dirent) + de->namlen,
+                                      sizeof(u64));
+                       size -= reclen;
+                       de = (struct hack_dirent *)((char *)de + reclen);
+               }
+       }
+ 
+  done:
+       if (!error) {
+               if (size == 0)
+                       filp->f_pos = offset & 0x7fffffff;
+               else if (de)
+                       filp->f_pos = curr_offset;
+       }
+ 
+       kfree(buf.dirent);
+       return error;
+ }
+ #endif
  
  STATIC int
  xfs_file_mmap(
*** linux-2.6.28/fs/xfs/linux-2.6/xfs_ioctl.c   2008-12-24 18:26:37.000000000 
-0500
--- linux-2.6.27.6/fs/xfs/linux-2.6/xfs_ioctl.c 2008-10-09 18:13:53.000000000 
-0400
***************
*** 311,320 ****
                return new_fd;
        }
  
!       dentry = d_obtain_alias(inode);
!       if (IS_ERR(dentry)) {
                put_unused_fd(new_fd);
!               return PTR_ERR(dentry);
        }
  
        /* Ensure umount returns EBUSY on umounts while this file is open. */
--- 311,321 ----
                return new_fd;
        }
  
!       dentry = d_alloc_anon(inode);
!       if (dentry == NULL) {
!               iput(inode);
                put_unused_fd(new_fd);
!               return -XFS_ERROR(ENOMEM);
        }
  
        /* Ensure umount returns EBUSY on umounts while this file is open. */
*** linux-2.6.28/fs/xfs/linux-2.6/xfs_super.c   2008-12-24 18:26:37.000000000 
-0500
--- linux-2.6.27.6/fs/xfs/linux-2.6/xfs_super.c 2008-11-13 16:31:42.000000000 
-0500
***************
*** 158,164 ****
        Opt_barrier, Opt_nobarrier, Opt_err
  };
  
! static const match_table_t tokens = {
        {Opt_barrier, "barrier"},
        {Opt_nobarrier, "nobarrier"},
        {Opt_err, NULL}
--- 158,164 ----
        Opt_barrier, Opt_nobarrier, Opt_err
  };
  
! static match_table_t tokens = {
        {Opt_barrier, "barrier"},
        {Opt_nobarrier, "nobarrier"},
        {Opt_err, NULL}
***************
*** 589,595 ****
  {
        int                     error = 0;
  
!       *bdevp = open_bdev_exclusive(name, FMODE_READ|FMODE_WRITE, mp);
        if (IS_ERR(*bdevp)) {
                error = PTR_ERR(*bdevp);
                printk("XFS: Invalid device [%s], error=%d\n", name, error);
--- 589,595 ----
  {
        int                     error = 0;
  
!       *bdevp = open_bdev_excl(name, 0, mp);
        if (IS_ERR(*bdevp)) {
                error = PTR_ERR(*bdevp);
                printk("XFS: Invalid device [%s], error=%d\n", name, error);
***************
*** 603,609 ****
        struct block_device     *bdev)
  {
        if (bdev)
!               close_bdev_exclusive(bdev, FMODE_READ|FMODE_WRITE);
  }
  
  /*
--- 603,609 ----
        struct block_device     *bdev)
  {
        if (bdev)
!               close_bdev_excl(bdev);
  }
  
  /*
-------------------------------------------------------------------------------------------
xfs_file.c-2.6.28_to_2.6.27.6_reversion.diff:
-------------------------------------------------------------------------------------------

*** linux-2.6.28/fs/xfs/linux-2.6/xfs_file.c    2008-12-28 02:49:05.433093194 
-0500
--- linux-2.6.27.6/fs/xfs/linux-2.6/xfs_file.c  2008-10-09 18:13:53.000000000 
-0400
***************
*** 204,209 ****
--- 204,218 ----
        return -xfs_fsync(XFS_I(dentry->d_inode));
  }
  
+ /*
+  * Unfortunately we can't just use the clean and simple readdir implementation
+  * below, because nfs might call back into ->lookup from the filldir callback
+  * and that will deadlock the low-level btree code.
+  *
+  * Hopefully we'll find a better workaround that allows to use the optimal
+  * version at least for local readdirs for 2.6.25.
+  */
+ #if 0
  STATIC int
  xfs_file_readdir(
        struct file     *filp,
***************
*** 235,240 ****
--- 244,368 ----
                return -error;
        return 0;
  }
+ #else
+ 
+ struct hack_dirent {
+       u64             ino;
+       loff_t          offset;
+       int             namlen;
+       unsigned int    d_type;
+       char            name[];
+ };
+ 
+ struct hack_callback {
+       char            *dirent;
+       size_t          len;
+       size_t          used;
+ };
+ 
+ STATIC int
+ xfs_hack_filldir(
+       void            *__buf,
+       const char      *name,
+       int             namlen,
+       loff_t          offset,
+       u64             ino,
+       unsigned int    d_type)
+ {
+       struct hack_callback *buf = __buf;
+       struct hack_dirent *de = (struct hack_dirent *)(buf->dirent + 
buf->used);
+       unsigned int reclen;
+ 
+       reclen = ALIGN(sizeof(struct hack_dirent) + namlen, sizeof(u64));
+       if (buf->used + reclen > buf->len)
+               return -EINVAL;
+ 
+       de->namlen = namlen;
+       de->offset = offset;
+       de->ino = ino;
+       de->d_type = d_type;
+       memcpy(de->name, name, namlen);
+       buf->used += reclen;
+       return 0;
+ }
+ 
+ STATIC int
+ xfs_file_readdir(
+       struct file     *filp,
+       void            *dirent,
+       filldir_t       filldir)
+ {
+       struct inode    *inode = filp->f_path.dentry->d_inode;
+       xfs_inode_t     *ip = XFS_I(inode);
+       struct hack_callback buf;
+       struct hack_dirent *de;
+       int             error;
+       loff_t          size;
+       int             eof = 0;
+       xfs_off_t       start_offset, curr_offset, offset;
+ 
+       /*
+        * Try fairly hard to get memory
+        */
+       buf.len = PAGE_CACHE_SIZE;
+       do {
+               buf.dirent = kmalloc(buf.len, GFP_KERNEL);
+               if (buf.dirent)
+                       break;
+               buf.len >>= 1;
+       } while (buf.len >= 1024);
+ 
+       if (!buf.dirent)
+               return -ENOMEM;
+ 
+       curr_offset = filp->f_pos;
+       if (curr_offset == 0x7fffffff)
+               offset = 0xffffffff;
+       else
+               offset = filp->f_pos;
+ 
+       while (!eof) {
+               unsigned int reclen;
+ 
+               start_offset = offset;
+ 
+               buf.used = 0;
+               error = -xfs_readdir(ip, &buf, buf.len, &offset,
+                                    xfs_hack_filldir);
+               if (error || offset == start_offset) {
+                       size = 0;
+                       break;
+               }
+ 
+               size = buf.used;
+               de = (struct hack_dirent *)buf.dirent;
+               while (size > 0) {
+                       curr_offset = de->offset /* & 0x7fffffff */;
+                       if (filldir(dirent, de->name, de->namlen,
+                                       curr_offset & 0x7fffffff,
+                                       de->ino, de->d_type)) {
+                               goto done;
+                       }
+ 
+                       reclen = ALIGN(sizeof(struct hack_dirent) + de->namlen,
+                                      sizeof(u64));
+                       size -= reclen;
+                       de = (struct hack_dirent *)((char *)de + reclen);
+               }
+       }
+ 
+  done:
+       if (!error) {
+               if (size == 0)
+                       filp->f_pos = offset & 0x7fffffff;
+               else if (de)
+                       filp->f_pos = curr_offset;
+       }
+ 
+       kfree(buf.dirent);
+       return error;
+ }
+ #endif
  
  STATIC int
  xfs_file_mmap(
-----------------------------------------------------------------------


-- 
Configure bugmail: http://oss.sgi.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

<Prev in Thread] Current Thread [Next in Thread>