debian 5.19.11 Linux:NFSv3 输入/输出错误,而 cat 、5.14 或更低版本正常

debian 5.19.11 Linux:NFSv3 输入/输出错误,而 cat 、5.14 或更低版本正常

是什么导致了这种情况呢?

升级到内核 5.19 并尝试从 NFS 服务器上的目录读取小文件。 

您到底做了什么(或没有做什么)是有效的(或无效的)?

服务器: 

WinNFSd.exe -log on "F/Kernel5.19/NFS"

客户:

mount -t nfs 192.168.0.21:/F/Kernel5.19/NFS /mnt/img -o noatime,nfsvers=3
cd /mnt/img/GPCImageV4.0
cat parts

这一行动的结果是什么?

Input/output error.

终端界面卡住

您期望什么结果?

文件可以正常读取(这个好的结果发生在内核 5.14 及更早版本中)

问题详情WinNFSd.exe 我在使用该工具作为服务器、在 Windows 10 上共享目录以及使用 Debian 11(内核版本 5.19)作为客户端利用 NFSv3 协议进行安装  时遇到了问题 。挂载过程完成,没有任何错误,并且可以使用ls 或 成功访问目录信息 ls -l。但是,当我尝试使用该命令访问目录内容时 cat ,我收到一条错误消息,指出 Input/output error.

当使用 touch 在客户端创建新文件时,我还可以使用 cat 读取新创建的文件的内容。但是,如果在服务器端创建了一个文件,客户端可以使用 ls 看到新创建的文件并获取文件信息,但在尝试使用 cat 读取其内容时会遇到“输入/输出错误”。这是让我困惑的奇怪部分,似乎是访问控制问题?

此外,在一段时间后,尝试访问挂载目录时,终端界面会变得无响应。我不确定触发此问题的确切原因,因为时间似乎是随机的。有时,需要几分钟才会出现无响应,而在其他情况下,我可以工作长达半小时而不会出现任何问题。

有趣的是,将内核版本降级到 5.14 或以下可以解决此问题。事实上,使用相同的网络环境、挂载目录和挂载参数,我测试了内核版本6.1、5.18、5.15、5.14、5.10和4.19。在这些版本中,只有前三个版本出现此问题,而后三个低版本能够毫无问题地读取NFS共享目录中的文件内容。

新测试信息更新 Wireshark 输出

我正在尝试读取实际长度为 15 的文件的内容并使用 Wireshark 捕获数据包。我发现在较低版本的Linux内核(4.19版本)中,NFS客户端请求的长度为15(实际长度),

No.  Source        Destination    Protocol  Length  Info

212  192.168.0.100  192.168.0.21   NFS       206     V3 READ Call(Reply In 213), FH:0x6ee4af5f Offset: 0 Len:15
213  192.168.0.21   192.168.0.100  NFS       202     V3 READ Reply(Call In 212) Len:15

但在更高版本的Linux内核(5.19版本)中,请求长度为4096。

No.  Source        Destination    Protocol  Length  Info

443  192.168.0.100  192.168.0.21  NFS       206     V3 READ Call(Reply In 446), FH:0x6ee4af5f Offset: 0 Len:4096
444  192.168.0.21   192.168.0.100 TCP       1514    2049->714 [ACK] Seq=44717 Ack=4613 Win=8210 Len=1460 [TCP segment of a reassembled PDU]
445  192.168.0.21   192.168.0.100 TCP       1514    2049->714 [ACK] Seq=46177 Ack=4613 Win=8210 Len=1460 [TCP segment of a reassembled PDU]
446  192.168.0.21   192.168.0.100 NFS       1362    V3 READ Reply(Call In 443) Len:15

我不确定这种现象是否与“输入/输出错误”有关。

有人对此有什么想法吗?

以下是有问题的测试环境的具体细节:

服务器:

  • 操作系统:Windows 10
  • NFS 服务器工具:WinNFSd.exe 2.4.0

客户:

  • 操作系统:Debian 11.0
  • 内核版本:  Linux gpc 5.19.0-0.deb11.2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.19.11-1~bpo11+1 (2022-10-03) x86_64 GNU/Linux

协议:

  • NFS 版本:NFSv3
  • nfs-common/oldstable,现在 1:1.3.4-6 amd64 [已安装]
  • rpcbind/oldstable,现在 1.2.5-9 amd64 [已安装,自动]

