Linux NFS development
 help / color / mirror / Atom feed
* NFSDv3 alone can't export btrfs dirs: mount.nfs: mount(2): Stale file handle
@ 2026-12-03 16:42 Marius Dinu via Bugspray Bot
  2026-12-03 16:42 ` The Linux kernel's regression tracker (Thorsten Leemhuis) via Bugspray Bot
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Marius Dinu via Bugspray Bot @ 2026-12-03 16:42 UTC (permalink / raw)
  To: linux-nfs, anna, cel, jlayton, trondmy

Marius Dinu writes via Kernel.org Bugzilla:

Hi.

Kernel v7.2-rc4, git master branch, self-built.

When built without CONFIG_NFSD_V4, all clients fail to mount directories shared from btrfs.

To reproduce the bug:

1) Build a kernel with this config and boot it:

# zgrep -E 'CONFIG_BTRFS|CONFIG_EXPORTFS|CONFIG_NFS' /proc/config.gz
CONFIG_BTRFS_FS=y
# CONFIG_BTRFS_FS_POSIX_ACL is not set
# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set
# CONFIG_BTRFS_DEBUG is not set
# CONFIG_BTRFS_ASSERT is not set
# CONFIG_BTRFS_EXPERIMENTAL is not set
CONFIG_EXPORTFS=y
CONFIG_EXPORTFS_BLOCK_OPS=y
CONFIG_NFS_FS=y
# CONFIG_NFS_V2 is not set
CONFIG_NFS_V3=y
# CONFIG_NFS_V3_ACL is not set
# CONFIG_NFS_V4 is not set
# CONFIG_NFS_SWAP is not set
# CONFIG_NFS_FSCACHE is not set
CONFIG_NFS_DEBUG=y
# CONFIG_NFS_DISABLE_UDP_SUPPORT is not set
CONFIG_NFSD=y
# CONFIG_NFSD_V2 is not set
# CONFIG_NFSD_V3_ACL is not set
# CONFIG_NFSD_V4 is not set
CONFIG_NFS_COMMON=y
# CONFIG_NFS_LOCALIO is not set

2) Start userspace daemons: rpcbind, rpc.nfsd, rpc.mountd, rpc.statd

3) Export a btrfs directory (in this example, /build):

 # cat /etc/exports
/build -rw 172.27.143.9

 # exportfs -rav
exporting 172.27.143.9:/build

4) Try to mount it from a client (in this example, same machine):

 # mount -v -t nfs -o vers=3,softerr,timeo=10,retrans=0,fg 172.27.143.9:/build /mnt/test
mount.nfs: timeout set for Sat Jul 25 10:14:23 2026
mount.nfs: trying text-based options 'vers=3,softerr,timeo=3,retrans=0,fg,addr=172.27.143.9'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 172.27.143.9 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 172.27.143.9 prog 100005 vers 3 prot UDP port 56200
rpc.mountd: Received NULL request from 172.27.143.9
rpc.mountd: Received NULL request from 172.27.143.9
rpc.mountd: Received MNT3(/build) request from 172.27.143.9
rpc.mountd: v4root_create: path '/' flags 0x12403
rpc.mountd: v4root_create: path '/' flags 0x12403
rpc.mountd: authenticated mount request from 172.27.143.9:1012 for /build (/build)
rpc.mountd: granted access to /build for 172.27.143.9
rpc.mountd: nfsd_fh: inbuf '172.27.143.9 0 \x0000001d00010000'
rpc.mountd: denied access to 172.27.143.9
rpc.mountd: nfsd_fh: found (nil) path (null)
mount.nfs: mount(2): Stale file handle
mount.nfs: Stale file handle for 172.27.143.9:/build on /mnt/test

Note the error: "denied access to 172.27.143.9" and "nfsd_fh: found (nil) path (null)". That's AFTER the mount request was granted.

My investigation so far:
- selecting CONFIG_NFSD_V4 and nothing else makes the exact same NFSv3 mount work
- exports from ext2 work even without CONFIG_NFSD_V4, exact same config
- adding "fsid=0" to options in /etc/exports makes it work without CONFIG_NFSD_V4 even from btrfs

I suspect that NFSDv3, when v4 is not selected, uses file handles that are too short to fit files/dirs coming from btrfs. The auto-generated fsid might be too long.

Thank you.
Marius

View: https://bugzilla.kernel.org/show_bug.cgi?id=221788#c0
You can reply to this message to join the discussion.
-- 
Deet-doot-dot, I am a bot.
Kernel.org Bugzilla (bugspray 0.1-dev)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: NFSDv3 alone can't export btrfs dirs: mount.nfs: mount(2): Stale file handle
  2026-12-03 16:42 NFSDv3 alone can't export btrfs dirs: mount.nfs: mount(2): Stale file handle Marius Dinu via Bugspray Bot
@ 2026-12-03 16:42 ` The Linux kernel's regression tracker (Thorsten Leemhuis) via Bugspray Bot
  2026-12-03 16:42 ` Marius Dinu via Bugspray Bot
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: The Linux kernel's regression tracker (Thorsten Leemhuis) via Bugspray Bot @ 2026-12-03 16:42 UTC (permalink / raw)
  To: linux-nfs, anna, cel, jlayton, trondmy

The Linux kernel's regression tracker (Thorsten Leemhuis) writes via Kernel.org Bugzilla:

Did this work with earlier kernel version? If yes: would be great it might be a good idea to compile the newer with a derived config (e.g. use the .config from the older and run "make oldconfig" before building the newer).

View: https://bugzilla.kernel.org/show_bug.cgi?id=221788#c1
You can reply to this message to join the discussion.
-- 
Deet-doot-dot, I am a bot.
Kernel.org Bugzilla (bugspray 0.1-dev)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: NFSDv3 alone can't export btrfs dirs: mount.nfs: mount(2): Stale file handle
  2026-12-03 16:42 NFSDv3 alone can't export btrfs dirs: mount.nfs: mount(2): Stale file handle Marius Dinu via Bugspray Bot
  2026-12-03 16:42 ` The Linux kernel's regression tracker (Thorsten Leemhuis) via Bugspray Bot
