From patchwork Fri Jan 17 15:48:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 11339493 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 34D5E92A for ; Fri, 17 Jan 2020 15:48:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 131562072E for ; Fri, 17 Jan 2020 15:48:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y8YR04hg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728780AbgAQPsb (ORCPT ); Fri, 17 Jan 2020 10:48:31 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:26876 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727043AbgAQPsb (ORCPT ); Fri, 17 Jan 2020 10:48:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579276110; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LdBL2slNDE/rtW+Xz9P92Zb9qLwhk6nZyC6cAzxgr5o=; b=Y8YR04hg2FUmh0mqjYstEsAciQoVoVmuL0MACefVXKxFdte8A56zf75Ji+5sXeSUR9hOVx km3YwX0iQ6fl+hOGMwHuLcWj3ay8gau+elEU/pZR0vlgwG6P6sMO+MIx1oTwzh3eQjLP9Y NAB9ywFxlKY9Bd6k5qFSo1C9vjd9xro= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-411-IabzsO5JOFearTadoPmb8Q-1; Fri, 17 Jan 2020 10:48:27 -0500 X-MC-Unique: IabzsO5JOFearTadoPmb8Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 37B94107BAAB; Fri, 17 Jan 2020 15:48:26 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-49.rdu2.redhat.com [10.10.120.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0AFC3101F942; Fri, 17 Jan 2020 15:48:23 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20200117144055.GB3215@pi3> References: <20200117144055.GB3215@pi3> <433863.1579270803@warthog.procyon.org.uk> To: Krzysztof Kozlowski Cc: dhowells@redhat.com, Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org, "linux-kernel@vger.kernel.org" , Al Viro , Scott Mayhew , Arnd Bergmann Subject: [PATCH] nfs: Return EINVAL rather than ERANGE for mount parse errors MIME-Version: 1.0 Content-ID: <464518.1579276102.1@warthog.procyon.org.uk> Date: Fri, 17 Jan 2020 15:48:22 +0000 Message-ID: <464519.1579276102@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hi Krzysztof, Does this patch fix the problem? David --- commit 3021f58ee1e2c9659e629d0ccf06d3e0876e805a Author: David Howells Date: Fri Jan 17 15:37:46 2020 +0000 nfs: Return EINVAL rather than ERANGE for mount parse errors Return EINVAL rather than ERANGE for mount parse errors as the userspace mount command doesn't necessarily understand what to do with anything other than EINVAL. The old code returned -ERANGE as an intermediate error that then get converted to -EINVAL, whereas the new code returns -ERANGE. This was induced by passing minorversion=1 to a v4 mount where CONFIG_NFS_V4_1 was disabled in the kernel build. Fixes: 68f65ef40e1e ("NFS: Convert mount option parsing to use functionality from fs_parser.h") Reported-by: Krzysztof Kozlowski Signed-off-by: David Howells diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c index 429315c011ae..07cbd655dafb 100644 --- a/fs/nfs/fs_context.c +++ b/fs/nfs/fs_context.c @@ -770,7 +770,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc, return nfs_invalf(fc, "NFS: Bad IP address specified"); out_of_bounds: nfs_invalf(fc, "NFS: Value for '%s' out of range", param->key); - return -ERANGE; + return -EINVAL; } /*