ocfs2: lookup fails with ENOENT for filenames containing bytes >= 0x80 on 6.12 (works on 6.1 and 4.9); readdir and debugfs.ocfs2 show entries correctly
Hi,
I'm seeing what looks like a regression (or an incompatibility) in ocfs2 lookup on kernel 6.12 for filenames containing non-ASCII bytes. The same volume works fine on older kernels.
SUMMARY
On a shared ocfs2 volume, files whose names contain bytes >= 0x80 (Latin-1 encoded names, e.g. "a\xe3o") are listed by readdir but cannot be looked up (stat/open/ls -l return ENOENT) on a node running kernel 6.12. ASCII-only names work normally. The same files are accessed without any problem from nodes running older kernels. ENVIRONMENT
Failing node: Debian 13 (trixie), kernel 6.12.111+deb13-amd64, x86_64, VMware guest, ocfs2-tools 1.8.8-3
Working nodes: Debian 12 (kernel 6.1.0-38) and Debian 9 (kernel 4.9.0-18), same volume, same cluster
Cluster stack: o2cb, mounted with "ordered data mode"
Storage: shared LUN via multipath, device-mapper device
Volume features (tunefs.ocfs2 -Q "%M %H
"):
backup-super strict-journal-super sparse extended-slotmap inline-data xattr indexed-dirs refcount discontig-bg
The files were created over time by applications running on the older nodes (names are in ISO-8859-1, not UTF-8; the kernel should treat them as opaque bytes).
SYMPTOMS
ls in the directory prints one error per affected file:
ls: cannot access 'Jo'$'\343''o ...': No such file or directory
and, without -l, lists the names correctly.
LC_ALL=C stat $'a\xe3o.xls' -> "No such file or directory"
Names with only ASCII characters in the same directory are fine.
Locale makes no difference (same result with LANG=en_US.UTF-8, LC_ALL=C and POSIX).
No related errors in dmesg after the volume is mounted (the only errors were -107 from earlier mount attempts, before the o2cb port was opened in the firewall).
WHAT I HAVE RULED OUT
Locale/charset: the failure happens with LC_ALL=C and with raw byte names.
On-disk data: debugfs.ocfs2 run from the failing node ("ls -l <dir>") shows all entries with correct names and inodes.
Name integrity: the same files copied via tar from a 6.1 node and extracted on a local filesystem on the 6.12 node work fine.
Same volume on 6.1 and 4.9 kernels: all names resolve correctly.
Multipath/block layer: no I/O errors, and readdir returns the correct entries from the same blocks.
HYPOTHESIS
Since the volume has indexed-dirs enabled, I suspect the directory index (dx) lookup, e.g. the name hash computation or comparison for bytes >= 0x80, behaves differently on 6.12 than on older kernels, so the index lookup misses entries that the linear readdir finds. I have not looked at the code or bisected this, so this is only a guess. QUESTIONS
Is this a known issue or a known change in dx hash / lookup handling between 6.1 and 6.12?
Is there something I can run (debugfs.ocfs2 commands, tracing) to confirm whether the index lookup is what fails?
Is it safe to assume that a 6.12 node must not write to directories containing such names while other nodes run older kernels?
I can provide more output (debugfs.ocfs2 stat of the directory, dx root info, kernel config) and test patches or other kernel versions if useful.
Thanks,
Anderson Ferneda
Analista de Infraestrutura
#somosbraza #daquipromundo
[email protected]
www.braza.com.br
Confidencialidade. As mensagens e informações trocadas, enviadas e ou recebidas por meio deste e-mail são todas de caráter confidencial, incluindo seus anexos.
Seus conteúdos são restritos ao(s) destinatário(s) da(s) mensagem(ns). Caso você tenha recebido esta mensagem por engano, queira, por favor, retorná-la ao remetente e deletá-la de seus arquivos, de forma permanente. Qualquer uso não autorizado, replicação ou disseminação desta mensagem, total ou parcial, é expressamente proibido, sendo passível de responsabilização nos termos da lei.
Joseph Qi
maintainerHi,
Quoted 26 lines · Anderson Ferneda
Hi,
I'm seeing what looks like a regression (or an incompatibility) in ocfs2 lookup on kernel 6.12 for filenames containing non-ASCII bytes. The same volume works fine on older kernels.
SUMMARY
On a shared ocfs2 volume, files whose names contain bytes >=0x80(Latin-1 encoded names, e.g. "a\xe3o") are listed by readdir but cannot be looked up (stat/open/ls -l return ENOENT) on a node running kernel 6.12. ASCII-only names work normally. The same files are accessed without any problem from nodes running older kernels. ENVIRONMENT
Failing node: Debian 13 (trixie), kernel 6.12.111+deb13-amd64,x86_64, VMware guest, ocfs2-tools 1.8.8-3
Working nodes: Debian 12 (kernel 6.1.0-38) and Debian 9 (kernel 4.9.0-18), same volume, same cluster
Cluster stack: o2cb, mounted with "ordered data mode"
Storage: shared LUN via multipath, device-mapper device
Volume features (tunefs.ocfs2 -Q "%M %H
"):
backup-super strict-journal-super sparse extended-slotmap inline-data xattr indexed-dirs refcount discontig-bg
The files were created over time by applications running on the older nodes (names are in ISO-8859-1, not UTF-8; the kernel should treat them as opaque bytes).
SYMPTOMS
ls in the directory prints one error per affected file:
ls: cannot access 'Jo'$'\343''o ...': No such file or directory
and, without -l, lists the names correctly.
LC_ALL=C stat $'a\xe3o.xls' -> "No such file or directory"
Names with only ASCII characters in the same directory are fine.
Locale makes no difference (same result with LANG=en_US.UTF-8, LC_ALL=C and POSIX).
No related errors in dmesg after the volume is mounted (the only errors were -107 from earlier mount attempts, before the o2cb port was opened in the firewall).
WHAT I HAVE RULED OUT
Locale/charset: the failure happens with LC_ALL=C and with raw byte names.
On-disk data: debugfs.ocfs2 run from the failing node ("ls -l <dir>") shows all entries with correct names and inodes.
Name integrity: the same files copied via tar from a 6.1 node and extracted on a local filesystem on the 6.12 node work fine.
Same volume on 6.1 and 4.9 kernels: all names resolve correctly.
Quoted 8 lines
Multipath/block layer: no I/O errors, and readdir returns the correct entries from the same blocks.
HYPOTHESIS
Since the volume has indexed-dirs enabled, I suspect the directory index (dx) lookup, e.g. the name hash computation or comparison for bytes >=0x80, behaves differently on 6.12 than on older kernels, so the index lookup misses entries that the linear readdir finds. I have not looked at the code or bisected this, so this is only a guess. QUESTIONS
Is this a known issue or a known change in dx hash / lookup handling between 6.1 and 6.12?
Is there something I can run (debugfs.ocfs2 commands, tracing) to confirm whether the index lookup is what fails?
Is it safe to assume that a 6.12 node must not write to directories containing such names while other nodes run older kernels?
I can provide more output (debugfs.ocfs2 stat of the directory, dx root info, kernel config) and test patches or other kernel versions if useful.
It seems the root cause is not an ocfs2 change. It is commit 3bc753c06dd0 ("kbuild: treat char as always unsigned"), which added -funsigned-char to KBUILD_CFLAGS and thereby changed the on-disk dx name hash ocfs2 computes for any name containing a byte >= 0x80.
Seems we have to support 'signed char' in str2hashbuf() to retain the previous behavior. I'll send a patch later.
Thanks,
Joseph