linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: Steve Dickson <steved@redhat.com>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH 1/2] mount.nfs: silently fails with bad version arguments
Date: Wed, 02 Jun 2010 17:34:41 -0400	[thread overview]
Message-ID: <4C06CE71.1020404@oracle.com> (raw)
In-Reply-To: <1275486084-23899-2-git-send-email-steved@redhat.com>

On 06/ 2/10 09:41 AM, Steve Dickson wrote:
> mount.nfs should not only fail when an invalid protocol
> option is used (as it does), it should also print a
> diagnostic identifying the problem.
>
> Signed-off-by: Steve Dickson<steved@redhat.com>
> ---
>   utils/mount/network.c |    4 ++++
>   1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/utils/mount/network.c b/utils/mount/network.c
> index c541257..de1014d 100644
> --- a/utils/mount/network.c
> +++ b/utils/mount/network.c
> @@ -1254,6 +1254,8 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)
>   			nfs_error(_("%s: option parsing error\n"),
>   					progname);

Watch out for case fall-through.  You need to add:

			return 0;

here.

>   		case PO_BAD_VALUE:
> +			nfs_error(_("%s: invalid value for 'vers=' option"),
> +					progname);
>   			return 0;
>   		}
>   	case 4: /* nfsvers */
> @@ -1268,6 +1270,8 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)
>   			nfs_error(_("%s: option parsing error\n"),
>   					progname);

Case fall-through here as well.

>   		case PO_BAD_VALUE:
> +			nfs_error(_("%s: invalid value for 'nfsvers=' option"),
> +					progname);

Why wouldn't you also print a diagnostic if a numeric value was used, 
but the value was out of range?

And, what about similar cases in nfs_nfs_port(), nfs_nfs_program(), 
nfs_mount_program(), nfs_mount_version(), and nfs_mount_port() ?

>   			return 0;
>   		}
>   	}


  reply	other threads:[~2010-06-02 21:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-02 13:41 [PATCH 0/2] mountd.nfs: Better error diagnostics for the mount command Steve Dickson
2010-06-02 13:41 ` [PATCH 1/2] mount.nfs: silently fails with bad version arguments Steve Dickson
2010-06-02 21:34   ` Chuck Lever [this message]
2010-06-03 12:11     ` Steve Dickson
     [not found]       ` <4C079BE8.5010509-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2010-06-03 12:32         ` Steve Dickson
2010-06-02 13:41 ` [PATCH 2/2] mount.nfs: silently fails when the network protocol is not found Steve Dickson
2010-06-02 21:34   ` Chuck Lever
2010-06-03 12:52     ` Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C06CE71.1020404@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).