linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] NFS: allow deprecation of NFS UDP protocol
@ 2019-11-21 16:06 Olga Kornievskaia
  2019-11-21 23:16 ` Calum Mackay
  2019-11-24  2:15 ` kbuild test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Olga Kornievskaia @ 2019-11-21 16:06 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  | 10 ++++++++++
 fs/nfs/client.c |  4 ++++
 fs/nfs/super.c  |  4 ++++
 3 files changed, 18 insertions(+)

diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
index 295a7a2..ba5a681 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 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.
+	  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..f68346d 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;
 	}
-- 
1.8.3.1


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

* Re: [PATCH v2] NFS: allow deprecation of NFS UDP protocol
  2019-11-21 16:06 [PATCH v2] NFS: allow deprecation of NFS UDP protocol Olga Kornievskaia
@ 2019-11-21 23:16 ` Calum Mackay
  2019-11-22 10:41   ` Petr Vorel
  2019-11-24  2:15 ` kbuild test robot
  1 sibling, 1 reply; 4+ messages in thread
From: Calum Mackay @ 2019-11-21 23:16 UTC (permalink / raw)
  To: Olga Kornievskaia, trond.myklebust, anna.schumaker
  Cc: Calum Mackay, linux-nfs

hi Olga,

On 21/11/2019 4:06 pm, Olga Kornievskaia wrote:
> 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  | 10 ++++++++++
>   fs/nfs/client.c |  4 ++++
>   fs/nfs/super.c  |  4 ++++
>   3 files changed, 18 insertions(+)
> 
> diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
> index 295a7a2..ba5a681 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 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.
> +	  The default is N because many deployments still use UDP.

You've changed the default to 'y' for v2, but you've left in the 'N' 
comment.


> 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

Should the first two of your added ifdefs be ifndefs?

cheers,
calum.

>   	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..f68346d 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;
>   	}
> 

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

* Re: [PATCH v2] NFS: allow deprecation of NFS UDP protocol
  2019-11-21 23:16 ` Calum Mackay
@ 2019-11-22 10:41   ` Petr Vorel
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2019-11-22 10:41 UTC (permalink / raw)
  To: Calum Mackay
  Cc: Olga Kornievskaia, trond.myklebust, anna.schumaker, linux-nfs

Hi Olga, Calum,

...
> > +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.
> > +	  The default is N because many deployments still use UDP.

> You've changed the default to 'y' for v2, but you've left in the 'N'
> comment.
+1

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

> Should the first two of your added ifdefs be ifndefs?
+1

...

Other changes LGTM.

Kind regards,
Petr

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

* Re: [PATCH v2] NFS: allow deprecation of NFS UDP protocol
  2019-11-21 16:06 [PATCH v2] NFS: allow deprecation of NFS UDP protocol Olga Kornievskaia
  2019-11-21 23:16 ` Calum Mackay
@ 2019-11-24  2:15 ` kbuild test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2019-11-24  2:15 UTC (permalink / raw)
  To: Olga Kornievskaia; +Cc: kbuild-all, trond.myklebust, anna.schumaker, linux-nfs

[-- Attachment #1: Type: text/plain, Size: 3184 bytes --]

Hi Olga,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on nfs/linux-next]
[also build test ERROR on v5.4-rc8 next-20191122]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Olga-Kornievskaia/NFS-allow-deprecation-of-NFS-UDP-protocol/20191124-074905
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: parisc-c3000_defconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=parisc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   fs/nfs/super.c: In function 'nfs_validate_text_mount_data':
>> fs/nfs/super.c:2209:4: error: label 'out_invalid_transport_udp' used but not defined
       goto out_invalid_transport_udp;
       ^~~~

vim +/out_invalid_transport_udp +2209 fs/nfs/super.c

  2174	
  2175	static int nfs_validate_text_mount_data(void *options,
  2176						struct nfs_parsed_mount_data *args,
  2177						const char *dev_name)
  2178	{
  2179		int port = 0;
  2180		int max_namelen = PAGE_SIZE;
  2181		int max_pathlen = NFS_MAXPATHLEN;
  2182		struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address;
  2183	
  2184		if (nfs_parse_mount_options((char *)options, args) == 0)
  2185			return -EINVAL;
  2186	
  2187		if (!nfs_verify_server_address(sap))
  2188			goto out_no_address;
  2189	
  2190		if (args->version == 4) {
  2191	#if IS_ENABLED(CONFIG_NFS_V4)
  2192			if (args->nfs_server.protocol == XPRT_TRANSPORT_RDMA)
  2193				port = NFS_RDMA_PORT;
  2194			else
  2195				port = NFS_PORT;
  2196			max_namelen = NFS4_MAXNAMLEN;
  2197			max_pathlen = NFS4_MAXPATHLEN;
  2198			nfs_validate_transport_protocol(args);
  2199			if (args->nfs_server.protocol == XPRT_TRANSPORT_UDP)
  2200				goto out_invalid_transport_udp;
  2201			nfs4_validate_mount_flags(args);
  2202	#else
  2203			goto out_v4_not_compiled;
  2204	#endif /* CONFIG_NFS_V4 */
  2205		} else {
  2206			nfs_set_mount_transport_protocol(args);
  2207	#ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
  2208			if (args->nfs_server.protocol == XPRT_TRANSPORT_UDP)
> 2209				goto out_invalid_transport_udp;
  2210	#endif
  2211			if (args->nfs_server.protocol == XPRT_TRANSPORT_RDMA)
  2212				port = NFS_RDMA_PORT;
  2213		}
  2214	
  2215		nfs_set_port(sap, &args->nfs_server.port, port);
  2216	
  2217		return nfs_parse_devname(dev_name,
  2218					   &args->nfs_server.hostname,
  2219					   max_namelen,
  2220					   &args->nfs_server.export_path,
  2221					   max_pathlen);
  2222	

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 15688 bytes --]

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-21 16:06 [PATCH v2] NFS: allow deprecation of NFS UDP protocol Olga Kornievskaia
2019-11-21 23:16 ` Calum Mackay
2019-11-22 10:41   ` Petr Vorel
2019-11-24  2:15 ` kbuild test robot

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