From patchwork Fri Jun 9 06:20:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 9777283 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 5C03460393 for ; Fri, 9 Jun 2017 06:20:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D4BC28615 for ; Fri, 9 Jun 2017 06:20:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BA2728617; Fri, 9 Jun 2017 06:20:28 +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, T_TVD_MIME_EPI 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 40BE9285F7 for ; Fri, 9 Jun 2017 06:20:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751557AbdFIGU0 (ORCPT ); Fri, 9 Jun 2017 02:20:26 -0400 Received: from mx2.suse.de ([195.135.220.15]:47858 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751535AbdFIGU0 (ORCPT ); Fri, 9 Jun 2017 02:20:26 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 85A41AAB9; Fri, 9 Jun 2017 06:20:24 +0000 (UTC) From: NeilBrown To: Steve Dickson , Linux NFS Mailing list Date: Fri, 09 Jun 2017 16:20:17 +1000 Subject: Re: [PATCH V2] mount.nfs: Use default minor version when -t nfs4 is specified In-Reply-To: <20170608183314.15247-1-steved@redhat.com> References: <20170608183314.15247-1-steved@redhat.com> Message-ID: <87a85hadi6.fsf@notabene.neil.brown.name> MIME-Version: 1.0 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 On Thu, Jun 08 2017, Steve Dickson wrote: > When the nfs4 filesystem specified, the default major > and minor versions should be used. > > Signed-off-by: Steve Dickson Hi Steve, I think this is definitely heading in the right direction. I particularly like that you've #defined for the default major/minor. However as I reflected on it, I realised that "-o v4" needs to set the same version as "-t nfs4", and even with this patch it doesn't. I think we need to focus on nfs_default_version() and make sure it does the right thing. If v.mode == V_DEFAULT, we need to copy both 'major' and 'minor' from config_default_vers if they are set. If config_default_vers.v_mode == V_GENERAL, .minor won't be set so in that case we need to use NFS_DEFAULT_MINOR; If v.mode == V_GENERAL, then only copy the minor if it is set and the major is correct. So we need to check for V_SPECIFIC, and other wise use the default minor. If v.mode == V_SPECIFIC, nfs_default_version isn't called, so it doesn't matter. I think this gets it right... Thoughts? Thanks, NeilBrown diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index c0266e51ad1c..7dfdd9e62115 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -73,6 +73,13 @@ #define NFS_DEF_BG_TIMEOUT_MINUTES (10000u) #endif +#ifndef NFS_DEFAULT_MAJOR +#define NFS_DEFAULT_MAJOR 4 +#endif +#ifndef NFS_DEFAULT_MINOR +#define NFS_DEFAULT_MINOR 2 +#endif + extern int nfs_mount_data_version; extern char *progname; extern int verbose; @@ -110,22 +117,27 @@ static void nfs_default_version(struct nfsmount_info *mi) } if (mi->version.v_mode == V_DEFAULT && - config_default_vers.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.v_mode == V_SPECIFIC) + mi->version.minor = config_default_vers.minor; + else + mi->version.minor = NFS_DEFAULT_MINOR; return; } if (mi->version.v_mode == V_GENERAL) { - if (config_default_vers.v_mode != V_DEFAULT && + if (config_default_vers.v_mode == V_SPECIFIC && mi->version.major == config_default_vers.major) mi->version.minor = config_default_vers.minor; + else + mi->version.minor = NFS_DEFAULT_MINOR; return; } #endif /* MOUNT_CONFIG */ - mi->version.major = 4; - mi->version.minor = 2; + mi->version.major = NFS_DEFAULT_MAJOR; + mi->version.minor = NFS_DEFAULT_MINOR; } /*