挂载CMD

root@gpc:mount -t nfs 192.168.0.21:/F/Kernel5.19/NFS /mnt/img -o noatime,nfsvers=3

观察结果:

root@gpc:/mnt/img# ls -l 
total 4 
drwxrwxrwx 1 root root 4096 Jul 28 2023 GPCImageV4.0

root@gpc:/mnt/img/GPCImageV4.0# ls -l 
total 2400393 
-rwxrwxrwx 1 root root 1529 Jul 26 18:54 blkdev.list 
-rwxrwxrwx 1 root root 1424 Jul 26 18:54 blkid.list 
-rwxrwxrwx 1 root root 13562 Jul 26 18:54 clonezilla-img 
-rwxrwxrwx 1 root root 300 Jul 26 18:54 dev-fs.list 
-rwxrwxrwx 1 root root 4 Jul 26 18:54 disk 
-rwxrwxrwx 1 root root 1207 Jul 26 18:54 efi-nvram.dat 
-rwxrwxrwx 1 root root 201 Nov 2 2022 GantryConfiguration.xml 
-rwxrwxrwx 1 root root 22373 Jul 26 18:54 Info-dmi.txt 
-rwxrwxrwx 1 root root 236 Jul 26 18:54 Info-img-id.txt 
-rwxrwxrwx 1 root root 61 Jul 26 18:54 Info-img-size.txt
-rwxrwxrwx 1 root root 27602 Jul 26 18:54 Info-lshw.txt
-rwxrwxrwx 1 root root 1592 Jul 26 18:54 Info-lspci.txt 
-rwxrwxrwx 1 root root 1539 Jul 26 18:54 Info-OS-prober.txt 
-rwxrwxrwx 1 root root 200 Jul 26 18:54 Info-packages.txt 
-rwxrwxrwx 1 root root 96 Jul 26 18:54 Info-saved-by-cmd.txt 
-rwxrwxrwx 1 root root 4724 Jul 26 18:54 Info-smart.txt 
-rwxrwxrwx 1 root root 35 Jul 26 18:54 parts 
-rwxrwxrwx 1 root root 2158265 Jul 26 18:54 sda1.vfat-ptcl-img.gz 
-rwxrwxrwx 1 root root 2210653199 Jul 26 18:54 sda2.ext4-ptcl-img.gz 
-rwxrwxrwx 1 root root 225310835 Jul 26 18:53 sda3.ext4-ptcl-img.gz 
-rwxrwxrwx 1 root root 4227536 Jul 26 18:52 sda4.ext4-ptcl-img.gz 
-rwxrwxrwx 1 root root 7246389 Jul 26 18:52 sda5.ext4-ptcl-img.gz
-rwxrwxrwx 1 root root 2314988 Jul 26 18:52 sda6.ext4-ptcl-img.gz 
-rwxrwxrwx 1 root root 5948542 Jul 26 18:52 sda7.ext4-ptcl-img.gz 
-rwxrwxrwx 1 root root 37 Jul 26 18:54 sda-chs.sf 
-rwxrwxrwx 1 root root 17408 Jul 26 18:54 sda-gpt-1st 
-rwxrwxrwx 1 root root 16384 Jul 26 18:54 sda-gpt-2nd 
-rwxrwxrwx 1 root root 17920 Jul 26 18:54 sda-gpt.gdisk 
-rwxrwxrwx 1 root root 967 Jul 26 18:54 sda-gpt.sgdisk 
-rwxrwxrwx 1 root root 512 Jul 26 18:54 sda-mbr 
-rwxrwxrwx 1 root root 644 Jul 26 18:54 sda-pt.parted 
-rwxrwxrwx 1 root root 540 Jul 26 18:54 sda-pt.parted.compact 
-rwxrwxrwx 1 root root 1229 Jul 26 18:54 sda-pt.sf 
-rwxrwxrwx 1 root root 53 Jul 26 18:52 swappt-sda8.info

root@gpc:/mnt/img/GPCImageV4.0# cat parts 
cat: parts: Input/output error 

root@gpc:/mnt/img/GPCImageV4.0# cat disk 
cat: disk: Input/output error

以下是正常测试环境的具体细节:

服务器:

  • 操作系统:Windows 10
  • NFS 服务器工具:WinNFSd.exe 2.4.0

