[GIT PULL 21/22] xfs: fix ascii-ci problems, then kill it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dave,

Please pull this branch with changes for xfs.

As usual, I did a test-merge with the main upstream branch as of a few
minutes ago, and didn't see any conflicts.  Please let me know if you
encounter any problems.

--D

The following changes since commit 4f5e304248ab4939e9aef58244041c194f01f0b5:

xfs: cross-reference rmap records with refcount btrees (2023-04-11 19:00:39 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/fix-asciici-bugs-6.4_2023-04-11

for you to fetch changes up to 7ba83850ca2691865713b307ed001bde5fddb084:

xfs: deprecate the ascii-ci feature (2023-04-11 19:05:19 -0700)

----------------------------------------------------------------
xfs: fix ascii-ci problems, then kill it [v2]

Last week, I was fiddling around with the metadump name obfuscation code
while writing a debugger command to generate directories full of names
that all have the same hash name.  I had a few questions about how well
all that worked with ascii-ci mode, and discovered a nasty discrepancy
between the kernel and glibc's implementations of the tolower()
function.

I discovered that I could create a directory that is large enough to
require separate leaf index blocks.  The hashes stored in the dabtree
use the ascii-ci specific hash function, which uses a library function
to convert the name to lowercase before hashing.  If the kernel and C
library's versions of tolower do not behave exactly identically,
xfs_ascii_ci_hashname will not produce the same results for the same
inputs.  xfs_repair will deem the leaf information corrupt and rebuild
the directory.  After that, lookups in the kernel will fail because the
hash index doesn't work.

The kernel's tolower function will convert extended ascii uppercase
letters (e.g. A-with-umlaut) to extended ascii lowercase letters (e.g.
a-with-umlaut), whereas glibc's will only do that if you force LANG to
ascii.  Tiny embedded libc implementations just plain won't do it at
all, and the result is a mess.  Stabilize the behavior of the hash
function by encoding the name transformation function in libxfs, add it
to the selftest, and fix all the userspace tools, none of which handle
this transformation correctly.

The v1 series generated a /lot/ of discussion, in which several things
became very clear: (1) Linus is not enamored of case folding of any
kind; (2) Dave and Christoph don't seem to agree on whether the feature
is supposed to work for 7-bit ascii or latin1; (3) it trashes UTF8
encoded names if those happen to show up; and (4) I don't want to
maintain this mess any longer than I have to.  Kill it in 2030.

v2: rename the functions to make it clear we're moving away from the
letters t, o, l, o, w, e, and r; and deprecate the whole feature once
we've fixed the bugs and added tests.

Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>

----------------------------------------------------------------
Darrick J. Wong (3):
xfs: stabilize the dirent name transformation function used for ascii-ci dir hash computation
xfs: test the ascii case-insensitive hash
xfs: deprecate the ascii-ci feature

Documentation/admin-guide/xfs.rst |   1 +
fs/xfs/Kconfig                    |  27 +++++
fs/xfs/libxfs/xfs_dir2.c          |   5 +-
fs/xfs/libxfs/xfs_dir2.h          |  31 ++++++
fs/xfs/xfs_dahash_test.c          | 211 ++++++++++++++++++++------------------
fs/xfs/xfs_super.c                |  13 +++
6 files changed, 186 insertions(+), 102 deletions(-)




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux