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: silently fails when bad option values are given
Date: Thu, 03 Jun 2010 10:04:25 -0400	[thread overview]
Message-ID: <4C07B669.2040300@oracle.com> (raw)
In-Reply-To: <1275570134-24864-2-git-send-email-steved@redhat.com>

On 06/ 3/10 09:02 AM, Steve Dickson wrote:
> mount.nfs should not only fail when an invalid option values
> are supplied (as it does), it should also print a diagnostic
> message identifying the problem
>
> Signed-off-by: Steve Dickson<steved@redhat.com>
> ---
>   utils/mount/network.c   |   20 ++++++++++++++++++--
>   utils/mount/nfsumount.c |    4 +---
>   2 files changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/utils/mount/network.c b/utils/mount/network.c
> index c541257..d9903ed 100644
> --- a/utils/mount/network.c
> +++ b/utils/mount/network.c
> @@ -1212,6 +1212,8 @@ nfs_nfs_program(struct mount_options *options, unsigned long *program)
>   			return 1;
>   		}

Another missed fall-through.

>   	case PO_BAD_VALUE:
> +		nfs_error(_("%s: invalid value for 'nfsprog=' option"),
> +				progname);
>   		return 0;
>   	}
>
> @@ -1251,9 +1253,12 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)
>   			}
>   			return 0;
>   		case PO_NOT_FOUND:
> -			nfs_error(_("%s: option parsing error\n"),
> +			nfs_error(_("%s: parsing error on 'vers=' option\n"),
>   					progname);
> +			return 0;
>   		case PO_BAD_VALUE:
> +			nfs_error(_("%s: invalid value for 'vers=' option"),
> +					progname);
>   			return 0;
>   		}

What I meant before is that, with this new code, this error diagnostic 
is displayed for "vers=booger" but not for "vers=12".  I think it should 
be displayed in both cases.

>   	case 4: /* nfsvers */
> @@ -1265,9 +1270,12 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)
>   			}
>   			return 0;
>   		case PO_NOT_FOUND:
> -			nfs_error(_("%s: option parsing error\n"),
> +			nfs_error(_("%s: parsing error on 'nfsvers=' option\n"),
>   					progname);
> +			return 0;
>   		case PO_BAD_VALUE:
> +			nfs_error(_("%s: invalid value for 'nfsvers=' option"),
> +					progname);
>   			return 0;
>   		}
>   	}
> @@ -1336,6 +1344,8 @@ nfs_nfs_port(struct mount_options *options, unsigned long *port)
>   			return 1;
>   		}

Another missed fall-through.

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

And here, an error diagnostic is displayed for "port=crikey" but not for 
"port=-17".

> @@ -1423,6 +1433,8 @@ nfs_mount_program(struct mount_options *options, unsigned long *program)
>   			return 1;
>   		}

Another missed fall-through.

>   	case PO_BAD_VALUE:
> +		nfs_error(_("%s: invalid value for 'mountprog=' option"),
> +				progname);
>   		return 0;
>   	}
>
> @@ -1452,6 +1464,8 @@ nfs_mount_version(struct mount_options *options, unsigned long *version)
>   			return 1;
>   		}

Ditto.

>   	case PO_BAD_VALUE:
> +		nfs_error(_("%s: invalid value for 'mountvers=' option"),
> +				progname);
>   		return 0;
>   	}
>
> @@ -1510,6 +1524,8 @@ nfs_mount_port(struct mount_options *options, unsigned long *port)
>   			return 1;
>   		}

Ditto.

>   	case PO_BAD_VALUE:
> +		nfs_error(_("%s: invalid value for 'mountport=' option"),
> +				progname);
>   		return 0;
>   	}
>
> diff --git a/utils/mount/nfsumount.c b/utils/mount/nfsumount.c
> index 9d798a2..1514340 100644
> --- a/utils/mount/nfsumount.c
> +++ b/utils/mount/nfsumount.c
> @@ -179,10 +179,8 @@ static int nfs_umount_do_umnt(struct mount_options *options,
>   	struct pmap nfs_pmap, mnt_pmap;
>   	sa_family_t family;
>
> -	if (!nfs_options2pmap(options,&nfs_pmap,&mnt_pmap)) {
> -		nfs_error(_("%s: bad mount options"), progname);
> +	if (!nfs_options2pmap(options,&nfs_pmap,&mnt_pmap))
>   		return EX_FAIL;
> -	}
>
>   	/* Skip UMNT call for vers=4 mounts */
>   	if (nfs_pmap.pm_vers == 4)


  reply	other threads:[~2010-06-03 14:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-03 13:02 [PATCH 0/2] mountd.nfs: Better error diagnostics for the mount command (take 2) Steve Dickson
2010-06-03 13:02 ` [PATCH 1/2] mount: silently fails when bad option values are given Steve Dickson
2010-06-03 14:04   ` Chuck Lever [this message]
2010-06-03 14:36     ` Steve Dickson
     [not found]       ` <4C07BE09.3060602-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2010-06-03 15:55         ` Chuck Lever
2010-06-03 16:32           ` Steve Dickson
     [not found]             ` <4C07D922.7030302-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2010-06-03 17:38               ` Chuck Lever
2010-06-03 18:18                 ` Steve Dickson
2010-06-03 13:02 ` [PATCH 2/2] mount.nfs: silently fails when the network protocol is not found Steve Dickson
2010-06-03 14:13   ` Chuck Lever
2010-06-03 16:42     ` Steve Dickson
  -- strict thread matches above, loose matches on Subject: below --
2010-06-03 16:51 [PATCH 0/2] mountd.nfs: Better error diagnostics for the mount command (take 3) Steve Dickson
2010-06-03 16:51 ` [PATCH 1/2] mount: silently fails when bad option values are given 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=4C07B669.2040300@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).