从内核 4.14.10 开始,我注意到我的 NFS 挂载发生了一个奇怪的问题,如果使用版本 4 挂载,目录中的所有条目都将显示为目录。以下是我的设置:
在服务器上:
nfs-utils: net-fs/nfs-utils-2.3.1-r1::gentoo USE="caps ipv6 libmount nfsdcld nfsidmap nfsv4 nfsv41 tcpd uuid -kerberos -ldap (-selinux)"
内核.config
(NFS 条目)
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)
分区信息来自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
[...]
在客户端:
nfs-utils: net-fs/nfs-utils-2.3.1-r1::gentoo USE="caps ipv6 libmount nfsdcld nfsidmap nfsv4 nfsv41 tcpd uuid -kerberos -ldap (-selinux)
内核.config
(NFS 条目)
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
(仅显示 NFS 条目)
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
当我使用 NFSv4 挂载其中任何一个时,会发生以下情况:
# 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
(注意有趣的“是目录”/“不是目录”二分法!)
奇怪的是,当我使用 NFSv3 挂载时一切正常:
# 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
[...]
dmesg
我在任何一台计算机上都没有看到任何消息journalctl
。以前有人发生过这种情况吗?这是非常奇怪的行为,我过去从未见过。我现在可以使用 NFSv3,但如果可能的话我更喜欢版本 4。