0

Starting around kernel 4.14.10, I noticed a strange issue happening with my NFS mounts where all entries in a directory are being shown as directories if they are mounted with version 4. Here are my settings:

On server:

nfs-utils: net-fs/nfs-utils-2.3.1-r1::gentoo USE="caps ipv6 libmount nfsdcld nfsidmap nfsv4 nfsv41 tcpd uuid -kerberos -ldap (-selinux)"

Kernel .config (NFS entries)

CONFIG_NFS_FS=m
CONFIG_NFS_V2=m
CONFIG_NFS_V3=m
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=m
# CONFIG_NFS_SWAP is not set
CONFIG_NFS_V4_1=y
CONFIG_NFS_V4_2=y
CONFIG_PNFS_FILE_LAYOUT=m
CONFIG_PNFS_FLEXFILE_LAYOUT=m
CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org"
# CONFIG_NFS_V4_1_MIGRATION is not set
CONFIG_NFS_FSCACHE=y
# CONFIG_NFS_USE_LEGACY_DNS is not set
CONFIG_NFS_USE_KERNEL_DNS=y
CONFIG_NFS_DEBUG=y
CONFIG_NFSD=m
CONFIG_NFSD_V2_ACL=y
CONFIG_NFSD_V3=y
CONFIG_NFSD_V3_ACL=y
CONFIG_NFSD_V4=y
# CONFIG_NFSD_BLOCKLAYOUT is not set
# CONFIG_NFSD_SCSILAYOUT is not set
# CONFIG_NFSD_FLEXFILELAYOUT is not set
CONFIG_NFS_ACL_SUPPORT=m
CONFIG_NFS_COMMON=y

/etc/exports

/var/nfs/router/portage infrastructure(rw,no_root_squash,no_all_squash,no_subtree_check)
/var/nfs/router/kernel infrastructure(rw,no_root_squash,no_all_squash,no_subtree_check)
/var/nfs/router/temp infrastructure(rw,no_root_squash,no_all_squash,no_subtree_check)

Partition information from tune2fs -l

# tune2fs -l /dev/sdb3
tune2fs 1.43.8 (1-Jan-2018)
Filesystem volume name:   root
Last mounted on:          /
Filesystem UUID:          bed7944c-5306-4e7e-9bfd-e6ceba8f4705
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
[...]

On client:

nfs-utils: net-fs/nfs-utils-2.3.1-r1::gentoo USE="caps ipv6 libmount nfsdcld nfsidmap nfsv4 nfsv41 tcpd uuid -kerberos -ldap (-selinux)

Kernel .config (NFS entries)

CONFIG_NFS_FS=m
CONFIG_NFS_V2=m
CONFIG_NFS_V3=m
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=m
# CONFIG_NFS_SWAP is not set
CONFIG_NFS_V4_1=y
CONFIG_NFS_V4_2=y
CONFIG_PNFS_FILE_LAYOUT=m
CONFIG_PNFS_FLEXFILE_LAYOUT=m
CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org"
# CONFIG_NFS_V4_1_MIGRATION is not set
CONFIG_NFS_FSCACHE=y
# CONFIG_NFS_USE_LEGACY_DNS is not set
CONFIG_NFS_USE_KERNEL_DNS=y
# CONFIG_NFSD is not set
CONFIG_NFS_ACL_SUPPORT=m
CONFIG_NFS_COMMON=y

/etc/fstab (only NFS entries shown)

server-fs:/var/nfs/router/portage  /usr/portage    nfs     noauto,relatime 0 0
server-fs:/var/nfs/router/kernel /usr/src  nfs     noauto,relatime 0 0
server-fs:/var/nfs/router/temp /var/tmp/portage nfs noauto,relatime 0 0

rpcinfo -p server-fs

