Linux NFS development
 help / color / mirror / Atom feed
From: Steve Dickson <steved@redhat.com>
To: NeilBrown <neilb@suse.de>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH nfs-utils] mount.nfs: always include mountpoint or spec if error messages.
Date: Wed, 5 Apr 2023 12:30:32 -0400	[thread overview]
Message-ID: <13fd348e-cf5a-8507-4ee6-5600de2d034d@redhat.com> (raw)
In-Reply-To: <167997198028.8106.1574926503489095936@noble.neil.brown.name>



On 3/27/23 10:53 PM, NeilBrown wrote:
> 
> If you try to mount from a server that is inaccessible you might get an
> error like:
>      mount.nfs: No route to host
> 
> This is OK when running "mount" interactively, but hardly useful when
> found in system logs.
> 
> This patch changes mount_error() to always included at least one of
> mount_point and spec in any error message.
> 
> Signed-off-by: NeilBrown <neilb@suse.de>
Committed... (tag: nfs-utils-2-6-3-rc7)

steved.
> ---
>   utils/mount/error.c | 31 ++++++++++++++++---------------
>   1 file changed, 16 insertions(+), 15 deletions(-)
> 
> diff --git a/utils/mount/error.c b/utils/mount/error.c
> index 73295bf0567c..9ddbcc096f72 100644
> --- a/utils/mount/error.c
> +++ b/utils/mount/error.c
> @@ -207,16 +207,17 @@ void mount_error(const char *spec, const char *mount_point, int error)
>   				progname, spec);
>   		break;
>   	case EINVAL:
> -		nfs_error(_("%s: an incorrect mount option was specified"), progname);
> +		nfs_error(_("%s: an incorrect mount option was specified for %s"),
> +				progname, mount_point);
>   		break;
>   	case EOPNOTSUPP:
> -		nfs_error(_("%s: requested NFS version or transport protocol is not supported"),
> -				progname);
> +		nfs_error(_("%s: requested NFS version or transport protocol is not supported for %s"),
> +				progname, mount_point);
>   		break;
>   	case ENOTDIR:
>   		if (spec)
> -			nfs_error(_("%s: mount spec %s or point %s is not a "
> -				  "directory"),	progname, spec, mount_point);
> +			nfs_error(_("%s: mount spec %s or point %s is not a directory"),
> +				  progname, spec, mount_point);
>   		else
>   			nfs_error(_("%s: mount point %s is not a directory"),
>   				  progname, mount_point);
> @@ -227,31 +228,31 @@ void mount_error(const char *spec, const char *mount_point, int error)
>   		break;
>   	case ENOENT:
>   		if (spec)
> -			nfs_error(_("%s: mounting %s failed, "
> -				"reason given by server: %s"),
> -				progname, spec, strerror(error));
> +			nfs_error(_("%s: mounting %s failed, reason given by server: %s"),
> +				  progname, spec, strerror(error));
>   		else
>   			nfs_error(_("%s: mount point %s does not exist"),
> -				progname, mount_point);
> +				  progname, mount_point);
>   		break;
>   	case ESPIPE:
>   		rpc_mount_errors((char *)spec, 0, 0);
>   		break;
>   	case EIO:
> -		nfs_error(_("%s: mount system call failed"), progname);
> +		nfs_error(_("%s: mount system call failed for %s"),
> +			  progname, mount_point);
>   		break;
>   	case EFAULT:
> -		nfs_error(_("%s: encountered unexpected error condition."),
> -				progname);
> +		nfs_error(_("%s: encountered unexpected error condition for %s."),
> +			  progname, mount_point);
>   		nfs_error(_("%s: please report the error to" PACKAGE_BUGREPORT),
> -				progname);
> +			  progname);
>   		break;
>   	case EALREADY:
>   		/* Error message has already been provided */
>   		break;
>   	default:
> -		nfs_error(_("%s: %s"),
> -			progname, strerror(error));
> +		nfs_error(_("%s: %s for %s on %s"),
> +			  progname, strerror(error), spec, mount_point);
>   	}
>   }
>   


      reply	other threads:[~2023-04-05 16:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28  2:53 [PATCH nfs-utils] mount.nfs: always include mountpoint or spec if error messages NeilBrown
2023-04-05 16:30 ` Steve Dickson [this message]

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=13fd348e-cf5a-8507-4ee6-5600de2d034d@redhat.com \
    --to=steved@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    /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