Linux NFS development
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: Steve Dickson <SteveD@redhat.com>
Cc: Fedora Kernel Mailing list <fedora-kernel-list@redhat.com>,
	Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] NFS Client mounts hang when exported directory do not exist
Date: Fri, 11 Apr 2008 12:22:04 -0400	[thread overview]
Message-ID: <47FF902C.40301@oracle.com> (raw)
In-Reply-To: <47FF7FCC.2050403-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2747 bytes --]

Steve Dickson wrote:
> This patch fixes a regression that was introduced by the string based mounts. 
> 
> nfs_mount() statically returns -EACCES for every error returned
> by the remote mounted. This is incorrect because -EACCES is
> an non-fatal error to the mount.nfs command. This error causes
> mount.nfs to retry the mount even in the case when the exported
> directory does not exist. 

I don't doubt this is the case, but I'd like to see a few real world 
examples (maybe even add them as documentary comments in mount.nfs or in 
the kernel).

> This patch maps the errors returned by the remote mountd into
> valid errno values, exactly how it was done pre-string based 
> mounts. By returning the correct errno enables mount.nfs 
> to do the right thing.  
> 
> Signed-off-by: Steve Dickson <steved@redhat.com>
> ---
> 
> diff -up linux/fs/nfs/mount_clnt.c.orig linux/fs/nfs/mount_clnt.c
> --- linux/fs/nfs/mount_clnt.c.orig	2008-04-09 08:32:43.000000000 -0400
> +++ linux/fs/nfs/mount_clnt.c	2008-04-11 11:01:39.000000000 -0400
> @@ -21,6 +21,49 @@
>  
>  static struct rpc_program	mnt_program;
>  
> +static struct {
> +	enum nfs_stat stat;
> +	int errnum;
> +} mnt_errtbl[] = {
> +	{ NFS_OK,		0		},
> +	{ NFSERR_PERM,		EPERM		},
> +	{ NFSERR_NOENT,		ENOENT		},
> +	{ NFSERR_IO,		EIO		},
> +	{ NFSERR_NXIO,		ENXIO		},
> +	{ NFSERR_ACCES,		EACCES		},
> +	{ NFSERR_EXIST,		EEXIST		},
> +	{ NFSERR_NODEV,		ENODEV		},
> +	{ NFSERR_NOTDIR,	ENOTDIR		},
> +	{ NFSERR_ISDIR,		EISDIR		},
> +#ifdef NFSERR_INVAL
> +	{ NFSERR_INVAL,		EINVAL		},	/* that Sun forgot */
> +#endif
> +	{ NFSERR_FBIG,		EFBIG		},
> +	{ NFSERR_NOSPC,		ENOSPC		},
> +	{ NFSERR_ROFS,		EROFS		},
> +	{ NFSERR_NAMETOOLONG,	ENAMETOOLONG	},
> +	{ NFSERR_NOTEMPTY,	ENOTEMPTY	},
> +	{ NFSERR_DQUOT,		EDQUOT		},
> +	{ NFSERR_STALE,		ESTALE		},
> +#ifdef EWFLUSH
> +	{ NFSERR_WFLUSH,	EWFLUSH		},
> +#endif
> +	/* Throw in some NFSv3 values for even more fun (HP returns these) */
> +	{ 71,			EREMOTE		},
> +};
> +static int mnt_errtbl_sz = sizeof(mnt_errtbl)/sizeof(mnt_errtbl[0]);
> +
> +static inline int mnt_err_map(int stat)
> +{
> +	int i;
> +
> +	for (i = 0; i < mnt_errtbl_sz; i++) {
> +		if (mnt_errtbl[i].stat == stat)
> +			return -mnt_errtbl[i].errnum;
> +	}
> +	return -EACCES;
> +}
> +

This probably isn't necessary.  It looks like nfs_stat_to_errno() 
already does everything you want.

>  struct mnt_fhstatus {
>  	u32 status;
>  	struct nfs_fh *fh;
> @@ -98,7 +141,7 @@ out_call_err:
>  
>  out_mnt_err:
>  	dprintk("NFS: MNT server returned result %d\n", result.status);
> -	status = -EACCES;
> +	status = mnt_err_map(result.status);

The question here is whether nfs_mount's other caller (NFSROOT) can 
handle error codes other than EACCES.

>  	goto out;
>  }

[-- Attachment #2: Type: text/plain, Size: 169 bytes --]

_______________________________________________
Fedora-kernel-list mailing list
Fedora-kernel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-kernel-list

  parent reply	other threads:[~2008-04-11 16:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-11 15:12 [PATCH] NFS Client mounts hang when exported directory do not exist Steve Dickson
     [not found] ` <47FF7FCC.2050403-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2008-04-11 15:20   ` Eric Paris
     [not found]     ` <1207927210.3379.1.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-04-11 16:10       ` Steve Dickson
     [not found]         ` <47FF8D6A.9040902-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2008-04-11 18:35           ` Eric Paris
     [not found]             ` <1207938902.3379.7.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-04-12  0:14               ` Steve Dickson
2008-04-11 16:22   ` Chuck Lever [this message]
2008-04-11 16:37     ` Steve Dickson
  -- strict thread matches above, loose matches on Subject: below --
2008-04-11 16:05 Steve Dickson
2008-04-12  0:03 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=47FF902C.40301@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=SteveD@redhat.com \
    --cc=fedora-kernel-list@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /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