@ 2026-12-03 16:42 ` Marius Dinu via Bugspray Bot
  2026-12-03 16:43   ` The Linux kernel's regression tracker (Thorsten Leemhuis) via Bugspray Bot
  2026-12-03 17:24 ` Jeff Layton
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Marius Dinu via Bugspray Bot @ 2026-12-03 16:42 UTC (permalink / raw)
  To: linux-nfs, anna, cel, jlayton, trondmy

Marius Dinu writes via Kernel.org Bugzilla:

No, I did a git bisect down to v6.1 and the bug was still there. I coulnd't go any lower - the system won't boot. I would have to install qemu and make a VM to test earlier kernels.

View: https://bugzilla.kernel.org/show_bug.cgi?id=221788#c2
You can reply to this message to join the discussion.
-- 
Deet-doot-dot, I am a bot.
Kernel.org Bugzilla (bugspray 0.1-dev)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: NFSDv3 alone can't export btrfs dirs: mount.nfs: mount(2): Stale file handle
  2026-12-03 16:42 ` Marius Dinu via Bugspray Bot
@ 2026-12-03 16:43   ` The Linux kernel's regression tracker (Thorsten Leemhuis) via Bugspray Bot
  0 siblings, 0 replies; 7+ messages in thread
From: The Linux kernel's regression tracker (Thorsten Leemhuis) via Bugspray Bot @ 2026-12-03 16:43 UTC (permalink / raw)
  To: linux-nfs, anna, cel, jlayton, trondmy

The Linux kernel's regression tracker (Thorsten Leemhuis) writes via Kernel.org Bugzilla:

(In reply to Marius Dinu from comment #2)
> No, I did a git bisect down to v6.1 and the bug was still there. 

Thx, in that case it likely doesn't matter much and that path not worth pursuing further (and is nothing for my todo list).

View: https://bugzilla.kernel.org/show_bug.cgi?id=221788#c3
You can reply to this message to join the discussion.
-- 
Deet-doot-dot, I am a bot.
Kernel.org Bugzilla (bugspray 0.1-dev)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: NFSDv3 alone can't export btrfs dirs: mount.nfs: mount(2): Stale file handle
  2026-12-03 16:42 NFSDv3 alone can't export btrfs dirs: mount.nfs: mount(2): Stale file handle Marius Dinu via Bugspray Bot
  2026-12-03 16:42 ` The Linux kernel's regression tracker (Thorsten Leemhuis) via Bugspray Bot
  2026-12-03 16:42 ` Marius Dinu via Bugspray Bot
@ 2026-12-03 17:24 ` Jeff Layton
  2026-12-03 17:35 ` Jeff Layton via Bugspray Bot
  2026-12-03 18:55 ` Marius Dinu via Bugspray Bot
  4 siblings, 0 replies; 7+ messages in thread