# rpcinfo -p server-calgary
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp  38129  status
    100024    1   tcp  52543  status
    100005    1   udp  34269  mountd
    100005    1   tcp  33113  mountd
    100005    2   udp  60574  mountd
    100005    2   tcp  37491  mountd
    100005    3   udp  44763  mountd
    100005    3   tcp  37033  mountd
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    3   tcp   2049  nfs_acl
    100021    1   udp  35592  nlockmgr
    100021    3   udp  35592  nlockmgr
    100021    4   udp  35592  nlockmgr
    100021    1   tcp  45355  nlockmgr
    100021    3   tcp  45355  nlockmgr
    100021    4   tcp  45355  nlockmgr

When I mount any of these with NFSv4, the following happens:

# mount -t nfs -o nfsvers=4 /usr/src
# mount
[...]
server-fs:/var/nfs/router/kernel on /usr/src type nfs4 (rw,relatime,vers=4.2,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp6,timeo=600,retrans=2,sec=sys,clientaddr=[client_ipv6_address],local_lock=none,addr=[server_ipv6_address])
# ls -la /usr/src/linux-4.14.12-gentoo/
total 228
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .
drwxr-xr-x 14 root root 4096 Jan  7 09:50 ..
drwxr-xr-x 14 root root 4096 Jan  7 09:50 arch
drwxr-xr-x 14 root root 4096 Jan  7 09:50 block
drwxr-xr-x 14 root root 4096 Jan  7 09:50 built-in.o
drwxr-xr-x 14 root root 4096 Jan  7 09:50 certs
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .cocciconfig
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .config
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .config.old
drwxr-xr-x 14 root root 4096 Jan  7 09:50 COPYING
drwxr-xr-x 14 root root 4096 Jan  7 09:50 CREDITS
drwxr-xr-x 14 root root 4096 Jan  7 09:50 crypto
drwxr-xr-x 14 root root 4096 Jan  7 09:50 distro
drwxr-xr-x 14 root root 4096 Jan  7 09:50 Documentation
drwxr-xr-x 14 root root 4096 Jan  7 09:50 drivers
drwxr-xr-x 14 root root 4096 Jan  7 09:50 firmware
drwxr-xr-x 14 root root 4096 Jan  7 09:50 fs
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .get_maintainer.ignore
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .gitattributes
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .gitignore
drwxr-xr-x 14 root root 4096 Jan  7 09:50 include
drwxr-xr-x 14 root root 4096 Jan  7 09:50 init
drwxr-xr-x 14 root root 4096 Jan  7 09:50 ipc
drwxr-xr-x 14 root root 4096 Jan  7 09:50 Kbuild
drwxr-xr-x 14 root root 4096 Jan  7 09:50 Kconfig
drwxr-xr-x 14 root root 4096 Jan  7 09:50 kernel
drwxr-xr-x 14 root root 4096 Jan  7 09:50 lib
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .mailmap
drwxr-xr-x 14 root root 4096 Jan  7 09:50 MAINTAINERS
drwxr-xr-x 14 root root 4096 Jan  7 09:50 Makefile
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .missing-syscalls.d
drwxr-xr-x 14 root root 4096 Jan  7 09:50 mm
drwxr-xr-x 14 root root 4096 Jan  7 09:50 modules.builtin
drwxr-xr-x 14 root root 4096 Jan  7 09:50 modules.order
drwxr-xr-x 14 root root 4096 Jan  7 09:50 Module.symvers
drwxr-xr-x 14 root root 4096 Jan  7 09:50 net
drwxr-xr-x 14 root root 4096 Jan  7 09:50 README
drwxr-xr-x 14 root root 4096 Jan  7 09:50 samples
drwxr-xr-x 14 root root 4096 Jan  7 09:50 scripts
drwxr-xr-x 14 root root 4096 Jan  7 09:50 security
drwxr-xr-x 14 root root 4096 Jan  7 09:50 sound
drwxr-xr-x 14 root root 4096 Jan  7 09:50 System.map
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .tmp_kallsyms1.o
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .tmp_kallsyms1.S
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .tmp_kallsyms2.o
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .tmp_kallsyms2.S
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .tmp_System.map
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .tmp_versions
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .tmp_vmlinux1
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .tmp_vmlinux2
drwxr-xr-x 14 root root 4096 Jan  7 09:50 tools
drwxr-xr-x 14 root root 4096 Jan  7 09:50 usr
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .version
drwxr-xr-x 14 root root 4096 Jan  7 09:50 virt
drwxr-xr-x 14 root root 4096 Jan  7 09:50 vmlinux
drwxr-xr-x 14 root root 4096 Jan  7 09:50 .vmlinux.cmd
drwxr-xr-x 14 root root 4096 Jan  7 09:50 vmlinux.o
# cat /usr/src/linux-4.14.12-gentoo/.config
cat: /usr/src/linux-4.14.12-gentoo/.config: Is a directory
# cd /usr/src/linux-4.14.12-gentoo/.config
-bash: cd: /usr/src/linux-4.14.12-gentoo/.config: Permission denied
# ls /usr/src/linux-4.14.12-gentoo/.config
ls: reading directory '/usr/src/linux-4.14.12-gentoo/.config': Not a directory
total 0

