From patchwork Tue Jun 13 17:31:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 9784443 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6AC5D6038E for ; Tue, 13 Jun 2017 17:31:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EC1828417 for ; Tue, 13 Jun 2017 17:31:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43B6528676; Tue, 13 Jun 2017 17:31:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9A162870D for ; Tue, 13 Jun 2017 17:31:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752452AbdFMRbO (ORCPT ); Tue, 13 Jun 2017 13:31:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54102 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752525AbdFMRbO (ORCPT ); Tue, 13 Jun 2017 13:31:14 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E5B8EC05FFCA for ; Tue, 13 Jun 2017 17:31:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E5B8EC05FFCA Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=steved@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E5B8EC05FFCA Received: from steved.boston.devel.redhat.com (steved.boston.devel.redhat.com [10.19.60.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2E208B7A5 for ; Tue, 13 Jun 2017 17:31:13 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 2/2 V2] mount.nfs: Use default minor version when -o v4 is specified Date: Tue, 13 Jun 2017 13:31:12 -0400 Message-Id: <20170613173112.8596-2-steved@redhat.com> In-Reply-To: <20170613173112.8596-1-steved@redhat.com> References: <20170613173112.8596-1-steved@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 13 Jun 2017 17:31:14 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When v4 is specified on the command line the default minor version needs to be used. Signed-off-by: Steve Dickson --- utils/mount/stropts.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) V2: Removed pointless check of v_mode in nfs_do_mount_v4() diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index fbea6fb..9330d42 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -119,14 +119,22 @@ static void nfs_default_version(struct nfsmount_info *mi) if (mi->version.v_mode == V_DEFAULT && config_default_vers.v_mode != V_DEFAULT) { mi->version.major = config_default_vers.major; - mi->version.minor = config_default_vers.minor; + if (config_default_vers.minor) + mi->version.minor = config_default_vers.minor; + else if (!mi->version.minor) + mi->version.minor = NFS_DEFAULT_MINOR; return; } if (mi->version.v_mode == V_GENERAL) { if (config_default_vers.v_mode != V_DEFAULT && - mi->version.major == config_default_vers.major) - mi->version.minor = config_default_vers.minor; + mi->version.major == config_default_vers.major) { + if (config_default_vers.minor) + mi->version.minor = config_default_vers.minor; + else if (!mi->version.minor) + mi->version.minor = NFS_DEFAULT_MINOR; + } else if (!mi->version.minor) + mi->version.minor = NFS_DEFAULT_MINOR; return; } @@ -741,13 +749,9 @@ static int nfs_do_mount_v4(struct nfsmount_info *mi, } if (mi->version.v_mode != V_SPECIFIC) { - if (mi->version.v_mode == V_GENERAL) - snprintf(version_opt, sizeof(version_opt) - 1, - "vers=%lu", mi->version.major); - else - snprintf(version_opt, sizeof(version_opt) - 1, - "vers=%lu.%lu", mi->version.major, - mi->version.minor); + snprintf(version_opt, sizeof(version_opt) - 1, + "vers=%lu.%lu", mi->version.major, + mi->version.minor); if (po_append(options, version_opt) == PO_FAILED) { errno = EINVAL;