linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] NFS: allow deprecation of NFS UDP protocol
@ 2019-11-08 21:32 Olga Kornievskaia
  2019-11-18  9:46 ` Trond Myklebust
  2019-11-18 18:42 ` Steve Dickson
  0 siblings, 2 replies; 5+ messages in thread
From: Olga Kornievskaia @ 2019-11-08 21:32 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.

I took the same approach as Chuck's deprecation of DES enc types
to start with default to still allow but I think the ultimate
goal is to disable

Question: how do we have folks trying this unless we set it to false?

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
---
 fs/nfs/Kconfig  | 10 ++++++++++
 fs/nfs/client.c |  4 ++++
 fs/nfs/super.c  |  8 ++++++++
 3 files changed, 22 insertions(+)

diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
index 295a7a2..6320113 100644
--- a/fs/nfs/Kconfig
+++ b/fs/nfs/Kconfig
@@ -196,3 +196,13 @@ 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 n
+	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.
+	  The default is N because many deployments still use UDP.
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 02110a3..24ca314 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;
+#ifdef 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;
+#ifdef 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..21e59da 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1011,7 +1011,9 @@ static void nfs_set_port(struct sockaddr *sap, int *port,
 static void nfs_validate_transport_protocol(struct nfs_parsed_mount_data *mnt)
 {
 	switch (mnt->nfs_server.protocol) {
+#ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
 	case XPRT_TRANSPORT_UDP:
+#endif
 	case XPRT_TRANSPORT_TCP:
 	case XPRT_TRANSPORT_RDMA:
 		break;
@@ -1033,8 +1035,10 @@ static void nfs_set_mount_transport_protocol(struct nfs_parsed_mount_data *mnt)
 			return;
 	switch (mnt->nfs_server.protocol) {
 	case XPRT_TRANSPORT_UDP:
+#ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
 		mnt->mount_server.protocol = XPRT_TRANSPORT_UDP;
 		break;
+#endif
 	case XPRT_TRANSPORT_TCP:
 	case XPRT_TRANSPORT_RDMA:
 		mnt->mount_server.protocol = XPRT_TRANSPORT_TCP;
@@ -2204,6 +2208,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;
 	}
-- 
1.8.3.1


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

* Re: [RFC PATCH] NFS: allow deprecation of NFS UDP protocol
  2019-11-08 21:32 [RFC PATCH] NFS: allow deprecation of NFS UDP protocol Olga Kornievskaia
@ 2019-11-18  9:46 ` Trond Myklebust
  2019-11-20 16:28   ` Olga Kornievskaia
  2019-11-18 18:42 ` Steve Dickson
  1 sibling, 1 reply; 5+ messages in thread
From: Trond Myklebust @ 2019-11-18  9:46 UTC (permalink / raw)
  To: anna.schumaker, olga.kornievskaia; +Cc: linux-nfs

Hi Olga

On Fri, 2019-11-08 at 16:32 -0500, Olga Kornievskaia wrote:
> From: Olga Kornievskaia <kolga@netapp.com>
> 
> Add a kernel config CONFIG_NFS_DISABLE_UDP_SUPPORT to disallow NFS
> UDP mounts.
> 
> I took the same approach as Chuck's deprecation of DES enc types
> to start with default to still allow but I think the ultimate
> goal is to disable
> 
> Question: how do we have folks trying this unless we set it to false?
> 
> Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> ---
>  fs/nfs/Kconfig  | 10 ++++++++++
>  fs/nfs/client.c |  4 ++++
>  fs/nfs/super.c  |  8 ++++++++
>  3 files changed, 22 insertions(+)
> 
> diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
> index 295a7a2..6320113 100644
> --- a/fs/nfs/Kconfig
> +++ b/fs/nfs/Kconfig
> @@ -196,3 +196,13 @@ 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 n
> +	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.
> +	  The default is N because many deployments still use UDP.
> diff --git a/fs/nfs/client.c b/fs/nfs/client.c
> index 02110a3..24ca314 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;
> +#ifdef 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;
> +#ifdef 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..21e59da 100644
> --- a/fs/nfs/super.c
> +++ b/fs/nfs/super.c
> @@ -1011,7 +1011,9 @@ static void nfs_set_port(struct sockaddr *sap,
> int *port,
>  static void nfs_validate_transport_protocol(struct
> nfs_parsed_mount_data *mnt)
>  {
>  	switch (mnt->nfs_server.protocol) {
> +#ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
>  	case XPRT_TRANSPORT_UDP:
> +#endif
>  	case XPRT_TRANSPORT_TCP:
>  	case XPRT_TRANSPORT_RDMA:
>  		break;
> @@ -1033,8 +1035,10 @@ static void
> nfs_set_mount_transport_protocol(struct nfs_parsed_mount_data *mnt)
>  			return;
>  	switch (mnt->nfs_server.protocol) {
>  	case XPRT_TRANSPORT_UDP:
> +#ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
>  		mnt->mount_server.protocol = XPRT_TRANSPORT_UDP;
>  		break;
> +#endif

Don't we want to return an error here rather than defaulting to the
TCP/RDMA behaviour?

>  	case XPRT_TRANSPORT_TCP:
>  	case XPRT_TRANSPORT_RDMA:
>  		mnt->mount_server.protocol = XPRT_TRANSPORT_TCP;
> @@ -2204,6 +2208,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;
>  	}
-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com



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

* Re: [RFC PATCH] NFS: allow deprecation of NFS UDP protocol
  2019-11-08 21:32 [RFC PATCH] NFS: allow deprecation of NFS UDP protocol Olga Kornievskaia
  2019-11-18  9:46 ` Trond Myklebust
@ 2019-11-18 18:42 ` Steve Dickson
  2019-11-20 16:31   ` Olga Kornievskaia
  1 sibling, 1 reply; 5+ messages in thread
From: Steve Dickson @ 2019-11-18 18:42 UTC (permalink / raw)
  To: Olga Kornievskaia, trond.myklebust, anna.schumaker; +Cc: linux-nfs



On 11/8/19 4:32 PM, Olga Kornievskaia wrote:
> From: Olga Kornievskaia <kolga@netapp.com>
> 
> Add a kernel config CONFIG_NFS_DISABLE_UDP_SUPPORT to disallow NFS
> UDP mounts.
> 
> I took the same approach as Chuck's deprecation of DES enc types
> to start with default to still allow but I think the ultimate
> goal is to disable
> 
> Question: how do we have folks trying this unless we set it to false?
Exactly... Why not do the opposite? Off by default... instead of
having to set the variable to turn UDP off?

steved.
 
> 
> Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> ---
>  fs/nfs/Kconfig  | 10 ++++++++++
>  fs/nfs/client.c |  4 ++++
>  fs/nfs/super.c  |  8 ++++++++
>  3 files changed, 22 insertions(+)
> 
> diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
> index 295a7a2..6320113 100644
> --- a/fs/nfs/Kconfig
> +++ b/fs/nfs/Kconfig
> @@ -196,3 +196,13 @@ 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 n
> +	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.
> +	  The default is N because many deployments still use UDP.
> diff --git a/fs/nfs/client.c b/fs/nfs/client.c
> index 02110a3..24ca314 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;
> +#ifdef 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;
> +#ifdef 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..21e59da 100644
> --- a/fs/nfs/super.c
> +++ b/fs/nfs/super.c
> @@ -1011,7 +1011,9 @@ static void nfs_set_port(struct sockaddr *sap, int *port,
>  static void nfs_validate_transport_protocol(struct nfs_parsed_mount_data *mnt)
>  {
>  	switch (mnt->nfs_server.protocol) {
> +#ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
>  	case XPRT_TRANSPORT_UDP:
> +#endif
>  	case XPRT_TRANSPORT_TCP:
>  	case XPRT_TRANSPORT_RDMA:
>  		break;
> @@ -1033,8 +1035,10 @@ static void nfs_set_mount_transport_protocol(struct nfs_parsed_mount_data *mnt)
>  			return;
>  	switch (mnt->nfs_server.protocol) {
>  	case XPRT_TRANSPORT_UDP:
> +#ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
>  		mnt->mount_server.protocol = XPRT_TRANSPORT_UDP;
>  		break;
> +#endif
>  	case XPRT_TRANSPORT_TCP:
>  	case XPRT_TRANSPORT_RDMA:
>  		mnt->mount_server.protocol = XPRT_TRANSPORT_TCP;
> @@ -2204,6 +2208,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;
>  	}
> 


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

* Re: [RFC PATCH] NFS: allow deprecation of NFS UDP protocol
  2019-11-18  9:46 ` Trond Myklebust
@ 2019-11-20 16:28   ` Olga Kornievskaia
  0 siblings, 0 replies; 5+ messages in thread
From: Olga Kornievskaia @ 2019-11-20 16:28 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: anna.schumaker, linux-nfs

Hi Trond,

On Mon, Nov 18, 2019 at 4:46 AM Trond Myklebust <trondmy@hammerspace.com> wrote:
>
> Hi Olga
>
> On Fri, 2019-11-08 at 16:32 -0500, Olga Kornievskaia wrote:
> > From: Olga Kornievskaia <kolga@netapp.com>
> >
> > Add a kernel config CONFIG_NFS_DISABLE_UDP_SUPPORT to disallow NFS
> > UDP mounts.
> >
> > I took the same approach as Chuck's deprecation of DES enc types
> > to start with default to still allow but I think the ultimate
> > goal is to disable
> >
> > Question: how do we have folks trying this unless we set it to false?
> >
> > Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> > ---
> >  fs/nfs/Kconfig  | 10 ++++++++++
> >  fs/nfs/client.c |  4 ++++
> >  fs/nfs/super.c  |  8 ++++++++
> >  3 files changed, 22 insertions(+)
> >
> > diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
> > index 295a7a2..6320113 100644
> > --- a/fs/nfs/Kconfig
> > +++ b/fs/nfs/Kconfig
> > @@ -196,3 +196,13 @@ 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 n
> > +     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.
> > +       The default is N because many deployments still use UDP.
> > diff --git a/fs/nfs/client.c b/fs/nfs/client.c
> > index 02110a3..24ca314 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;
> > +#ifdef 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;
> > +#ifdef 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..21e59da 100644
> > --- a/fs/nfs/super.c
> > +++ b/fs/nfs/super.c
> > @@ -1011,7 +1011,9 @@ static void nfs_set_port(struct sockaddr *sap,
> > int *port,
> >  static void nfs_validate_transport_protocol(struct
> > nfs_parsed_mount_data *mnt)
> >  {
> >       switch (mnt->nfs_server.protocol) {
> > +#ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
> >       case XPRT_TRANSPORT_UDP:
> > +#endif
> >       case XPRT_TRANSPORT_TCP:
> >       case XPRT_TRANSPORT_RDMA:
> >               break;
> > @@ -1033,8 +1035,10 @@ static void
> > nfs_set_mount_transport_protocol(struct nfs_parsed_mount_data *mnt)
> >                       return;
> >       switch (mnt->nfs_server.protocol) {
> >       case XPRT_TRANSPORT_UDP:
> > +#ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
> >               mnt->mount_server.protocol = XPRT_TRANSPORT_UDP;
> >               break;
> > +#endif
>
> Don't we want to return an error here rather than defaulting to the
> TCP/RDMA behaviour?

Actually what I have here is incorrect then because I had things
silently going to TCP instead. Because
nfs_validate_transport_protocol() will set it to TCP so I think
either I change nfs_validate_transport_protocol() and
nfs_set_mount_transport_protocol() to return errors if UDP is
specified or I just leave it as is just have one chunk (below) that
checks the protocol and fails when it's UDP. Do you want less code
change or more explicit failures for UDP?


>
> >       case XPRT_TRANSPORT_TCP:
> >       case XPRT_TRANSPORT_RDMA:
> >               mnt->mount_server.protocol = XPRT_TRANSPORT_TCP;
> > @@ -2204,6 +2208,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;
> >       }
> --
> Trond Myklebust
> Linux NFS client maintainer, Hammerspace
> trond.myklebust@hammerspace.com
>
>

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

* Re: [RFC PATCH] NFS: allow deprecation of NFS UDP protocol
  2019-11-18 18:42 ` Steve Dickson
@ 2019-11-20 16:31   ` Olga Kornievskaia
  0 siblings, 0 replies; 5+ messages in thread
From: Olga Kornievskaia @ 2019-11-20 16:31 UTC (permalink / raw)
  To: Steve Dickson; +Cc: Trond Myklebust, Anna Schumaker, linux-nfs

On Mon, Nov 18, 2019 at 1:42 PM Steve Dickson <SteveD@redhat.com> wrote:
>
>
>
> On 11/8/19 4:32 PM, Olga Kornievskaia wrote:
> > From: Olga Kornievskaia <kolga@netapp.com>
> >
> > Add a kernel config CONFIG_NFS_DISABLE_UDP_SUPPORT to disallow NFS
> > UDP mounts.
> >
> > I took the same approach as Chuck's deprecation of DES enc types
> > to start with default to still allow but I think the ultimate
> > goal is to disable
> >
> > Question: how do we have folks trying this unless we set it to false?
> Exactly... Why not do the opposite? Off by default... instead of
> having to set the variable to turn UDP off?

OK! v2 will turn this off by default instead.

>
> steved.
>
> >
> > Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> > ---
> >  fs/nfs/Kconfig  | 10 ++++++++++
> >  fs/nfs/client.c |  4 ++++
> >  fs/nfs/super.c  |  8 ++++++++
> >  3 files changed, 22 insertions(+)
> >
> > diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
> > index 295a7a2..6320113 100644
> > --- a/fs/nfs/Kconfig
> > +++ b/fs/nfs/Kconfig
> > @@ -196,3 +196,13 @@ 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 n
> > +     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.
> > +       The default is N because many deployments still use UDP.
> > diff --git a/fs/nfs/client.c b/fs/nfs/client.c
> > index 02110a3..24ca314 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;
> > +#ifdef 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;
> > +#ifdef 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..21e59da 100644
> > --- a/fs/nfs/super.c
> > +++ b/fs/nfs/super.c
> > @@ -1011,7 +1011,9 @@ static void nfs_set_port(struct sockaddr *sap, int *port,
> >  static void nfs_validate_transport_protocol(struct nfs_parsed_mount_data *mnt)
> >  {
> >       switch (mnt->nfs_server.protocol) {
> > +#ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
> >       case XPRT_TRANSPORT_UDP:
> > +#endif
> >       case XPRT_TRANSPORT_TCP:
> >       case XPRT_TRANSPORT_RDMA:
> >               break;
> > @@ -1033,8 +1035,10 @@ static void nfs_set_mount_transport_protocol(struct nfs_parsed_mount_data *mnt)
> >                       return;
> >       switch (mnt->nfs_server.protocol) {
> >       case XPRT_TRANSPORT_UDP:
> > +#ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
> >               mnt->mount_server.protocol = XPRT_TRANSPORT_UDP;
> >               break;
> > +#endif
> >       case XPRT_TRANSPORT_TCP:
> >       case XPRT_TRANSPORT_RDMA:
> >               mnt->mount_server.protocol = XPRT_TRANSPORT_TCP;
> > @@ -2204,6 +2208,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;
> >       }
> >
>

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

end of thread, other threads:[~2019-11-20 16:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-08 21:32 [RFC PATCH] NFS: allow deprecation of NFS UDP protocol Olga Kornievskaia
2019-11-18  9:46 ` Trond Myklebust
2019-11-20 16:28   ` Olga Kornievskaia
2019-11-18 18:42 ` Steve Dickson
2019-11-20 16:31   ` Olga Kornievskaia

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).