> -----邮件原件----- > 发件人: Trond Myklebust <trondmy@xxxxxxxxxxxxxxx> > 发送时间: 2024年2月29日 5:03 > 收件人: anna@xxxxxxxxxx; > 抄送: linux-nfs@xxxxxxxxxxxxxxx; jlayton@xxxxxxxxxx > 主题: Re: [PATCH] nfs: fix regression in handling of namlen= option in NFSv4 > > On Wed, 2024-02-21 at 23:16 +0800, Chen Hanxiao wrote: > > Setting the maximum length of a pathname component > > via the namlen= mount option is currently broken in NFSv4. > > > > This patch will fix this issue. > > Why do we need this? In NFSv3 and NFSv4, the server will communicate > the correct value through the protocol. > In NFSv3, we could set namlen parameters: #mount -t nfs -o vers=3,namlen=100 192.168.122.210:/nfsroot /mnt And nfs_server.namelen is set to the values from command line. # mount ... 192.168.122.210:/nfsroot on /mnt type nfs (rw,relatime,vers=3,rsize=262144,wsize=262144,namlen=100,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.122.210,mountvers=3,mountport=20048,mountproto=udp,local_lock=none,addr=192.168.122.210) But for NFSv4, mount cmd with namlen could success, but no effect: # mount -t nfs4 -o vers=4.2,namlen=100 192.168.122.210:/nfsroot /mnt/ # mount ... 192.168.122.210:/nfsroot on /mnt type nfs4 (rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.122.208,local_lock=none,addr=192.168.122.210) I have some questions: 1) As we can set namlen in NFSv3, does NFS client use this parameter to limit something? 2) If 1) stands, do we need this for NFSv4, or reject namlen in a vers=4 mount? Regards, - Chen