From patchwork Fri Apr 12 16:05:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 2437171 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B08183FD40 for ; Fri, 12 Apr 2013 16:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753756Ab3DLQ6K (ORCPT ); Fri, 12 Apr 2013 12:58:10 -0400 Received: from 183.141.211.66.inaddr.G4.NET ([66.211.141.183]:36468 "EHLO Dobby.4dicksons.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752997Ab3DLQ6K (ORCPT ); Fri, 12 Apr 2013 12:58:10 -0400 X-Greylist: delayed 3151 seconds by postgrey-1.27 at vger.kernel.org; Fri, 12 Apr 2013 12:58:09 EDT Received: from tophat.home.4dicksons.org ([192.168.62.20]) by Dobby.4dicksons.org with esmtp (Exim 4.63) (envelope-from ) id 1UQgTp-00032f-JW for linux-nfs@vger.kernel.org; Fri, 12 Apr 2013 12:05:38 -0400 From: Steve Dickson To: Linux NFS Mailing List Subject: [PATCH] mount: No longer negotiate to v2 Date: Fri, 12 Apr 2013 12:05:36 -0400 Message-Id: <1365782736-9764-2-git-send-email-steved@redhat.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1365782736-9764-1-git-send-email-steved@redhat.com> References: <1365782736-9764-1-git-send-email-steved@redhat.com> X-Spam-Score: -2.9 (--) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This patch remove the ability of negotiating to the v2 protocol. Explicitly setting the version on the command line will be the only way to use v2. Signed-off-by: Steve Dickson --- utils/mount/network.c | 13 +++++-------- utils/mount/stropts.c | 2 ++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/utils/mount/network.c b/utils/mount/network.c index e7bd522..4be48cd 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -155,9 +155,8 @@ static const unsigned long probe_nfs2_only[] = { 0, }; -static const unsigned long probe_nfs3_first[] = { +static const unsigned long probe_nfs3_only[] = { 3, - 2, 0, }; @@ -167,10 +166,8 @@ static const unsigned long probe_mnt1_first[] = { 0, }; -static const unsigned long probe_mnt3_first[] = { +static const unsigned long probe_mnt3_only[] = { 3, - 1, - 2, 0, }; @@ -626,7 +623,7 @@ static int nfs_probe_nfsport(const struct sockaddr *sap, const socklen_t salen, probe_proto = nfs_default_proto(); return nfs_probe_port(sap, salen, pmap, - probe_nfs3_first, probe_proto); + probe_nfs3_only, probe_proto); } else return nfs_probe_port(sap, salen, pmap, probe_nfs2_only, probe_udp_only); @@ -653,7 +650,7 @@ static int nfs_probe_mntport(const struct sockaddr *sap, const socklen_t salen, if (nfs_mount_data_version >= 4) return nfs_probe_port(sap, salen, pmap, - probe_mnt3_first, probe_udp_first); + probe_mnt3_only, probe_udp_first); else return nfs_probe_port(sap, salen, pmap, probe_mnt1_first, probe_udp_only); @@ -717,7 +714,7 @@ int nfs_probe_bothports(const struct sockaddr *mnt_saddr, memcpy(&save_nfs, nfs_pmap, sizeof(save_nfs)); memcpy(&save_mnt, mnt_pmap, sizeof(save_mnt)); probe_vers = (nfs_mount_data_version >= 4) ? - probe_mnt3_first : probe_mnt1_first; + probe_mnt3_only : probe_mnt1_first; for (; *probe_vers; probe_vers++) { nfs_pmap->pm_vers = mntvers_to_nfs(*probe_vers); diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 8ee3024..1dc38ef 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -542,6 +542,8 @@ nfs_rewrite_pmap_mount_options(struct mount_options *options) errno = EACCES; else if (rpc_createerr.cf_stat == RPC_TIMEDOUT) errno = ETIMEDOUT; + else if (rpc_createerr.cf_stat == RPC_PROGVERSMISMATCH) + errno = EPROTONOSUPPORT; else if (rpc_createerr.cf_error.re_errno != 0) errno = rpc_createerr.cf_error.re_errno; return 0;