NFS/RDMA small files corruption

Issues related to configuring your network
iMil
Posts: 8
Joined: 2022/02/18 08:27:56

NFS/RDMA small files corruption

Post by iMil » 2022/02/20 17:11:06

In an HPC environment, we have 2 nodes family, one running 7.1.1503 (3.10.0-229.el7.x86_64) and the other, newer, running 7.7.1908 (kernel 3.10.0-1062.12.1.el7.x86_64). Both mount an NFS/RDMA server with the following, vendor (Mellanox) documented flags:

10.0.0.1:/pool0/home on /mnt/rdma type nfs (rw,relatime,sync,vers=3,rsize=262144,wsize=262144,namlen=255,acregmin=0,acregmax=0,acdirmin=0,acdirmax=0,hard,nocto,noac,proto=rdma,port=20049,timeo=600,retrans=2,sec=sys,mountaddr=10.0.0.1,mountvers=3,mountproto=tcp,local_lock=none,addr=10.0.0.1)

On the 7.1 node, I can do the following:

7.1$ dd if=/dev/zero of=/mnt/rdma/test bs=1 count=701

And on the 7.7 node I would receive exactly the expected file

7.2$ hexdump /mnt/rdma/test
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
00002b0 0000 0000 0000 0000 0000 0000 0000
00002bd

Now if I do the same test with 700 bytes or less, the file is corrupted:

7.1$ dd if=/dev/zero of=/mnt/rdma/test bs=1 count=700

7.2$ hexdump /mnt/rdma/test | head -10
0000000 9dfe a757 0000 0100 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0100
0000020 0000 0100 0000 a401 0000 0100 0000 0000
0000030 0000 0000 0000 0000 0000 bc02 0000 0000
0000040 0000 0002 0000 0000 0000 0000 168c 0083
0000050 4a0f c612 0000 0000 b000 5a5b 1262 1e75
0000060 9d04 bc90 1262 1a75 c233 50e9 1262 1a75
0000070 c233 50e9 0000 bc02 0000 0100 0000 bc02
0000080 0000 0000 000a 5b5a 00b0 0000 0f9d 030c
0000090 0000 2d00 0000 0000 0000 0000 0000 0000

We have tried many, many options and are running out of ideas and would be very glad to have some new ones...
Yes upgrading to a more recent kernel is obviously on the table but I'm not yet sure it would be feasible on a short timing.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: NFS/RDMA small files corruption

Post by TrevorH » 2022/02/20 18:56:35

Only the latest version of CentOS 7 is supported. Both your systems are over 2.5 years out of date and for 7.1 you are nearly 7 years backlevel.

yum update

Edit: a quick check in the kernel rpm changelog show that there are 59 NFS related changes between your 7.7 system and current and for your 7.1 system, there are 1449.

Code: Select all

[root@centos7 ~]# rpm -q --changelog kernel-3.10.0-1160.53.1.el7.x86_64 | head -3930 | grep -ic nfs
59
[root@centos7 ~]# rpm -q --changelog kernel-3.10.0-1160.53.1.el7.x86_64 | head -78084 | grep -ic nfs
1449
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

iMil
Posts: 8
Joined: 2022/02/18 08:27:56

Re: NFS/RDMA small files corruption

Post by iMil » 2022/02/21 09:40:03

Well I've upgraded to the latest kernel and relase and the bug is still there:

Code: Select all

node1# dd if=/dev/zero of=/mnt/rdma/1160 bs=1 count=700

Code: Select all

node2# uname -mr
3.10.0-1160.53.1.el7.x86_64 x86_64
node2# lsb_release -d
Description:	CentOS Linux release 7.9.2009 (Core)
node2# hexdump /mnt/rdma/1160|head -5
0000000 376b 1728 0000 0100 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0100
0000020 0000 0100 0000 a401 0000 0100 0000 0000
0000030 0000 0000 0000 0000 0000 bc02 0000 0000
0000040 0000 0002 0000 0000 0000 0000 168c 0083

iMil
Posts: 8
Joined: 2022/02/18 08:27:56

Re: NFS/RDMA small files corruption

Post by iMil » 2022/02/21 13:43:58

Update

I just did a test on the same node, the most recent one, upgraded to CentOS 7.9, and it actually fails when writing and reading from the same node.
Moreover, tweaking with /proc/sys/sunrpc/rdma_memreg_strategy produces very strange results, for example with rdma_memreg_strategy == 6 the noise looks like that:

Code: Select all

0000120 8898 123d 4506 c0f8 b0d6 3940 44b9 c0f8
0000130 bc92 ba64 4491 c0f8 165c 0ae4 448e c0f8
0000140 c82e 19e7 44a9 c0f8 2ddc 11f2 44dc c0f8
0000150 ad84 79aa 4520 c0f8 b4af 68ca 4571 c0f8
0000160 b752 b3ef 45cb c0f8 b04a 97b8 462d c0f8
0000170 7543 d694 4695 c0f8 d5dd 2cdc 4702 c0f8
0000180 a9bb f717 476e c0f8 4a78 13d9 47d7 c0f8
0000190 2a26 a9e4 4834 c0f8 71c8 3d91 4882 c0f8
00001a0 fcae 8d55 48bb c0f8 2b04 bcf8 48dd c0f8
00001b0 b04c a4be 48e8 c0f8 79d3 db6c 48dc c0f8
00001c0 9f84 c912 48bb c0f8 096c b285 4886 c0f8
00001d0 f0ff ee8e 483e c0f8 d171 e773 47e4 c0f8
00001e0 8e7b f3d1 4779 c0f8 4bbd d26f 46ff c0f8

