mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	NFS: allow deprecation of NFS UDP protocol
Add a kernel config CONFIG_NFS_DISABLE_UDP_SUPPORT to disallow NFS UDP mounts and enable it by default. Signed-off-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
		
							parent
							
								
									f7b37b8b13
								
							
						
					
					
						commit
						b24ee6c64c
					
				
					 3 changed files with 17 additions and 0 deletions
				
			
		| 
						 | 
					@ -196,3 +196,12 @@ config NFS_DEBUG
 | 
				
			||||||
	depends on NFS_FS && SUNRPC_DEBUG
 | 
						depends on NFS_FS && SUNRPC_DEBUG
 | 
				
			||||||
	select CRC32
 | 
						select CRC32
 | 
				
			||||||
	default y
 | 
						default y
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					config NFS_DISABLE_UDP_SUPPORT
 | 
				
			||||||
 | 
					       bool "NFS: Disable NFS UDP protocol support"
 | 
				
			||||||
 | 
					       depends on NFS_FS
 | 
				
			||||||
 | 
					       default y
 | 
				
			||||||
 | 
					       help
 | 
				
			||||||
 | 
						 Choose Y here to disable the use of NFS over UDP. NFS over UDP
 | 
				
			||||||
 | 
						 on modern networks (1Gb+) can lead to data corruption caused by
 | 
				
			||||||
 | 
						 fragmentation during high loads.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -474,6 +474,7 @@ void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
 | 
				
			||||||
			to->to_maxval = to->to_initval;
 | 
								to->to_maxval = to->to_initval;
 | 
				
			||||||
		to->to_exponential = 0;
 | 
							to->to_exponential = 0;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					#ifndef CONFIG_NFS_DISABLE_UDP_SUPPORT
 | 
				
			||||||
	case XPRT_TRANSPORT_UDP:
 | 
						case XPRT_TRANSPORT_UDP:
 | 
				
			||||||
		if (retrans == NFS_UNSPEC_RETRANS)
 | 
							if (retrans == NFS_UNSPEC_RETRANS)
 | 
				
			||||||
			to->to_retries = NFS_DEF_UDP_RETRANS;
 | 
								to->to_retries = NFS_DEF_UDP_RETRANS;
 | 
				
			||||||
| 
						 | 
					@ -484,6 +485,7 @@ void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
 | 
				
			||||||
		to->to_maxval = NFS_MAX_UDP_TIMEOUT;
 | 
							to->to_maxval = NFS_MAX_UDP_TIMEOUT;
 | 
				
			||||||
		to->to_exponential = 1;
 | 
							to->to_exponential = 1;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		BUG();
 | 
							BUG();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -580,8 +582,10 @@ static int nfs_start_lockd(struct nfs_server *server)
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
			nlm_init.protocol = IPPROTO_TCP;
 | 
								nlm_init.protocol = IPPROTO_TCP;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					#ifndef CONFIG_NFS_DISABLE_UDP_SUPPORT
 | 
				
			||||||
		case XPRT_TRANSPORT_UDP:
 | 
							case XPRT_TRANSPORT_UDP:
 | 
				
			||||||
			nlm_init.protocol = IPPROTO_UDP;
 | 
								nlm_init.protocol = IPPROTO_UDP;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	host = nlmclnt_init(&nlm_init);
 | 
						host = nlmclnt_init(&nlm_init);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1215,6 +1215,10 @@ static int nfs_fs_context_validate(struct fs_context *fc)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		nfs_set_mount_transport_protocol(ctx);
 | 
							nfs_set_mount_transport_protocol(ctx);
 | 
				
			||||||
 | 
					#ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
 | 
				
			||||||
 | 
						       if (ctx->nfs_server.protocol == XPRT_TRANSPORT_UDP)
 | 
				
			||||||
 | 
							       goto out_invalid_transport_udp;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		if (ctx->nfs_server.protocol == XPRT_TRANSPORT_RDMA)
 | 
							if (ctx->nfs_server.protocol == XPRT_TRANSPORT_RDMA)
 | 
				
			||||||
			port = NFS_RDMA_PORT;
 | 
								port = NFS_RDMA_PORT;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue