From patchwork Wed Nov 13 15:14:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weston Andros Adamson X-Patchwork-Id: 3178601 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 67E80C045B for ; Wed, 13 Nov 2013 15:14:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C0BC120222 for ; Wed, 13 Nov 2013 15:14:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8D8E120119 for ; Wed, 13 Nov 2013 15:14:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758659Ab3KMPO1 (ORCPT ); Wed, 13 Nov 2013 10:14:27 -0500 Received: from mx11.netapp.com ([216.240.18.76]:28134 "EHLO mx11.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757352Ab3KMPO1 (ORCPT ); Wed, 13 Nov 2013 10:14:27 -0500 X-IronPort-AV: E=Sophos;i="4.93,693,1378882800"; d="scan'208";a="74567822" Received: from vmwexceht04-prd.hq.netapp.com ([10.106.77.34]) by mx11-out.netapp.com with ESMTP; 13 Nov 2013 07:14:26 -0800 Received: from smtp2.corp.netapp.com (10.57.159.114) by VMWEXCEHT04-PRD.hq.netapp.com (10.106.77.34) with Microsoft SMTP Server id 14.3.123.3; Wed, 13 Nov 2013 07:14:26 -0800 Received: from vpn2ntap-18565.vpn.netapp.com (vpn2ntap-18565.vpn.netapp.com [10.55.75.144]) by smtp2.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id rADFEPHa026834; Wed, 13 Nov 2013 07:14:25 -0800 (PST) From: Weston Andros Adamson To: CC: , Weston Andros Adamson Subject: [PATCH] mount.nfs: Recognize v4.x mount options Date: Wed, 13 Nov 2013 10:14:22 -0500 Message-ID: <1384355662-70913-1-git-send-email-dros@netapp.com> X-Mailer: git-send-email 1.8.3.1 (Apple Git-46) MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The kernel understands text options of the form "v4.x" (ie "v4.1"), but mount.nfs does not and this leads to weird errors when the requested mount fails: a line in dmesg about version 3 not supporting minorversions and mount.nfs returning EINVAL no matter what the real error was. This happens because mount.nfs thinks no version was specified so it starts probing other versions which conflicts with the v4.X option once it gets parsed by the kernel. $ sudo mount -v -o v4.1 zero:/invalid_export /mnt mount.nfs: timeout set for Wed Nov 13 10:09:48 2013 mount.nfs: trying text-based options 'v4.1,vers=4,addr=192.168.100.10,clientaddr=192.168.100.11' mount.nfs: mount(2): No such file or directory mount.nfs: trying text-based options 'v4.1,addr=192.168.100.10' mount.nfs: prog 100003, trying vers=3, prot=6 mount.nfs: trying 192.168.100.10 prog 100003 vers 3 prot TCP port 2049 mount.nfs: prog 100005, trying vers=3, prot=17 mount.nfs: trying 192.168.100.10 prog 100005 vers 3 prot UDP port 20048 mount.nfs: mount(2): Invalid argument mount.nfs: an incorrect mount option was specified And you get this in dmesg: NFS: mount option vers=3 does not support minorversion=1 but if you use another form of the same options, this doesn't happen: $ sudo mount -v -o vers=4,minorversion=1 zero:/invalid_export /mnt mount.nfs: timeout set for Wed Nov 13 10:10:28 2013 mount.nfs: trying text-based options 'vers=4,minorversion=1,addr=192.168.100.10,clientaddr=192.168.100.11' mount.nfs: mount(2): No such file or directory mount.nfs: mounting zero:/invalid_export failed, reason given by server: No such file or directory Signed-off-by: Weston Andros Adamson Acked-by: Chuck Lever --- utils/mount/network.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/utils/mount/network.c b/utils/mount/network.c index e8e55a5..2853d00 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -92,6 +92,9 @@ static const char *nfs_version_opttbl[] = { "v4", "vers", "nfsvers", + "v4.0", + "v4.1", + "v4.2", NULL, }; @@ -1269,6 +1272,11 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version) progname); return 0; } + case 5: /* v4.0 */ + case 6: /* v4.1 */ + case 7: /* v4.2 */ + *version = 4; + return 1; } /*