From patchwork Thu Jun 27 19:54:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 2794821 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7A2B79F3C3 for ; Thu, 27 Jun 2013 19:54:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 565542015D for ; Thu, 27 Jun 2013 19:54:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F061A201B0 for ; Thu, 27 Jun 2013 19:54:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753809Ab3F0Tyw (ORCPT ); Thu, 27 Jun 2013 15:54:52 -0400 Received: from mail-yh0-f44.google.com ([209.85.213.44]:50715 "EHLO mail-yh0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753139Ab3F0Tyv (ORCPT ); Thu, 27 Jun 2013 15:54:51 -0400 Received: by mail-yh0-f44.google.com with SMTP id t59so646298yho.31 for ; Thu, 27 Jun 2013 12:54:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=5PT1tvjq49giR7bPKt7MDyj6uM81j27u6G0qBnmQJKg=; b=NrgV48p1bsGC81mGdNDCtTxBXGTJ6fZWdLX8jNfkF/1eAwUXAwgt3WxBbllOeGGCWc uON4ndmeD9yxb/T312w7MkzSHDJkxq/9CzQB9ztpRlitVShClcJ/ucoY4tLQxaaHq8Nv YglZdQmJPEzhHsgR3RIhNEpyC8OAeOhTFsNVXTFZ+TH1UDWngZdaOlUiqufaKhm3Iz1z 8xS5zqyWtfq4PWqRou1bgm3YGWqkCHGpEefutAbm6yDeTHVP/7hRbFFmRiGcq3IupnJZ gTFEyZKGaqk/SQorzw6BZ7tlzg3Mq32VvBcVzncul84N0ofWvWZoa+BnjhnX2cGwazCj 0BnA== X-Received: by 10.236.19.164 with SMTP id n24mr5572963yhn.92.1372362891038; Thu, 27 Jun 2013 12:54:51 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-107-015-124-230.nc.res.rr.com. [107.15.124.230]) by mx.google.com with ESMTPSA id r23sm6393842yhb.11.2013.06.27.12.54.49 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 27 Jun 2013 12:54:50 -0700 (PDT) From: Jeff Layton To: trond.myklebust@netapp.com Cc: linux-nfs@vger.kernel.org, chuck.lever@oracle.com, Weston.Adamson@netapp.com Subject: [PATCH v4 3/4] nfs: have nfs_mount fake up a auth_flavs list when the server didn't provide it Date: Thu, 27 Jun 2013 15:54:40 -0400 Message-Id: <1372362881-32282-4-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1372362881-32282-1-git-send-email-jlayton@redhat.com> References: <1372362881-32282-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQmB4vaokpMr0xjEy+b5k4fnEVWbOukqKtPDMYpNduyolDE1zuJKZKbBYG9vMK+Sa8l64gvz Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-8.2 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 Instead of handling this as a special case in the auth-selection code, we can simply fake up an auth_flavs list when the server doesn't provide it. Signed-off-by: Jeff Layton Reviewed-by: Chuck Lever --- fs/nfs/mount_clnt.c | 18 +++++++++++++++++- fs/nfs/super.c | 13 ------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c index 91a6faf..0f925f3 100644 --- a/fs/nfs/mount_clnt.c +++ b/fs/nfs/mount_clnt.c @@ -139,7 +139,10 @@ struct mnt_fhstatus { * nfs_mount - Obtain an NFS file handle for the given host and path * @info: pointer to mount request arguments * - * Uses default timeout parameters specified by underlying transport. + * Uses default timeout parameters specified by underlying transport. On + * successful return, the auth_flavs list and auth_flav_len will be populated + * with the list from the server or a faked-up list if the server didn't + * provide one. */ int nfs_mount(struct nfs_mount_request *info) { @@ -195,6 +198,19 @@ int nfs_mount(struct nfs_mount_request *info) dprintk("NFS: MNT request succeeded\n"); status = 0; + /* + * The NFSv2 MNT operation does not return a flavor list. Also, some + * NFSv3 servers (older Linux servers in particular) return an empty + * list. + * + * In that event fake up a list that just has RPC_AUTH_NULL in it since + * we have no way to know what the server actually supports. + */ + if (info->version != NFS_MNT3_VERSION || *info->auth_flav_len == 0) { + dprintk("NFS: Faking up auth_flavs list\n"); + info->auth_flavs[0] = RPC_AUTH_NULL; + *info->auth_flav_len = 1; + } out: return status; diff --git a/fs/nfs/super.c b/fs/nfs/super.c index a0949f5..ceb60c7 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -1620,19 +1620,6 @@ static int nfs_select_flavor(struct nfs_parsed_mount_data *args, rpc_authflavor_t flavor; /* - * The NFSv2 MNT operation does not return a flavor list. - */ - if (args->mount_server.version != NFS_MNT3_VERSION) - goto out_default; - - /* - * Certain releases of Linux's mountd return an empty - * flavor list in some cases. - */ - if (count == 0) - goto out_default; - - /* * If the sec= mount option is used, the specified flavor or AUTH_NULL * must be in the list returned by the server. *