VFAT mounting / sharing issue after: d_path: make 'prepend()' fill up the buffer exactly on overflow

From: Arthur Marsh
Date: Mon Sep 13 2021 - 10:22:28 EST



Hi,

On recent kernels a VFAT filesystem mounted on my i686 system started behaving weirdly:

The /etc/fstab entry was:

UUID=7417-5AFF /victoria vfat defaults,uid=65534,gid=65534,umask=000 0 2

After boot-up the filesystem had previously been mounted as:

# mount|grep vic
/dev/sdb6 on /victoria type vfat (rw,relatime,uid=65534,gid=65534,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,
iocharset=utf8,shortname=mixed,errors=remount-ro)

On more recent kernels after the boot-up I saw the mount name truncated:

# mount|grep vic
/dev/sda6 on /vict type vfat (rw,relatime,uid=65534,gid=65534,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,
iocharset=utf8,shortname=mixed,errors=remount-ro)

I could cd to /victoria and access the filesystem locally, but samba sharing of the filesystem failed.

After a long git-bisect session I found the commit that caused it:

commit b0cfcdd9b9672ea90642f33d6c0dd8516553adf2
Author: Linus Torvalds @linux-foundation.org>
Date: Fri Jul 16 14:01:12 2021 -0700

d_path: make 'prepend()' fill up the buffer exactly on overflow

Reverting the commit resolved the issue, including on kernel 5.15.0-rc1

I'm at a loss as to why the patch caused the problem with the reported mount name and samba sharing.

Build was on i686 using gcc-11 and:

make -j2 menuconfig bindeb-pkg

I'm happy to supply .config and run tests.

Arthur.