🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #3347

Bug#1153147: NFS client: mkdir on existing, uncached dir returns EROFS instead of EEXIST under ro bind mount

#3347
From: Marco
Date: Fri, 06 Nov 2026 09:20
64 lines
4054 bytes
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/45cc029f-6e56-4c10-ae9e-33fba627a7d3@app.fastmail.com/T/#t

Regards
Marco
Technical Details
Message-ID: <NWoh3-aa3h-1@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Marco <lists@homerow.info>
Newsgroups: linux.debian.bugs.dist,linux.debian.kernel
Subject: Bug#1153147: NFS client: mkdir on existing, uncached dir returns EROFS instead of EEXIST under ro bind mount
Date: Fri, 06 Nov 2026 10:20:01 +0100
Message-ID: <NWoh3-aa3h-1@gated-at.bofh.it>
X-Original-To: Debian Bug Tracking System <submit@bugs.debian.org>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Fri Nov  6 09:13:08 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.449
Reply-To: Marco <lists@homerow.info>, 1153147@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: debian-kernel@lists.debian.org
X-Debian-Pr-Message: report 1153147
X-Debian-Pr-Package: src:linux
X-Debian-Pr-Source: linux
X-Yandex-Fwd: 1
Authentication-Results: mail-nwsmtp-smtp-production-main-89; dkim=pass header.i=@homerow.info
X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Greylist: delayed 320 seconds by postgrey-1.37 at buxtehude; Fri, 06 Nov 2026 09:11:00 UTC
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2000922
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 64
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Fri, 6 Nov 2026 10:05:16 +0100
X-Original-Message-ID: <20261106100516.55f3ec74@homerow>