客户:

  • 操作系统:Debian 9.1
  • 内核版本:  Linux gpc 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux

协议:

  • NFS 版本:NFSv3
  • nfs-common/now 1:1.3.4-2.1ubuntu5.5 amd64 [已安装,本地]
  • rpcbind/now 0.2.3-0.6ubuntu0.18.04.4 amd64 [已安装,本地]

挂载CMD

root@gpc:mount -t nfs 192.168.0.21:/F/Kernel5.19/NFS /mnt/img -o noatime,nfsvers=3

观察结果:

root@gpc:/mnt/img# ls -l 
total 4 
drwxrwxrwx 1 root root 4096 Jul 28  2023 GPCImageV4.0

root@gpc:/mnt/img/GPCImageV4.0# ls -l 
total 2400393
-rwxrwxrwx 1 root root 1529 Jul 26  2023 blkdev.list
-rwxrwxrwx 1 root root 1424 Jul 26  2023 blkid.list
-rwxrwxrwx 1 root root 13562 Jul 26  2023 clonezilla-img
-rwxrwxrwx 1 root root 300 Jul 26  2023 dev-fs.list
-rwxrwxrwx 1 root root 4 Jul 26  2023 disk
-rwxrwxrwx 1 root root 1207 Jul 26  2023 efi-nvram.dat
-rwxrwxrwx 1 root root 201 Nov  2  2022 GantryConfiguration.xml
-rwxrwxrwx 1 root root 22373 Jul 26  2023 Info-dmi.txt
-rwxrwxrwx 1 root root 236 Jul 26  2023 Info-img-id.txt
-rwxrwxrwx 1 root root 61 Jul 26  2023 Info-img-size.txt
-rwxrwxrwx 1 root root 27602 Jul 26  2023 Info-lshw.txt
-rwxrwxrwx 1 root root 1592 Jul 26  2023 Info-lspci.txt
-rwxrwxrwx 1 root root 1539 Jul 26  2023 Info-OS-prober.txt
-rwxrwxrwx 1 root root 200 Jul 26  2023 Info-packages.txt
-rwxrwxrwx 1 root root 96 Jul 26  2023 Info-saved-by-cmd.txt
-rwxrwxrwx 1 root root 4724 Jul 26  2023 Info-smart.txt
-rwxrwxrwx 1 root root 35 Jul 26  2023 parts
-rwxrwxrwx 1 root root 2158265 Jul 26  2023 sda1.vfat-ptcl-img.gz
-rwxrwxrwx 1 root root 2210653199 Jul 26  2023 sda2.ext4-ptcl-img.gz
-rwxrwxrwx 1 root root 225310835 Jul 26  2023 sda3.ext4-ptcl-img.gz
-rwxrwxrwx 1 root root 4227536 Jul 26  2023 sda4.ext4-ptcl-img.gz
-rwxrwxrwx 1 root root 7246389 Jul 26  2023 sda5.ext4-ptcl-img.gz
-rwxrwxrwx 1 root root 2314988 Jul 26  2023 sda6.ext4-ptcl-img.gz
-rwxrwxrwx 1 root root 5948542 Jul 26  2023 sda7.ext4-ptcl-img.gz
-rwxrwxrwx 1 root root 37 Jul 26  2023 sda-chs.sf
-rwxrwxrwx 1 root root 17408 Jul 26  2023 sda-gpt-1st
-rwxrwxrwx 1 root root 16384 Jul 26  2023 sda-gpt-2nd
-rwxrwxrwx 1 root root 17920 Jul 26  2023 sda-gpt.gdisk
-rwxrwxrwx 1 root root 967 Jul 26  2023 sda-gpt.sgdisk
-rwxrwxrwx 1 root root 512 Jul 26  2023 sda-mbr
-rwxrwxrwx 1 root root 644 Jul 26  2023 sda-pt.parted
-rwxrwxrwx 1 root root 540 Jul 26  2023 sda-pt.parted.compact
-rwxrwxrwx 1 root root 1229 Jul 26  2023 sda-pt.sf
-rwxrwxrwx 1 root root 53 Jul 26  2023 swappt-sda8.info

root@gpc:/mnt/img/GPCImageV4.0# cat parts
sda1 sda2 sda3 sda4 sda5 sda6 sda7

root@gpc:/mnt/img/GPCImageV4.0# cat disk
sda

相关内容