From patchwork Wed Dec 8 16:30:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 12664761 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EC78C433FE for ; Wed, 8 Dec 2021 16:31:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236972AbhLHQed (ORCPT ); Wed, 8 Dec 2021 11:34:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24346 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236960AbhLHQed (ORCPT ); Wed, 8 Dec 2021 11:34:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638981060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9bIx0Q3iBNKWJj2cLrtduTOqXLir4GsCceMH1L6xJFY=; b=efupJbIKgCN4Buhw28bob6R2n2SHAemKDsEmxZN7pZRB5gvqnZzCuHS+wyPzFgjKu85j6W CGKMXnQxKSI6RohCKEj9cuvaq5SnNUosWssigupHnmAdC0gB8FM1qPgNZvMu3VrpsceXh1 4aOHnb5IasEInJizTzxwS556U6Nbc8s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-494-j-tEjJLTMwKdIQ-vXRT0xg-1; Wed, 08 Dec 2021 11:30:59 -0500 X-MC-Unique: j-tEjJLTMwKdIQ-vXRT0xg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A883481E238 for ; Wed, 8 Dec 2021 16:30:58 +0000 (UTC) Received: from dobby.home.dicksonnet.net (unknown [10.2.16.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C1752B178 for ; Wed, 8 Dec 2021 16:30:58 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 1/3] nfsd: Remove the ability to enable NFS v2. Date: Wed, 8 Dec 2021 11:30:55 -0500 Message-Id: <20211208163057.954500-2-steved@redhat.com> In-Reply-To: <20211208163057.954500-1-steved@redhat.com> References: <20211208163057.954500-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Signed-off-by: Steve Dickson --- nfs.conf | 1 - utils/nfsd/nfsd.c | 2 -- utils/nfsd/nfsd.man | 4 ++-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/nfs.conf b/nfs.conf index 8c714ff7..21d3e7b2 100644 --- a/nfs.conf +++ b/nfs.conf @@ -68,7 +68,6 @@ # lease-time=90 # udp=n # tcp=y -# vers2=n # vers3=y # vers4=y # vers4.0=y diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c index b0741718..4016a761 100644 --- a/utils/nfsd/nfsd.c +++ b/utils/nfsd/nfsd.c @@ -226,7 +226,6 @@ main(int argc, char **argv) } /* FALLTHRU */ case 3: - case 2: NFSCTL_VERUNSET(versbits, c); break; default: @@ -251,7 +250,6 @@ main(int argc, char **argv) minorvers = minorversset = minormask; /* FALLTHRU */ case 3: - case 2: NFSCTL_VERSET(versbits, c); break; default: diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man index 2701ba78..716f538b 100644 --- a/utils/nfsd/nfsd.man +++ b/utils/nfsd/nfsd.man @@ -57,7 +57,7 @@ This option can be used to request that .B rpc.nfsd does not offer certain versions of NFS. The current version of .B rpc.nfsd -can support major NFS versions 2,3,4 and the minor versions 4.0, 4.1 and 4.2. +can support major NFS versions 3,4 and the minor versions 4.0, 4.1 and 4.2. .TP .B \-s " or " \-\-syslog By default, @@ -84,7 +84,7 @@ This option can be used to request that .B rpc.nfsd offer certain versions of NFS. The current version of .B rpc.nfsd -can support major NFS versions 2,3,4 and the minor versions 4.0, 4.1 and 4.2. +can support major NFS versions 3,4 and the minor versions 4.0, 4.1 and 4.2. .TP .B \-L " or " \-\-lease-time seconds Set the lease-time used for NFSv4. This corresponds to how often From patchwork Wed Dec 8 16:30:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 12664763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86133C433F5 for ; Wed, 8 Dec 2021 16:31:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236960AbhLHQed (ORCPT ); Wed, 8 Dec 2021 11:34:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36024 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234361AbhLHQed (ORCPT ); Wed, 8 Dec 2021 11:34:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638981061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sBgSlszn2LBtYiF++zGChTSxau/bOicc0H3QN6KbH+Y=; b=Z/fxPXBRvE26Mx/Nfm/FyWqCQuutT0Kb/3XW+M6QJ9/TUZJ9akm5JUeKiY7vO3eEJjIIJU cshQ/vWHF8QhPU3oDKfpvp5FulR3vCR7eWU1y0BJPYQnNBBCmrWWF0c9OFTVHr2vsaw/pp k8FCilugDzK/gcy6wzeXCJQ2QlRoqAg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-246-D-uE8N7zNL-j__ZanZkCaQ-1; Wed, 08 Dec 2021 11:30:59 -0500 X-MC-Unique: D-uE8N7zNL-j__ZanZkCaQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 29262801AAB for ; Wed, 8 Dec 2021 16:30:59 +0000 (UTC) Received: from dobby.home.dicksonnet.net (unknown [10.2.16.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id D30902B178 for ; Wed, 8 Dec 2021 16:30:58 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 2/3] nfs.man: Remove references to NFS v2 from the man pages Date: Wed, 8 Dec 2021 11:30:56 -0500 Message-Id: <20211208163057.954500-3-steved@redhat.com> In-Reply-To: <20211208163057.954500-1-steved@redhat.com> References: <20211208163057.954500-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Signed-off-by: Steve Dickson --- utils/mount/mount.nfs.man | 2 +- utils/mount/nfs.man | 20 +++----------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/utils/mount/mount.nfs.man b/utils/mount/mount.nfs.man index 0409c96f..a78a3b0d 100644 --- a/utils/mount/mount.nfs.man +++ b/utils/mount/mount.nfs.man @@ -27,7 +27,7 @@ can mount all NFS file system versions. Under earlier Linux kernel versions, .BR mount.nfs4 must be used for mounting NFSv4 file systems while .BR mount.nfs -must be used for NFSv3 and v2. +must be used for NFSv3. .SH OPTIONS .TP diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man index 57a693fd..d9f34df3 100644 --- a/utils/mount/nfs.man +++ b/utils/mount/nfs.man @@ -12,7 +12,7 @@ created by Sun Microsystems in 1984. NFS was developed to allow file sharing between systems residing on a local area network. Depending on kernel configuration, the Linux NFS client may -support NFS versions 2, 3, 4.0, 4.1, or 4.2. +support NFS versions 3, 4.0, 4.1, or 4.2. .P The .BR mount (8) @@ -954,11 +954,6 @@ file. See .BR nfsmount.conf(5) for details. .SH EXAMPLES -To mount an export using NFS version 2, -use the -.B nfs -file system type and specify the -.B nfsvers=2 mount option. To mount using NFS version 3, use the @@ -985,13 +980,6 @@ reasonable defaults for NFS behavior. server:/export /mnt nfs defaults 0 0 .fi .P -Here is an example from an /etc/fstab file for an NFS version 2 mount over UDP. -.P -.nf -.ta 8n +16n +6n +6n +30n - server:/export /mnt nfs nfsvers=2,proto=udp 0 0 -.fi -.P This example shows how to mount using NFS version 4 over TCP with Kerberos 5 mutual authentication. .P @@ -1084,7 +1072,7 @@ and can safely be allowed to default to the largest values supported by both client and server, independent of the network's MTU size. .SS "Using the mountproto mount option" -This section applies only to NFS version 2 and version 3 mounts +This section applies only to NFS version 3 mounts since NFS version 4 does not use a separate protocol for mount requests. .P @@ -1487,7 +1475,7 @@ the use of the mount option. .SS "Using file locks with NFS" The Network Lock Manager protocol is a separate sideband protocol -used to manage file locks in NFS version 2 and version 3. +used to manage file locks in NFS version 3. To support lock recovery after a client or server reboot, a second sideband protocol -- known as the Network Status Manager protocol -- @@ -1907,8 +1895,6 @@ RFC 768 for the UDP specification. .br RFC 793 for the TCP specification. .br -RFC 1094 for the NFS version 2 specification. -.br RFC 1813 for the NFS version 3 specification. .br RFC 1832 for the XDR specification. From patchwork Wed Dec 8 16:30:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 12664765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D2DDC4332F for ; Wed, 8 Dec 2021 16:31:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236975AbhLHQee (ORCPT ); Wed, 8 Dec 2021 11:34:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:51400 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234361AbhLHQee (ORCPT ); Wed, 8 Dec 2021 11:34:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638981061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zWtfFMhV8ZlHb4H7iomk7wEI0G6PB/8hi+1UIFEVvD4=; b=hs9GZudWXfgu+4B+Z1Ii4tDwqgd1gpo7DT+k24t26q4NbvVVq1okLGXwbVETjSy3p9HKaH B8NUOYDEid1CPhS6fe140Eu/ieiD2rN0PjBtcMPJ+ze31Y2slc7QKZX3O792jRNcAoGqPY htuqX3Aj/f4KsjB/rj9xFq51V0BXM94= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-285-F3XaE0U5PrC762keywDi4g-1; Wed, 08 Dec 2021 11:31:00 -0500 X-MC-Unique: F3XaE0U5PrC762keywDi4g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A07591014B4E for ; Wed, 8 Dec 2021 16:30:59 +0000 (UTC) Received: from dobby.home.dicksonnet.net (unknown [10.2.16.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 554652B178 for ; Wed, 8 Dec 2021 16:30:59 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH v2 3/3] mount: Remove NFS v2 support from mount.nfs Date: Wed, 8 Dec 2021 11:30:57 -0500 Message-Id: <20211208163057.954500-4-steved@redhat.com> In-Reply-To: <20211208163057.954500-1-steved@redhat.com> References: <20211208163057.954500-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This patch removes the ability to do NFS v2 mounts. They will now fail with EOPNOTSUPP. Signed-off-by: Steve Dickson --- utils/mount/configfile.c | 2 +- utils/mount/network.c | 4 ++-- utils/mount/nfsmount.conf | 2 +- utils/mount/stropts.c | 10 +++++++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c index 3d3684ef..1d88cbfc 100644 --- a/utils/mount/configfile.c +++ b/utils/mount/configfile.c @@ -71,7 +71,7 @@ struct mnt_alias { int mnt_alias_sz = (sizeof(mnt_alias_tab)/sizeof(mnt_alias_tab[0])); static const char *version_keys[] = { - "v2", "v3", "v4", "vers", "nfsvers", "minorversion", NULL + "v3", "v4", "vers", "nfsvers", "minorversion", NULL }; static int strict; diff --git a/utils/mount/network.c b/utils/mount/network.c index 35261171..bfda5c41 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -97,7 +97,7 @@ static const char *nfs_transport_opttbl[] = { }; static const char *nfs_version_opttbl[] = { - "v2", + "v2", /* no longer supported */ "v3", "v4", "vers", @@ -1286,7 +1286,7 @@ nfs_nfs_version(char *type, struct mount_options *options, struct nfs_version *v else if (found < 0) return 1; else if (found <= 2 ) { - /* v2, v3, v4 */ + /* v3, v4 */ version_val = version_key + 1; version->v_mode = V_SPECIFIC; } else if (found > 2 ) { diff --git a/utils/mount/nfsmount.conf b/utils/mount/nfsmount.conf index 6bdc225a..342063f7 100644 --- a/utils/mount/nfsmount.conf +++ b/utils/mount/nfsmount.conf @@ -28,7 +28,7 @@ # This statically named section defines global mount # options that can be applied on all NFS mount. # -# Protocol Version [2,3,4] +# Protocol Version [3,4] # This defines the default protocol version which will # be used to start the negotiation with the server. # Defaultvers=4 diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index fa67a66f..3c4e218a 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -357,6 +357,7 @@ static int nfs_insert_sloppy_option(struct mount_options *options) static int nfs_set_version(struct nfsmount_info *mi) { + if (!nfs_nfs_version(mi->type, mi->options, &mi->version)) return 0; @@ -1016,7 +1017,6 @@ static int nfs_try_mount(struct nfsmount_info *mi) } switch (mi->version.major) { - case 2: case 3: result = nfs_try_mount_v3v2(mi, FALSE); break; @@ -1247,6 +1247,14 @@ static int nfsmount_start(struct nfsmount_info *mi) if (!nfs_validate_options(mi)) return EX_FAIL; + /* + * NFS v2 has been deprecated + */ + if (mi->version.major == 2) { + mount_error(mi->spec, mi->node, EOPNOTSUPP); + return EX_FAIL; + } + /* * Avoid retry and negotiation logic when remounting */