iMil
Posts: 8
Joined: 2022/02/18 08:27:56

Re: NFS/RDMA small files corruption

Post by iMil » 2022/02/21 16:49:27

Update

I installed Mellanox's official drivers. Now the corruption occurs with file < 640 bytes.

chemal
Posts: 776
Joined: 2013/12/08 19:44:49

Re: NFS/RDMA small files corruption

Post by chemal » 2022/02/21 17:54:06

Have you ever tried RH's official in-box drivers?

iMil
Posts: 8
Joined: 2022/02/18 08:27:56

Re: NFS/RDMA small files corruption

Post by iMil » 2022/02/22 08:47:55

chemal wrote:
2022/02/21 17:54:06
Have you ever tried RH's official in-box drivers?
Well the firsts tests were made with CentOS's bundled drivers which are, as far as I understand, RH's verbatim copy.

iMil
Posts: 8
Joined: 2022/02/18 08:27:56

Re: NFS/RDMA small files corruption

Post by iMil » 2022/02/22 08:51:43

Well it's actually worse than I thought. The files are not just "corrupted", they are actual memory leaks:

Code: Select all

# cat 20220222-1
0000000: b449 1fc1 0000 0001 0000 0000 0000 0000  .I..............
0000010: 0000 0000 0000 0000 0000 0000 0000 0001  ................
0000020: 0000 0001 0000 01a4 0000 0001 0000 0000  ................
0000030: 0000 0000 0000 0000 0000 0258 0000 0000  ...........X....
0000040: 0000 0200 0000 0000 0000 0000 8c16 8300  ................
0000050: 0f4a 12c6 0000 0000 00b0 5fd3 6214 a09b  .J........_.b...
0000060: 0c5f 0ffa 6214 a088 0f67 27e3 6214 a088  ._..b....g'.b...
0000070: 0f67 27e3 0000 0258 0000 0001 0000 0258  .g'....X.......X
0000080: 0000 5c9a 0000 0000 0000 0000 0000 0020  ..\............ 
0000090: 0100 0601 c612 4a0f 0083 168c 0000 0000  ......J.........
00000a0: 0000 0000 0a00 fd56 b000 0000 6d9c 0903  .......V....m...
00000b0: 0000 0000 3d33 8000 0000 011a 0000 0002  ....=3..........
00000c0: 0000 011a 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d  ....------------
00000d0: 0a0a 0a0a 0a2d 2d2d 2d2d 2d2d 2d2d 2d2d  .....-----------
00000e0: 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d  ----------------
00000f0: 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 2049  -------------- I
0000100: 7465 7261 7469 6f6e 2038 3438 3928 2020  teration 8489(  
0000110: 2035 2920 202d 2d2d 2d2d 2d2d 2d2d 2d2d   5)  -----------
0000120: 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d  ----------------
0000130: 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 0a0a 0a20  ------------... 
0000140: 2020 2050 4f54 4c4f 4b3a 2020 6370 7520     POTLOK:  cpu 
0000150: 7469 6d65 2020 2020 302e 3033 3532 3a20  time    0.0352: 
0000160: 7265 616c 2074 696d 6520 2020 2030 2e30  real time    0.0
0000170: 3334 390a 2020 2020 5345 5444 494a 3a20  349.    SETDIJ: 
0000180: 2063 7075 2074 696d 6520 2020 2030 2e30   cpu time    0.0
0000190: 3332 383a 2072 6561 6c20 7469 6d65 2020  328: real time  
00001a0: 2020 302e 3033 3239 0a20 2020 2045 4444    0.0329.    EDD
00001b0: 4941 473a 2020 6370 7520 7469 6d65 2020  IAG:  cpu time  
00001c0: 2020 332e 3139 3638 3a20 7265 616c 2074    3.1968: real t
00001d0: 696d 6520 2020 2033 2e31 3938 310a 0000  ime    3.1981...
00001e0: 3131 3238 2020 2020 0a48 4352 2020 2020  1128    .HCR    
00001f0: 2020 2020 2020 2020 2038 320a 2020 2020           82.    
0000200: 2031 322e 3934 3834 3732 3233 2020 2020   12.94847223    
0000210: 2020 2020 2d34 2e31 3938 3830 3635 3138      -4.198806518
0000220: 2020 2020 2020 2020 302e 3933 3536 3336          0.935636
0000230: 3039 3935 2020 2020 0a20 2020 3133 2e33  0995    .   13.3
0000240: 3837 3634 3434 3334 3120 2020 2020 2020  876444341       
0000250: 322e 3732 3939 3339                      2.729939

iMil
Posts: 8
Joined: 2022/02/18 08:27:56

[SOLVED] Re: NFS/RDMA small files corruption

Post by iMil » 2022/02/27 10:29:14

So, after a week of hunting down the bug, I came out with a very simple patch.
There is definitely a bug in the rpcrdma kernel module, which, when data is less or equal than a certain size, doesn't split it into chunks and process it inline. This processing has a bug I couldn't find, but a trivial fix is to process all files as chunks, by simply always returning 0 from the rpcrdma_results_inline() function. I have contacted the driver's author and opened a security bug at RedHat's Bugzilla.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: NFS/RDMA small files corruption

Post by TrevorH » 2022/02/27 12:22:40

Thanks for letting us know. I guess the bugzilla entry is marked private but might still be worth posting a link to it so that it can be searched for in the rpm changelog if/once it gets fixed.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply