Package: src:linux Version: 7.2.12-1 Severity: normal Dear Maintainer,
on Linux 6.12.48 (Debian 13) and 7.1.6 (Debian 14), calling mkdir() on a directory that already exists on an NFSv4.2 mount, through a read-only bind mount, returns EROFS instead of EEXIST, as long as the directory has not been looked up (e.g. listed via readdir of its parent) by this client yet. Also reproducible on Debian 14 with a custom compiled 7.3.1 kernel. This breaks Flatpak/bubblewrap, which creates mount points with mkdir() and treats EEXIST as success but EROFS as fatal. With the Flatpak tree on NFS, apps fail after each reboot with "bwrap: Can't mkdir parents for ...: Read-only file system" until the tree has been walked once. The issue only occurs on NFS mounts, local file systems work fine with Flatpak/bubblewrap. To reproduce: # vanilla Debian install (stock kernel or 7.3.1, same result) # set it up (root) apt install nfs-kernel-server mkdir -p /mnt/nfstest /etc/exports.d /srv/nfstest echo '/srv/nfstest 127.0.0.1(rw,sync,no_subtree_check,no_root_squash)' > /etc/exports.d/nfstest.exports mount -t tmpfs -o size=16m tmpfs /srv/nfstest mkdir -p /srv/nfstest/reprotest1/sub exportfs -ra mount -t nfs4 -o vers=4.2 127.0.0.1:/srv/nfstest /mnt/nfstest # test (as regular user) # 1st invocation unshare -rm sh -c 'mount --bind "$1" "$1" && mount -o remount,bind,ro "$1" && mkdir "$1/sub"' sh /mnt/nfstest/reprotest1 # → mkdir: cannot create directory ‘/mnt/nfstest/reprotest1/sub’: Read-only file system # walk the file system ls /mnt/nfstest/reprotest1 # → sub # 2nd invocation unshare -rm sh -c 'mount --bind "$1" "$1" && mount -o remount,bind,ro "$1" && mkdir "$1/sub"' sh /mnt/nfstest/reprotest1 # → mkdir: cannot create directory ‘/mnt/nfstest/reprotest1/sub’: File exists strace of the original failure (bwrap): mkdirat(7, "app", 0700) = -1 EEXIST (File exists) mkdirat(8, "share", 0700) = -1 EROFS (Read-only file system) (but "share" exists) I believe this behaviour is not intended. Reported upstream: https://lore.kernel.org/linux-nfs/[email protected]/T/#t Regards Marco