(Note the fun 'Is a directory'/'Not a directory' dichotomy!)

Strangely, when I mount using NFSv3 everything is fine:

# mount -t nfs -o nfsvers=3 /usr/src
# mount
[...]
server-calgary:/var/nfs/router/kernel on /usr/src type nfs (rw,relatime,vers=3,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp6,timeo=600,retrans=2,sec=sys,mountaddr=[server_ipv6_address],mountvers=3,mountport=33959,mountproto=udp6,local_lock=none,addr=[server_ipv6_address])
# ls -la /usr/src/linux-4.14.12-gentoo/
total 57564
drwxr-xr-x  26 root root     4096 Jan  7 14:41 .
drwxr-xr-x  14 root root     4096 Jan  7 09:50 ..
drwxr-xr-x  33 root root     4096 Jan  7 14:34 arch
drwxr-xr-x   3 root root     4096 Jan  7 14:34 block
-rw-r--r--   1 root root   559068 Jan  7 14:32 built-in.o
drwxr-xr-x   2 root root     4096 Jan  7 14:34 certs
-rw-r--r--   1 root root       59 Nov 12 11:46 .cocciconfig
-rw-r--r--   1 root root    99150 Jan  7 09:51 .config
-rw-r--r--   1 root root    99153 Jan  7 09:50 .config.old
-rw-r--r--   1 root root    18693 Nov 12 11:46 COPYING
-rw-r--r--   1 root root    98556 Nov 12 11:46 CREDITS
drwxr-xr-x   4 root root    12288 Jan  7 14:35 crypto
drwxr-xr-x   2 root root     4096 Jan  7 03:41 distro
drwxr-xr-x 121 root root    12288 Jan  7 04:02 Documentation
drwxr-xr-x 131 root root     4096 Jan  7 14:34 drivers
drwxr-xr-x   2 root root     4096 Jan  7 14:34 firmware
drwxr-xr-x  74 root root    12288 Jan  7 14:34 fs
-rw-r--r--   1 root root       31 Nov 12 11:46 .get_maintainer.ignore
-rw-r--r--   1 root root       30 Nov 12 11:46 .gitattributes
-rw-r--r--   1 root root     1312 Nov 12 11:46 .gitignore
drwxr-xr-x  29 root root     4096 Jan  7 09:52 include
drwxr-xr-x   2 root root     4096 Jan  7 14:34 init
drwxr-xr-x   2 root root     4096 Jan  7 14:34 ipc
-rw-r--r--   1 root root     2293 Nov 12 11:46 Kbuild
-rw-r--r--   1 root root      312 Jan  7 02:36 Kconfig
drwxr-xr-x  17 root root    12288 Jan  7 14:38 kernel
drwxr-xr-x  13 root root    16384 Jan  7 14:38 lib
-rw-r--r--   1 root root     8885 Nov 12 11:46 .mailmap
-rw-r--r--   1 root root   430471 Nov 12 11:46 MAINTAINERS
-rw-r--r--   1 root root    59986 Jan  7 02:36 Makefile
-rw-r--r--   1 root root      435 Jan  7 13:28 .missing-syscalls.d
drwxr-xr-x   3 root root    12288 Jan  7 14:34 mm
-rw-r--r--   1 root root     3031 Jan  7 14:34 modules.builtin
-rw-r--r--   1 root root     6712 Jan  7 14:34 modules.order
-rw-r--r--   1 root root   180278 Jan  7 14:34 Module.symvers
drwxr-xr-x  69 root root     4096 Jan  7 14:34 net
-rw-r--r--   1 root root      722 Nov 12 11:46 README
drwxr-xr-x  28 root root     4096 Jan  7 03:41 samples
drwxr-xr-x  14 root root     4096 Jan  7 09:54 scripts
drwxr-xr-x  10 root root     4096 Jan  7 14:34 security
drwxr-xr-x  24 root root     4096 Jan  7 14:41 sound
-rw-r--r--   1 root root  1734539 Jan  7 14:33 System.map
-rw-r--r--   1 root root   540440 Jan  7 14:32 .tmp_kallsyms1.o
-rw-r--r--   1 root root  3158797 Jan  7 14:32 .tmp_kallsyms1.S
-rw-r--r--   1 root root   540440 Jan  7 14:33 .tmp_kallsyms2.o
-rw-r--r--   1 root root  3158797 Jan  7 14:32 .tmp_kallsyms2.S
-rw-r--r--   1 root root  1734539 Jan  7 14:33 .tmp_System.map
drwxr-xr-x   2 root root    12288 Jan  7 14:30 .tmp_versions
-rwxr-xr-x   1 root root 11208760 Jan  7 14:32 .tmp_vmlinux1
-rwxr-xr-x   1 root root 11741248 Jan  7 14:32 .tmp_vmlinux2
drwxr-xr-x  30 root root     4096 Jan  7 03:46 tools
drwxr-xr-x   2 root root     4096 Jan  7 14:34 usr
-rw-r--r--   1 root root        2 Jan  7 14:32 .version
drwxr-xr-x   4 root root     4096 Jan  7 14:34 virt
-rwxr-xr-x   1 root root 11741248 Jan  7 14:33 vmlinux
-rw-r--r--   1 root root       99 Jan  7 14:33 .vmlinux.cmd
-rw-r--r--   1 root root 11566632 Jan  7 14:32 vmlinux.o
# cat /usr/src/linux-4.14.12-gentoo/.config
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 4.14.12-gentoo Kernel Configuration
#

#
# Gentoo Linux
#
CONFIG_GENTOO_LINUX=y
CONFIG_GENTOO_LINUX_UDEV=y
[...]

I don't see any messages in either dmesg or journalctl on either computer. Has this happened to anyone before? It's very odd behaviour and I haven't seen it in the past. I'm OK with using NFSv3 for now, but I would prefer version 4 if possible.

  • The NFS versions have to agree both in the server and client, right? – Rui F Ribeiro Jan 10 '18 at 19:26
  • They do, but I have version 3 and 4[.2] support enabled on both sides. There doesn't seem to be any issue during negotiation. I'll add the rpcinfo -p information to the question, though. – ErikF Jan 10 '18 at 19:35
  • What's the type of the actual source filesystem you're sharing with NFS? If it supports multiple datastreams per file, this could be some sort of misfiring of some mechanism that attempts to provide NFS access to all the streams, not just the "main" one. – telcoM Jan 10 '18 at 20:06
  • Sorry, I forgot to add that. It's an ext4 partition: I'll add the appropriate tune2fs info. – ErikF Jan 10 '18 at 20:10
  • Does tune2fs say that the filesytem needs recovery? – Gerard H. Pille Jan 10 '18 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.