NFS/RDMA fixes
Subsystems (3)
cover NFS/RDMA fixes
Please consider these for 3.15.
---
Chuck Lever (6):
NFS: incorrect "port=" value in /proc/mounts
NFS: Use port 20049 by default for NFS/RDMA mounts
NFS: advertise only supported callback netids
SUNRPC: remove KERN_INFO from dprintk() call sites
SUNRPC: Fix large reads on NFS/RDMA
NFS: Clean up: revert increase in READDIR RPC buffer max size
fs/nfs/client.c | 1 + fs/nfs/nfs4proc.c | 24 ++++++++++++++++++------ fs/nfs/nfs4xdr.c | 3 +-- fs/nfs/super.c | 2 ++ include/uapi/linux/nfs.h | 1 + net/sunrpc/xprtrdma/rpc_rdma.c | 4 +--- net/sunrpc/xprtrdma/transport.c | 10 +++++----- 7 files changed, 29 insertions(+), 16 deletions(-)
Signature · 1 line
Chuck Lever
PATCH 1/6 NFS: Clean up: revert increase in READDIR RPC buffer max size
Security labels go with each directory entry, thus they are always stored in the page cache, not in the head buffer. The length of the reply that goes in head[0] should not have changed to support NFSv4.2 labels.
---
fs/nfs/nfs4xdr.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
fs/nfs/nfs4xdr.c +1 -2
@@ -203,8 +203,7 @@ static int nfs4_stat_to_errno(int); 2 + encode_verifier_maxsz + 5 + \ nfs4_label_maxsz)#define decode_readdir_maxsz (op_decode_hdr_maxsz + \ - decode_verifier_maxsz + \ - nfs4_label_maxsz + nfs4_fattr_maxsz) + decode_verifier_maxsz)#define encode_readlink_maxsz (op_encode_hdr_maxsz)#define decode_readlink_maxsz (op_decode_hdr_maxsz + 1)#define encode_write_maxsz (op_encode_hdr_maxsz + \
PATCH 2/6 SUNRPC: Fix large reads on NFS/RDMA
In reply to Chuck LeverAfter commit a11a2bf4, "SUNRPC: Optimise away unnecessary data moves in xdr_align_pages", Thu Aug 2 13:21:43 2012, READs larger than a few hundred bytes via NFS/RDMA no longer work. This commit exposed a long-standing bug in rpcrdma_inline_fixup().
I reproduce this with an rsize=4096 mount using the cthon04 basic tests. Test 5 fails with an EIO error.
For my reproducer, kernel log shows:
NFS: server cheating in read reply: count 4096 > recvd 0
rpcrdma_inline_fixup() is zeroing the xdr_stream::page_len field, and xdr_align_pages() is now returning that value to the READ XDR decoder function.
That field is set up by xdr_inline_pages() by the READ XDR encoder function. As far as I can tell, it is supposed to be left alone after that, as it describes the dimensions of the reply xdr_stream, not the contents of that stream.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=68391
---
net/sunrpc/xprtrdma/rpc_rdma.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
net/sunrpc/xprtrdma/rpc_rdma.c +1 -3
@@ -649,9 +649,7 @@ rpcrdma_inline_fixup(struct rpc_rqst *rqst, char *srcp, int copy_len, int pad)break ; page_base =0 ; } - rqst->rq_rcv_buf.page_len = olen - copy_len; - }else - rqst->rq_rcv_buf.page_len =0 ; + }if (copy_len && rqst->rq_rcv_buf.tail[0 ].iov_len) { curlen = copy_len;
PATCH 3/6 SUNRPC: remove KERN_INFO from dprintk() call sites
In reply to Chuck LeverThe use of KERN_INFO causes garbage characters to appear when debugging is enabled.
---
net/sunrpc/xprtrdma/transport.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
net/sunrpc/xprtrdma/transport.c +5 -5
@@ -733,7 +733,7 @@ static void __exit xprt_rdma_cleanup(void) {int rc; -dprintk (KERN_INFO "RPCRDMA Module Removed, deregister RPC RDMA transport\n" ); +dprintk ("RPCRDMA Module Removed, deregister RPC RDMA transport\n" );#ifdef RPC_DEBUG if (sunrpc_table_header) {unregister_sysctl_table (sunrpc_table_header);
@@ -755,14 +755,14 @@ static int __init xprt_rdma_init(void)if (rc)return rc; -dprintk (KERN_INFO "RPCRDMA Module Init, register RPC RDMA transport\n" ); +dprintk ("RPCRDMA Module Init, register RPC RDMA transport\n" ); -dprintk (KERN_INFO "Defaults:\n" ); -dprintk (KERN_INFO "\tSlots %d\n" +dprintk ("Defaults:\n" ); +dprintk ("\tSlots %d\n" "\tMaxInlineRead %d\n\tMaxInlineWrite %d\n" , xprt_rdma_slot_table_entries, xprt_rdma_max_inline_read, xprt_rdma_max_inline_write); -dprintk (KERN_INFO "\tPadding %d\n\tMemreg %d\n" , +dprintk ("\tPadding %d\n\tMemreg %d\n" , xprt_rdma_inline_write_padding, xprt_rdma_memreg_strategy);#ifdef RPC_DEBUG
PATCH 4/6 NFS: advertise only supported callback netids
In reply to Chuck LeverNFSv4.0 clients use the SETCLIENTID operation to inform NFS servers how to contact a client's callback service. If a server cannot contact a client's callback service, that server will not delegate to that client, which results in a performance loss.
Our client advertises "rdma" as the callback netid when the forward channel is "rdma". But our client always starts only "tcp" and "tcp6" callback services.
Instead of advertising the forward channel netid, advertise "tcp" or "tcp6" as the callback netid, based on the value of the clientaddr mount option, since those are what our client currently supports.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=69171
---
fs/nfs/nfs4proc.c | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-)
fs/nfs/nfs4proc.c +18 -6
@@ -4883,6 +4883,20 @@ nfs4_init_uniform_client_string(const struct nfs_client *clp, nodename); } +/* +* nfs4_callback_up_net() starts only "tcp" and "tcp6" callback +* services. Advertise one based on the address family of the +* clientaddr. +*/ +static unsigned int +nfs4_init_callback_netid (const struct nfs_client *clp,char *buf,size_t len) +{ +if (strchr (clp->cl_ipaddr,':' ) !=NULL ) +return scnprintf (buf, len,"tcp6" ); +else +return scnprintf (buf, len,"tcp" ); +} +/** * nfs4_proc_setclientid - Negotiate client ID * @clp: state data structure
@@ -4924,12 +4938,10 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, setclientid.sc_name, sizeof(setclientid.sc_name));/* cb_client4 */ -rcu_read_lock (); - setclientid.sc_netid_len =scnprintf (setclientid.sc_netid, -sizeof (setclientid.sc_netid),"%s" , -rpc_peeraddr2str (clp->cl_rpcclient, -RPC_DISPLAY_NETID )); -rcu_read_unlock (); + setclientid.sc_netid_len = +nfs4_init_callback_netid (clp, + setclientid.sc_netid, +sizeof (setclientid.sc_netid)); setclientid.sc_uaddr_len =scnprintf (setclientid.sc_uaddr,sizeof (setclientid.sc_uaddr),"%s.%u.%u" , clp->cl_ipaddr, port >>8 , port &255 );
PATCH 5/6 NFS: Use port 20049 by default for NFS/RDMA mounts
In reply to Chuck LeverWhen providing NFSv2 and v3 service via RDMA, NFS servers MAY use an alternative well-known port number, 20049. They are not required to register the service with their local rpcbind. At least one server implementation I am aware of does not register it's NFS/RDMA service with rpcbind.
When providing NFSv4 service via RDMA, the server MUST use the alternative port number, 20049. As with NFSv4 on IP-based transports, clients SHOULD connect to this port without consulting the server's rpcbind, so we can't expect rpcbind to help here either.
See section 6 of RFC 5667 for details.
Today, admins are required to specify "port=" when mounting an NFS/RDMA server. To comply with RFC 5667 and for cross- compatibility with heterogenous automounter maps, provide the proper default port when mounting with "proto=rdma".
If the server does not use port 20049, the "port=" mount option is still required to mount successfully. But clients today are forced to specify this option anyway.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=68401
---
fs/nfs/super.c | 2 ++ include/uapi/linux/nfs.h | 1 + 2 files changed, 3 insertions(+), 0 deletions(-)
fs/nfs/super.c +2 -0
@@ -2157,6 +2157,8 @@ static int nfs_validate_text_mount_data(void *options, }else nfs_set_mount_transport_protocol (args); +if (args->nfs_server.protocol ==XPRT_TRANSPORT_RDMA ) + port =NFS_RDMA_PORT ;nfs_set_port (sap, &args->nfs_server.port, port); return nfs_parse_devname(dev_name,
include/uapi/linux/nfs.h +1 -0
@@ -9,6 +9,7 @@#define NFS_PROGRAM 100003#define NFS_PORT 2049 +#define NFS_RDMA_PORT 20049#define NFS_MAXDATA 8192#define NFS_MAXPATHLEN 1024#define NFS_MAXNAMLEN 255
PATCH 6/6 NFS: incorrect "port=" value in /proc/mounts
In reply to Chuck LeverMounting with "-o vers=4" shows the following in /proc/mounts:
... namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2, ...
^^^^^^
The default port, 2049, was actually used, but was never recorded in this mount point's nfs_server.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=69241
---
fs/nfs/client.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
fs/nfs/client.c +1 -0
@@ -924,6 +924,7 @@ void nfs_server_copy_userdata(struct nfs_server *target, struct nfs_server *sour target->flags = source->flags; target->rsize = source->rsize; target->wsize = source->wsize; + target->port = source->port; target->acregmin = source->acregmin; target->acregmax = source->acregmax; target->acdirmin = source->acdirmin;