linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/1] NFS: allow deprecation of NFS UDP protocol
@ 2019-11-26 21:43 Olga Kornievskaia
  2019-12-16 21:21 ` Petr Vorel
  0 siblings, 1 reply; 2+ messages in thread
From: Olga Kornievskaia @ 2019-11-26 21:43 UTC (permalink / raw)
  To: trond.myklebust, anna.schumaker; +Cc: linux-nfs

From: Olga Kornievskaia <kolga@netapp.com>

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>
---
 fs/nfs/Kconfig  | 9 +++++++++
 fs/nfs/client.c | 4 ++++
 fs/nfs/super.c  | 9 +++++++--
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
index 295a7a2..651a9ad 100644
--- a/fs/nfs/Kconfig
+++ b/fs/nfs/Kconfig
@@ -196,3 +196,12 @@ config NFS_DEBUG
 	depends on NFS_FS && SUNRPC_DEBUG
 	select CRC32
 	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.
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 02110a3..45f1374c 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -474,6 +474,7 @@ void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
 			to->to_maxval = to->to_initval;
 		to->to_exponential = 0;
 		break;
+#ifndef CONFIG_NFS_DISABLE_UDP_SUPPORT
 	case XPRT_TRANSPORT_UDP:
 		if (retrans == NFS_UNSPEC_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_exponential = 1;
 		break;
+#endif
 	default:
 		BUG();
 	}
@@ -580,8 +582,10 @@ static int nfs_start_lockd(struct nfs_server *server)
 		default:
 			nlm_init.protocol = IPPROTO_TCP;
 			break;
+#ifndef CONFIG_NFS_DISABLE_UDP_SUPPORT
 		case XPRT_TRANSPORT_UDP:
 			nlm_init.protocol = IPPROTO_UDP;
+#endif
 	}
 
 	host = nlmclnt_init(&nlm_init);
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index a84df7d6..f6ad74f 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2204,6 +2204,10 @@ static int nfs_validate_text_mount_data(void *options,
 #endif /* CONFIG_NFS_V4 */
 	} else {
 		nfs_set_mount_transport_protocol(args);
+#ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
+		if (args->nfs_server.protocol == XPRT_TRANSPORT_UDP)
+			goto out_invalid_transport_udp;
+#endif
 		if (args->nfs_server.protocol == XPRT_TRANSPORT_RDMA)
 			port = NFS_RDMA_PORT;
 	}
@@ -2220,11 +2224,12 @@ static int nfs_validate_text_mount_data(void *options,
 out_v4_not_compiled:
 	dfprintk(MOUNT, "NFS: NFSv4 is not compiled into kernel\n");
 	return -EPROTONOSUPPORT;
-#else
+#endif /* !CONFIG_NFS_V4 */
+#if IS_ENABLED(CONFIG_NFS_DISABLE_UDP_SUPPORT) || IS_ENABLED(CONFIG_NFS_V4)
 out_invalid_transport_udp:
 	dfprintk(MOUNT, "NFSv4: Unsupported transport protocol udp\n");
 	return -EINVAL;
-#endif /* !CONFIG_NFS_V4 */
+#endif
 
 out_no_address:
 	dfprintk(MOUNT, "NFS: mount program didn't pass remote address\n");
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3 1/1] NFS: allow deprecation of NFS UDP protocol
  2019-11-26 21:43 [PATCH v3 1/1] NFS: allow deprecation of NFS UDP protocol Olga Kornievskaia
@ 2019-12-16 21:21 ` Petr Vorel
  0 siblings, 0 replies; 2+ messages in thread
From: Petr Vorel @ 2019-12-16 21:21 UTC (permalink / raw)
  To: Olga Kornievskaia; +Cc: trond.myklebust, anna.schumaker, linux-nfs

Hi,

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-16 21:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-26 21:43 [PATCH v3 1/1] NFS: allow deprecation of NFS UDP protocol Olga Kornievskaia
2019-12-16 21:21 ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).