From: Jeff Layton @ 2026-12-03 17:24 UTC (permalink / raw)
  To: Marius Dinu via Bugspray Bot, linux-nfs, anna, cel, trondmy

On Thu, 2026-12-03 at 16:42 +0000, Marius Dinu via Bugspray Bot wrote:
> Marius Dinu writes via Kernel.org Bugzilla:
> 
> Hi.
> 
> Kernel v7.2-rc4, git master branch, self-built.
> 
> When built without CONFIG_NFSD_V4, all clients fail to mount directories shared from btrfs.
> 
> To reproduce the bug:
> 
> 1) Build a kernel with this config and boot it:
> 
> # zgrep -E 'CONFIG_BTRFS|CONFIG_EXPORTFS|CONFIG_NFS' /proc/config.gz
> CONFIG_BTRFS_FS=y
> # CONFIG_BTRFS_FS_POSIX_ACL is not set
> # CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set
> # CONFIG_BTRFS_DEBUG is not set
> # CONFIG_BTRFS_ASSERT is not set
> # CONFIG_BTRFS_EXPERIMENTAL is not set
> CONFIG_EXPORTFS=y
> CONFIG_EXPORTFS_BLOCK_OPS=y
> CONFIG_NFS_FS=y
> # CONFIG_NFS_V2 is not set
> CONFIG_NFS_V3=y
> # CONFIG_NFS_V3_ACL is not set
> # CONFIG_NFS_V4 is not set
> # CONFIG_NFS_SWAP is not set
> # CONFIG_NFS_FSCACHE is not set
> CONFIG_NFS_DEBUG=y
> # CONFIG_NFS_DISABLE_UDP_SUPPORT is not set
> CONFIG_NFSD=y
> # CONFIG_NFSD_V2 is not set
> # CONFIG_NFSD_V3_ACL is not set
> # CONFIG_NFSD_V4 is not set
> CONFIG_NFS_COMMON=y
> # CONFIG_NFS_LOCALIO is not set
> 
> 2) Start userspace daemons: rpcbind, rpc.nfsd, rpc.mountd, rpc.statd
> 
> 3) Export a btrfs directory (in this example, /build):
> 
>  # cat /etc/exports
> /build -rw 172.27.143.9
> 
>  # exportfs -rav
> exporting 172.27.143.9:/build
> 
> 4) Try to mount it from a client (in this example, same machine):
> 
>  # mount -v -t nfs -o vers=3,softerr,timeo=10,retrans=0,fg 172.27.143.9:/build /mnt/test
> mount.nfs: timeout set for Sat Jul 25 10:14:23 2026
> mount.nfs: trying text-based options 'vers=3,softerr,timeo=3,retrans=0,fg,addr=172.27.143.9'
> mount.nfs: prog 100003, trying vers=3, prot=6
> mount.nfs: trying 172.27.143.9 prog 100003 vers 3 prot TCP port 2049
> mount.nfs: prog 100005, trying vers=3, prot=17
> mount.nfs: trying 172.27.143.9 prog 100005 vers 3 prot UDP port 56200
> rpc.mountd: Received NULL request from 172.27.143.9
> rpc.mountd: Received NULL request from 172.27.143.9
> rpc.mountd: Received MNT3(/build) request from 172.27.143.9
> rpc.mountd: v4root_create: path '/' flags 0x12403
> rpc.mountd: v4root_create: path '/' flags 0x12403
> rpc.mountd: authenticated mount request from 172.27.143.9:1012 for /build (/build)
> rpc.mountd: granted access to /build for 172.27.143.9
> rpc.mountd: nfsd_fh: inbuf '172.27.143.9 0 \x0000001d00010000'
> rpc.mountd: denied access to 172.27.143.9
> rpc.mountd: nfsd_fh: found (nil) path (null)
> mount.nfs: mount(2): Stale file handle
> mount.nfs: Stale file handle for 172.27.143.9:/build on /mnt/test
> 
> Note the error: "denied access to 172.27.143.9" and "nfsd_fh: found (nil) path (null)". That's AFTER the mount request was granted.
> 
> My investigation so far:
> - selecting CONFIG_NFSD_V4 and nothing else makes the exact same NFSv3 mount work
> - exports from ext2 work even without CONFIG_NFSD_V4, exact same config
> - adding "fsid=0" to options in /etc/exports makes it work without CONFIG_NFSD_V4 even from btrfs
> 
> I suspect that NFSDv3, when v4 is not selected, uses file handles that are too short to fit files/dirs coming from btrfs. The auto-generated fsid might be too long.
> 

I thought that too, but it looks like it's not, actually. It looks like
the problem is that fsloc_parse() and secinfo_parse() are stubbed out
when NFSv4 isn't built and that breaks the export downcall parser. I'll
send a patch soon.

Thanks for the bug report!
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: NFSDv3 alone can't export btrfs dirs: mount.nfs: mount(2): Stale file handle
  2026-12-03 16:42 NFSDv3 alone can't export btrfs dirs: mount.nfs: mount(2): Stale file handle Marius Dinu via Bugspray Bot
                   ` (2 preceding siblings ...)
  2026-12-03 17:24 ` Jeff Layton
@ 2026-12-03 17:35 ` Jeff Layton via Bugspray Bot
  2026-12-03 18:55 ` Marius Dinu via Bugspray Bot
  4 siblings, 0 replies; 7+ messages in thread
From: Jeff Layton via Bugspray Bot @ 2026-12-03 17:35 UTC (permalink / raw)
  To: linux-nfs, trondmy, jlayton, anna, cel

Jeff Layton writes via Kernel.org Bugzilla:

A bisect wouldn't have helped. This bug goes back to 2007. See the patch here:

https://lore.kernel.org/linux-nfs/20261203-nfsd-nov4-export-parse-v1-1-f470e22a8cfb@kernel.org/

View: https://bugzilla.kernel.org/show_bug.cgi?id=221788#c4
You can reply to this message to join the discussion.
-- 
Deet-doot-dot, I am a bot.
Kernel.org Bugzilla (bugspray 0.1-dev)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: NFSDv3 alone can't export btrfs dirs: mount.nfs: mount(2): Stale file handle
  2026-12-03 16:42 NFSDv3 alone can't export btrfs dirs: mount.nfs: mount(2): Stale file handle Marius Dinu via Bugspray Bot
                   ` (3 preceding siblings ...)
  2026-12-03 17:35 ` Jeff Layton via Bugspray Bot
@ 2026-12-03 18:55 ` Marius Dinu via Bugspray Bot
  4 siblings, 0 replies; 7+ messages in thread
From: Marius Dinu via Bugspray Bot @ 2026-12-03 18:55 UTC (permalink / raw)
  To: cel, jlayton, anna, linux-nfs, trondmy

Marius Dinu writes via Kernel.org Bugzilla:

Thank you for the patch!

View: https://bugzilla.kernel.org/show_bug.cgi?id=221788#c6
You can reply to this message to join the discussion.
-- 
Deet-doot-dot, I am a bot.
Kernel.org Bugzilla (bugspray 0.1-dev)


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-12-03 18:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 16:42 NFSDv3 alone can't export btrfs dirs: mount.nfs: mount(2): Stale file handle Marius Dinu via Bugspray Bot
2026-12-03 16:42 ` The Linux kernel's regression tracker (Thorsten Leemhuis) via Bugspray Bot
2026-12-03 16:42 ` Marius Dinu via Bugspray Bot
2026-12-03 16:43   ` The Linux kernel's regression tracker (Thorsten Leemhuis) via Bugspray Bot
2026-12-03 17:24 ` Jeff Layton
2026-12-03 17:35 ` Jeff Layton via Bugspray Bot
2026-12-03 18:55 ` Marius Dinu via Bugspray Bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox